public void CreateXMLFile() { var parms = new CopyCommandParameters { CopySubdirectories = true, DeleteExistingDirectoriesFirst = true, DeleteExistingFilesFirst = true, WildCard = "*.*", FileName = "", RegExFilter = "", PostCopyAction = "" }; var cmd1 = new CopyFileCommand { CommandParameters = parms, SourceDirectory = @"D:\T001\TestFolder", TargetDirectory = @"D:\T002\TestFolder" }; var cmd2 = new CopyFileCommand { CommandParameters = parms, SourceDirectory = @"D:\T001", TargetDirectory = @"D:\T015" }; var cmd3 = new CopyFileCommand { CommandParameters = parms, SourceDirectory = @"D:\T001", TargetDirectory = @"D:\T003" }; var list = new List<CopyFileCommand> {cmd1,cmd2,cmd3}; var root = new CopyFileOperation { CopyFileCommands = list }; var u = new HelperUtility(); var serializer = new XmlSerializer(typeof (CopyFileOperation)); var output = Path.Combine(@"D:\CS_Test", u.XMLCommandFileName); var fs = new FileStream(output, FileMode.Create); serializer.Serialize(fs,root); fs.Close(); }
public void Execute(CopyFileOperation copyOp) { if(copyOp==null || copyOp.CopyFileCommands == null || copyOp.CopyFileCommands.Count < 1) { throw new Exception("Invalid Copy File Commands Object!"); } foreach (var cmd in copyOp.CopyFileCommands) { if(ValidateCopyCommand(cmd)) { ProcessCommand(cmd); } } }
public void SetUp() { var parms = new CopyCommandParameters { CopySubdirectories = true, DeleteExistingDirectoriesFirst = true, DeleteExistingFilesFirst = true, WildCard = "*.*" }; var cmd1 = new CopyFileCommand { CommandParameters = parms, SourceDirectory = @"D:\CS_Test", TargetDirectory = @"D:\T002" }; var cmd2 = new CopyFileCommand { CommandParameters = parms, SourceDirectory = @"D:\T001\TestFolder", TargetDirectory = @"D:\T015\TestFolder" }; var cmd3 = new CopyFileCommand { CommandParameters = parms, SourceDirectory = @"D:\T001", TargetDirectory = @"D:\T003" }; var list = new List<CopyFileCommand> {cmd1,cmd2,cmd3}; _copyFileOp = new CopyFileOperation { CopyFileCommands = list }; }