public override Prototype.IFileOrFolder Copy(DecisionMaker context, string name, string PathFrom, string PathTo) { Prototype.IFileOrFolder element = new Prototype.FolderItem(PathFrom, name); Prototype.IFileOrFolder copiedelement = element.Clone(); copiedelement.SetPath(PathTo); try { System.IO.Directory.CreateDirectory(System.IO.Path.Combine(PathTo, name)); element.Copy(copiedelement.GetPath()); context.State = new NotReady(); } catch { MessageBox.Show("An error ocured during coping process", "Error", MessageBoxButtons.OK); System.IO.Directory.Delete(System.IO.Path.Combine(PathTo, name)); } return(copiedelement); }
public override Prototype.IFileOrFolder Copy(string name, string PathFrom, string PathTo) { Prototype.IFileOrFolder element = new Prototype.FolderItem(PathFrom, name); Prototype.IFileOrFolder copiedelement = element.Clone(); copiedelement.SetPath(PathTo); try { System.IO.Directory.CreateDirectory(System.IO.Path.Combine(PathTo, name)); OperationWithFolder operationWith = new OperationWithFolder(); operationWith.Algorithm(element.GetName(), element.GetPath(), copiedelement.GetPath(), false); //element.Copy(copiedelement.GetPath()); context.State = new NotReady(); copiedelement.SetInfo("Copy folder success!"); } catch { System.IO.Directory.Delete(System.IO.Path.Combine(PathTo, name)); copiedelement.SetInfo("Copy folder error message!"); } return(copiedelement); }