Esempio n. 1
0
 internal Copier(ArgsDto options)
 {
     _options     = options;
     _result      = new CopyResult();
     _sourceFiles = new List <FileInfo>();
     _outFolder   = _options.Output.FullName + "\\";
     _inputFolder = _options.Input.FullName;
 }
Esempio n. 2
0
        private static ArgsDto ParseInput(string[] args)
        {
            if (args == null || args.Length != 2 || args.Any(x => x.Contains("?")))
            {
                Console.WriteLine(Environment.NewLine);
                Console.WriteLine("Use: CopyLarger \"<source folder>\" \"<target folder>\"");
                Console.WriteLine(Environment.NewLine);
                Console.WriteLine("CopyLarger does not check if the target folder has enough room, nor if the file content differs when the sizes are equal.");
                Console.WriteLine("Files and folders will be copied with the same structure as source folder has");
                Utils.WriteExit(1);
                return(null);                //make code validation happy
            }

            var options = new ArgsDto();

            if (Directory.Exists(args[0]))
            {
                options.Input = new DirectoryInfo(args[0]);
            }
            else
            {
                Console.WriteLine($"Invalid input folder: {args[0]}");
                Utils.WriteExit(12);
            }

            if (Directory.Exists(args[1]))
            {
                options.Output = new DirectoryInfo(args[1]);
            }
            else
            {
                Console.WriteLine($"Invalid output folder: {args[1]}");
                Utils.WriteExit(13);
            }

            return(options);
        }