예제 #1
0
 public Directory(string name, Drive drive, Directory directory)
 {
     _name =             name;
     _parentDrive =      drive;
     _parentDirectory =  directory;
     _directories =      new List<Directory>();
     _files =            new List<File>();
 }
예제 #2
0
 public File(string name, string content, Directory parentDirectory)
 {
     _name =             name;
     _content =          content;
     _parentDirectory =  parentDirectory;
 }
예제 #3
0
 /// <summary>
 /// Set the parent Directory of the File
 /// </summary>
 /// <param name="directory"></param>
 /// <returns></returns>
 public Directory SetParentDirectory(Directory directory)
 {
     _parentDirectory = directory;
     return _parentDirectory;
 }
예제 #4
0
 /// <summary>
 /// Add a Directory as Sub-Directory
 /// </summary>
 /// <param name="dir"></param>
 /// <returns></returns>
 public int AddDirectory(Directory dir)
 {
     if (_directories.Any(x => x == dir)) return 1;
     _directories.Add(dir);
     return 0;
 }
예제 #5
0
 /// <summary>
 /// Remove a Directory as Sub-Directory
 /// </summary>
 /// <param name="dir"></param>
 /// <returns></returns>
 public int RemoveDirectory(Directory dir)
 {
     if (_directories.Any(x => x != dir)) return 1;
     _directories.Remove(dir);
     return 0;
 }