public void ResolveConflict(ISavedGameMetadata chosenMetadata, SavedGameMetadataUpdate metadataUpdate, byte[] updatedData) { NativeSnapshotMetadata convertedMetadata = chosenMetadata as NativeSnapshotMetadata; if (convertedMetadata != mOriginal && convertedMetadata != mUnmerged) { Logger.e("Caller attempted to choose a version of the metadata that was not part " + "of the conflict"); mCompleteCallback(SavedGameRequestStatus.BadInputError, null); return; } NativeSnapshotMetadataChange convertedMetadataChange = new NativeSnapshotMetadataChange.Builder().From(metadataUpdate).Build(); mManager.Resolve(convertedMetadata, convertedMetadataChange, mConflictId, updatedData, response => { // If the resolution didn't succeed, propagate the failure to the client. if (!response.RequestSucceeded()) { mCompleteCallback(AsRequestStatus(response.ResponseStatus()), null); return; } // Otherwise, retry opening the file. mRetryFileOpen(); }); }
private static NativeSnapshotMetadataChange AsMetadataChange(SavedGameMetadataUpdate update) { NativeSnapshotMetadataChange.Builder builder = new NativeSnapshotMetadataChange.Builder(); if (update.IsCoverImageUpdated) { builder.SetCoverImageFromPngData(update.UpdatedPngCoverImage); } if (update.IsDescriptionUpdated) { builder.SetDescription(update.UpdatedDescription); } if (update.IsPlayedTimeUpdated) { builder.SetPlayedTime((ulong)update.UpdatedPlayedTime.Value.TotalMilliseconds); } return(builder.Build()); }