示例#1
0
 /// <summary>
 /// Removes a File in the Directory.
 /// </summary>
 /// <returns><c>true</c>, if File was found and removed, <c>false</c> otherwise.</returns>
 /// <param name="f">The File to find.</param>
 public bool RemoveFile(File f)
 {
     if (f == null)
     {
         return(false);
     }
     f.LogOperation(FileOpLogType.DeleteFile, Path);
     return(Object.files.Remove(f.Object));
 }
示例#2
0
        /// <summary>
        /// Creates a new File based on the name and data.
        /// </summary>
        /// <returns>The File that was created.</returns>
        /// <param name="name">The name to assign to the File.</param>
        /// <param name="data">The data to assign to the File.</param>
        public File CreateFile(string name, string data = null)
        {
            if (data == null)
            {
                data = "";
            }
            var r = new File(new FileEntry(data, name), this);

            r.LogOperation(FileOpLogType.CreateFile, data, Path);
            Object.Add(r.Object);
            return(r);
        }
示例#3
0
 /// <summary>
 /// Moves a File to a new Directory.
 /// </summary>
 /// <returns>The moved File.</returns>
 /// <param name="f">The File to move.</param>
 /// <param name="newDir">The new Directory.</param>
 public File MoveFile(File f, Directory newDir)
 {
     if (!Contains(f))
     {
         return(null);
     }
     f.LogOperation(FileOpLogType.MoveFile, f.Name, Path, newDir.Path);
     f.Index  = newDir.Object.files.Count;
     f.Parent = newDir;
     Object.Move(f.Object, newDir.Object);
     f.CorrectPath();
     return(f);
 }