Пример #1
0
        internal static void WriteFailedActions(SyncExecution syncExec, StreamWriter writer)
        {
            if (syncExec.FailedActions.Count > 0)
            {
                var failedActions = new List <FilePairAction>(syncExec.FailedActions);
                failedActions.Sort();

                writer.WriteLine("\n");
                writer.WriteLine(failedActions.Count +
                                 " actions could not be performed:");
                foreach (var action in failedActions)
                {
                    var sourceFile = WorkingWithFiles.GetSourceAndDestFile(action.File1, action.File2)[FileType.Source];
                    var destFile   = WorkingWithFiles.GetSourceAndDestFile(action.File1, action.File2)[FileType.Destination];
                    var sourcePath = sourceFile != null ? sourceFile.fullPath : "";
                    var destPath   = destFile != null ? destFile.fullPath : "";

                    writer.WriteLine("\taction:       " + action.ActionType);
                    writer.WriteLine("\tdirection:    " + action.ActionDirection);
                    writer.WriteLine("\tsource file:  " + sourcePath);
                    writer.WriteLine("\tdest file:    " + destPath);
                    writer.WriteLine("\treason:       " + action.ExceptionMessage);
                    writer.WriteLine();
                }
            }
        }
Пример #2
0
        internal static void WriteActionsList(SyncExecution syncExec, StreamWriter writer)
        {
            var    actionList = syncExec.ActionsList.Where(x => x.ActionType != ActionType.None);
            string direction;
            string source;
            string dest;


            writer.WriteLine("\nList of actions to perform: ");
            foreach (var action in actionList)
            {
                switch (action.ActionDirection)
                {
                case Direction.None:
                    direction = "==";
                    break;

                case Direction.SourceToDestination:
                    direction = "=>";
                    break;

                case Direction.DestinationToSource:
                    direction = "<=";
                    break;

                case Direction.Unknown:
                    direction = "??";
                    break;

                default:
                    throw new Exception("Ivalid direction");
                }

                var filesDict = WorkingWithFiles.GetSourceAndDestFile(action.File1, action.File2);
                source = filesDict[FileType.Source] != null ? filesDict[FileType.Source].fullPath : "";
                dest   = filesDict[FileType.Destination] != null ? filesDict[FileType.Destination].fullPath : "";

                writer.WriteLine(direction + action.ActionType + direction
                                 + source + "   -   " + dest);
            }
        }