Created
September 28, 2016 06:22
-
-
Save iodiot/45d6ab2a2f9ed3b7a13ff03a6949fbd6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private bool LoadSnapshot() | |
{ | |
try | |
{ | |
var pendingResult = GamesClass.Snapshots.Open(client, SavedGameFileName, true); | |
var result = pendingResult.AsAsync<ISnapshotsOpenSnapshotResult>().Result; | |
var retriesCount = 2; | |
while (retriesCount-- > 0) | |
{ | |
var code = result.Status.StatusCode; | |
if (code == STATUS_OK) | |
{ | |
snapshot = result.Snapshot; | |
return true; | |
} | |
else if (code == STATUS_SNAPSHOT_CONTENTS_UNAVAILABLE) | |
{ | |
snapshot = result.Snapshot; | |
return true; | |
} | |
else if (code == STATUS_SNAPSHOT_CONFLICT) | |
{ | |
var conflictId = result.ConflictId; | |
var serverSnapshot = result.Snapshot; | |
var conflictedSnapshot = result.ConflictingSnapshot; | |
pendingResult = GamesClass.Snapshots.ResolveConflict(client, conflictId, conflictedSnapshot); | |
result = pendingResult.AsAsync<ISnapshotsOpenSnapshotResult>().Result; | |
} | |
} | |
} | |
catch(Exception e) | |
{ | |
core.DebugMessage(e.Message); | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment