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