public Directory(string name, Drive drive, Directory directory) { _name = name; _parentDrive = drive; _parentDirectory = directory; _directories = new List<Directory>(); _files = new List<File>(); }
public File(string name, string content, Directory parentDirectory) { _name = name; _content = content; _parentDirectory = parentDirectory; }
/// <summary> /// Set the parent Directory of the File /// </summary> /// <param name="directory"></param> /// <returns></returns> public Directory SetParentDirectory(Directory directory) { _parentDirectory = directory; return _parentDirectory; }
/// <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; }
/// <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; }