Пример #1
0
        public object Clone()
        {
            var cc = new PathFromAndTo();

            cc.From = (PathCredentials )From.Clone();
            cc.To   = (PathCredentials)To.Clone();
            if (ScheduleTask != null)
            {
                cc.ScheduleTask = (ScheduleTime)ScheduleTask.Clone();
            }
            cc.RoboCopy_Options   = RoboCopy_Options;
            cc.ExtendedAttributes = ExtendedAttributes;
            cc.IsEnabled          = IsEnabled;
            return(cc);
        }
Пример #2
0
        public RoboCopyAgent(PathFromAndTo task)
        {
            fromPath    = task.From;
            toPath      = task.To;
            Schduletask = task.ScheduleTask;
            if (this.fromPath.Path.Last() != '\\')
            {
                this.fromPath.Path += "\\";
            }
            if (this.toPath.Path.Last() != '\\')
            {
                this.toPath.Path += "\\";
            }
            if (!string.IsNullOrWhiteSpace(task.RoboCopy_Options))
            {
                RoboOptions = task.RoboCopy_Options;
            }

            var switches = new StringBuilder();

            if (task.From.ExcludedFiles.Count > 0)
            {
                switches.Append(" /xf");
                foreach (string file in task.From.ExcludedFiles)
                {
                    switches.AppendPathOrWildcard(task.From.Path, file);
                }
            }

            if (task.From.ExcludedFolders.Count > 0)
            {
                switches.Append(" /xd");
                foreach (string folder in task.From.ExcludedFolders)
                {
                    switches.AppendPathOrWildcard(task.From.Path, folder);
                }
            }

            if (!string.IsNullOrEmpty(task.ExtendedAttributes))
            {
                switches.Append(" /copy:dat");
                switches.Append(task.ExtendedAttributes);
            }

            RoboOptions += switches.ToString();
        }