Пример #1
0
        private static int Main(string[] args)
        {
            if (args.Length < 2 || args.Length > 3)
            {
                Console.WriteLine($"{ProgramName}: Incorrect arguments. Please use <src> <dest> or -<flags> <src> <dest>");

                return(-1);
            }
            switch (args.Length)
            {
            case 2:
                _srcPath  = args[0];
                _destPath = args[1];
                break;

            case 3:
                ParseFlags(args[0]);
                _srcPath  = args[1];
                _destPath = args[2];
                break;
            }

            try
            {
                Console.WriteLine($"{ProgramName}: Copying with {_fileCopier.GetType().Name} started.");
                var result = _fileCopier.DeepCopying(_srcPath, _destPath, _overwrite);
                Console.WriteLine($"{ProgramName}: Copying finished.");
                Console.WriteLine($"    Copied files count: {result.CopiedFilesCount}");
                Console.WriteLine($"    Size of copied files: {result.CopiedFilesSizeString}");
                Console.WriteLine($"    Elapsed time: {result.CopyingElapsedTime.TotalMilliseconds} milliseconds");
            }
            catch (Exception e)
            {
                Console.WriteLine($"{ProgramName}: {e.Message}");
            }

            return(0);
        }