예제 #1
0
        private void ExecuteActions(IList <SyncAction> actionsList, ExecuteActionsCallback exe)
        {
            foreach (SyncAction action in actionsList)
            {
                currentProgress++;
                OnProgressChanged(new SyncProgressChangedEventArgs(currentProgress, totalProgress));
                OnSyncFileChanged(new SyncFileChangedEventArgs(action.ChangeType, action.RelativeFilePath));

                if (action.Skip)
                {
                    log.Add(new LogActivity(action.RelativeFilePath, action.ChangeType.ToString(), "SKIPPED"));
                    continue;
                }

                string logStatus = "";
                try
                {
                    if (exe != null)
                    {
                        exe(action);
                    }
                    logStatus = "SUCCESS";
                }
                catch (Exception)
                {
                    logStatus = "FAIL";
                }
                finally
                {
                    if (action.ConflictResolution != ConflictResolution.NONE)
                    {
                        logStatus = logStatus.Insert(0, action.ConflictResolution.ToString() + "_");
                    }
                    log.Add(new LogActivity(action.RelativeFilePath, action.ChangeType.ToString(), logStatus));
                }
            }
        }
예제 #2
0
        private void ExecuteActions(IList<SyncAction> actionsList, ExecuteActionsCallback exe)
        {
            foreach (SyncAction action in actionsList)
            {
                currentProgress++;
                OnProgressChanged(new SyncProgressChangedEventArgs(currentProgress, totalProgress));
                OnSyncFileChanged(new SyncFileChangedEventArgs(action.ChangeType, action.RelativeFilePath));

                if (action.Skip)
                {
                    log.Add(new LogActivity(action.RelativeFilePath, action.ChangeType.ToString(), "SKIPPED"));
                    continue;
                }

                string logStatus = "";
                try
                {
                    if (exe != null) exe(action);
                    logStatus = "SUCCESS";
                }
                catch (Exception)
                {
                    logStatus = "FAIL";

                }
                finally
                {
                    if (action.ConflictResolution != ConflictResolution.NONE)
                        logStatus = logStatus.Insert(0, action.ConflictResolution.ToString() + "_");
                    log.Add(new LogActivity(action.RelativeFilePath, action.ChangeType.ToString(), logStatus));
                }
            }
        }