Example #1
0
 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);
 }
Example #2
0
        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);
        }