public override Prototype.IFileOrFolder Move(DecisionMaker context, string name, string PathFrom, string PathTo) { Prototype.IFileOrFolder element = new Prototype.FileItem(PathFrom, name); try { element.Copy(PathTo); this.Delete(context, name, PathFrom); context.State = new NotReady(); } catch { MessageBox.Show("An error ocured during moving process", "Error", MessageBoxButtons.OK); } element.SetPath(PathTo); return(element); }
public override Prototype.IFileOrFolder Copy(DecisionMaker context, string name, string PathFrom, string PathTo) { Prototype.IFileOrFolder element = new Prototype.FileItem(PathFrom, name); Prototype.IFileOrFolder copiedelement = element.Clone(); copiedelement.SetPath(PathTo); try { element.Copy(copiedelement.GetPath()); context.State = new NotReady(); } catch { MessageBox.Show("An error ocured during coping process", "Error", MessageBoxButtons.OK); } return(copiedelement); }
public override Prototype.IFileOrFolder Copy(string name, string PathFrom, string PathTo) { Prototype.IFileOrFolder element = new Prototype.FileItem(PathFrom, name); Prototype.IFileOrFolder copiedelement = element.Clone(); copiedelement.SetPath(PathTo); try { OperationWithFile operationWith = new OperationWithFile(); operationWith.Algorithm(element.GetName(), element.GetPath(), copiedelement.GetPath(), false); //element.Copy(copiedelement.GetPath()); context.State = new NotReady(); copiedelement.SetInfo("Copy file succes!"); } catch { copiedelement.SetInfo("Copy file error message!"); } return(copiedelement); }