Beispiel #1
0
        public context(string[] args)
        {
            directoryPair updatedFolders = consoleHelper.processParameters(args);

            _folders.SourceFolder = updatedFolders.SourceFolder;
            _folders.TargetFolder = updatedFolders.TargetFolder;
        }
        public static directoryPair processParameters(string[] args)
        {
            directoryPair localPair = new directoryPair();
            string        paramsMissing;

            if (args.Length < 2)
            {
                paramsMissing = kArgumentExceptionMessageUnknown; // you have a logical issue if you get this one !
                if (args.Length == 1)
                {
                    paramsMissing = kArgumentExceptionMessageTargetFolder;
                }
                else if (args.Length == 0)
                {
                    paramsMissing = kArgumentExceptionMessageSourceandTargetFolder;
                }
                // raise exception for missings parms - app will handle
                //TODO turn paramsMissing into an enum and change the processing code
                throw new ArgumentException("Invalid Arguement(s)", paramsMissing);
            }
            else
            {
                // all good - set the source and target folders based on the parms
                localPair.SourceFolder = args[0];
                localPair.TargetFolder = args[1];
            }
            return(localPair);
        }
Beispiel #3
0
 /// <summary>
 ///   copy constructor
 /// </summary>
 /// <param name="dirpair">the directory pair to copy from</param>
 public directoryPair(directoryPair dirpair)
 {
     this._sourceFolder = dirpair._sourceFolder;
     this._targetFolder = dirpair._targetFolder;
 }
 public RobocopyTask(directoryPair inFolders)
 {
     this._folders = inFolders;
 }