예제 #1
0
 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 VCMixedRevisionException)
             {
                 HandleMixedRevision(e as VCMixedRevisionException);
             }
             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);
             }
         });
     }
 }
예제 #2
0
 private static Func <Task <T>, T> NextUpdate <T>(Action <T> postAction)
 {
     return(t =>
     {
         OnNextUpdate.Do(() => postAction(t.Result));
         return t.Result;
     });
 }
예제 #3
0
 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);
     }
     AssetDatabaseRefreshManager.RefreshAssetDatabase();
 }
예제 #4
0
 public static void ExecuteOnMainThread(System.Action action)
 {
     if (ThreadUtility.IsMainThread())
     {
         action();
     }
     else
     {
         OnNextUpdate.Do(action);
     }
 }
예제 #5
0
 public static void ExecuteOnMainThread(Action action)
 {
     if (IsMainThread())
     {
         action();
     }
     else
     {
         OnNextUpdate.Do(action);
     }
 }
 public static void RefreshAssetDatabase()
 {
     if (pendingAssetDatabaseRefresh && !pauseAssetDatabaseRefresh)
     {
         pendingAssetDatabaseRefresh = false;
         OnNextUpdate.Do(() =>
         {
             VCConflictHandler.HandleConflicts();
             refreshAssetDatabaseSynchronous();
         });
     }
 }
예제 #7
0
 private void OnVersionControlBackendChanged(IVersionControlCommands newVcc)
 {
     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);
            }
        }
예제 #9
0
        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          = MergeHandler.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. File will become 'Local Only'";
                    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           = $"There is a conflict in the file:\n '{conflictIt.Compose()}'\n\nUse 'Theirs' or 'Mine'?\n {explanation}\n{(mergable ? mergeExplanation : ignoreExplanation)}\n";
                    int          result            = UserDialog.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 assetPath = conflictIt.Compose();
                            if (VCCommands.Instance.GetConflict(assetPath, out var basePath, out var yours, out var theirs))
                            {
                                MergeHandler.ResolveConflict(assetPath, basePath, theirs, yours);
                            }
                        }
                    }
                }
                OnNextUpdate.Do(AssetDatabase.Refresh);
            }
        }
예제 #10
0
 static VCCommandsOnLoad()
 {
     OnNextUpdate.Do(VCCommands.Initialize);
 }
예제 #11
0
 private static Action <Task <T> > NextUpdate <T>(Action <T> postAction)
 {
     return(t => OnNextUpdate.Do(() => postAction(t.Result)));
 }
예제 #12
0
 public void UnsafeOnCompleted(Action continuation)
 {
     OnNextUpdate.Do(continuation);
 }
예제 #13
0
 private static Action <Task> NextUpdate(Action postAction)
 {
     return(t => OnNextUpdate.Do(postAction));
 }