private void OnStatusCompleted() { //OnNextUpdate.Do(() => D.Log("Status Updatees : " + (StatusCompleted != null ? StatusCompleted.GetInvocationList().Length : 0) + "\n" + StatusCompleted.GetInvocationList().Select(i => (i.Target ?? "") + ":" + i.Method.ToString()).Aggregate((a, b) => a + "\n" + b))); if (StatusCompleted != null) { OnNextUpdate.Do(StatusCompleted); } RefreshAssetDatabase(); }
public static void HandleException(VCException e) { if (e.InnerException is AggregateException) { var aggregateException = e.InnerException as AggregateException; foreach (var exception in aggregateException.InnerExceptions) { if (exception is VCException) { HandleException((VCException)exception); } else { HandleException(new VCException(exception.Message, exception.StackTrace, exception)); } } } else { OnNextUpdate.Do(() => { if (e is VCConnectionTimeoutException) { HandleConnectionTimeOut(e as VCConnectionTimeoutException); } else if (e is VCLocalCopyLockedException) { HandleLocalCopyLocked(e as VCLocalCopyLockedException); } else if (e is VCNewerVersionException) { HandleNewerVersion(e as VCNewerVersionException); } else if (e is VCOutOfDate) { HandleOutOfDate(e as VCOutOfDate); } else if (e is VCCriticalException) { HandleCritical(e as VCCriticalException); } else if (e is VCMissingCredentialsException) { HandleUserCredentials(); } else if (e is VCMonoDebuggerAttachedException) { HandleMonoDebuggerAttached(e as VCMonoDebuggerAttachedException); } else { HandleBase(e); } }); } }
public static void ExecuteOnMainThread(System.Action action) { if (ThreadUtility.IsMainThread()) { action(); } else { OnNextUpdate.Do(action); } }
private void RefreshAssetDatabase() { if (pendingAssetDatabaseRefresh) { pendingAssetDatabaseRefresh = false; OnNextUpdate.Do(() => { VCConflictHandler.HandleConflicts(); refreshAssetDatabaseSynchronous(); }); } }
private void OnVersionControlBackendChanged(IVersionControlCommands newVcc) { if (vcc != null) { vcc.Dispose(); } vcc = newVcc; vcc.ProgressInformation += progress => { if (ProgressInformation != null) { OnNextUpdate.Do(() => ProgressInformation(progress)); } }; vcc.StatusCompleted += OnStatusCompleted; OnNextUpdate.Do(Start); EditorApplication.playModeStateChanged += OnPlaymodeStateChanged; }
public static void HandleConflicts() { var conflicts = VCCommands.Instance.GetFilteredAssets(s => s.fileStatus == VCFileStatus.Conflicted || s.MetaStatus().fileStatus == VCFileStatus.Conflicted).Select(status => status.assetPath).ToArray(); if (conflicts.Any()) { foreach (var conflictIt in conflicts) { if (ignoredConflicts.Contains(conflictIt)) { continue; } bool mergable = VCUtility.IsMergableAsset(conflictIt); const string explanation = "\nTheirs :\nUse the file from the server and discard local changes to the file\n\nMine :\nUse my version of the file and discard the changes someone else made on the server"; const string mergeExplanation = "\nMerge External :\nIgnore the conflict in UVC and handle the conflict in an external program"; const string ignoreExplanation = "\nIgnore :\nIgnore the conflict for now although the file will not be readable by Unity"; string message = string.Format("There is a conflict in the file:\n '{0}'\n\nUse 'Theirs' or 'Mine'?\n {1}\n{2}\n", conflictIt.Compose(), explanation, mergable ? mergeExplanation : ignoreExplanation); int result = EditorUtility.DisplayDialogComplex("Conflict", message, "Theirs", "Mine", mergable ? "Merge External" : "Ignore"); if (result == 0 || result == 1) { VCCommands.Instance.Resolve(new[] { conflictIt.Compose() }, result == 0 ? ConflictResolution.Theirs : ConflictResolution.Mine); } else { ignoredConflicts.Add(conflictIt); /*if (mergable) * { * string mine, theirs, basePath; * if(VCCommands.Instance.GetConflict(conflictIt.Compose(), out basePath, out mine, out theirs)) * { * EditorUtility.InvokeDiffTool("Mine : " + mine, mine, "Theirs : " + theirs, theirs, "Base: " + basePath, basePath); * } * }*/ } } OnNextUpdate.Do(AssetDatabase.Refresh); } }
static VCCommandsOnLoad() { OnNextUpdate.Do(VCCommands.Initialize); }
private static Action <Task <T> > NextUpdate <T>(Action <T> postAction) { return(t => OnNextUpdate.Do(() => postAction(t.Result))); }