// public void GetIndexed(RelPath currentPath, IndexedObjects result) // { // foreach (var file in _files.Values) // { // RelPath path = file.Path.FileName().RelativeIn(currentPath); // result.Index.Add(path, new FsFile<RelPath>(path, file.Size, file.LastWrite)); // } // // foreach (var dir in _directories.Values) // { // RelPath childPath = dir.Name.RelativeIn(currentPath); // result.Index.Add(childPath, new FsFolder<RelPath>(childPath)); // dir.GetIndexed(childPath, result); // } // } public DirNode RemoveDirNode(Name dirName) { DirNode node = _directories[dirName]; _directories.Remove(dirName); return node; }
/* /// <summary> /// /// </summary> /// <param name="descriptor"></param> /// <returns>True if parameter is a directory, false otherwise.</returns> public bool Remove(FsObject<RelPath> descriptor) { var name = descriptor.Path.FileName(); if (descriptor is FsFile<RelPath>) { _files.Remove(name); return false; } else { _directories.Remove(name); return true; } }*/ public bool Remove(Name objName) { return _files.Remove(objName) || _directories.Remove(objName); }
public DirNode EnsureDirNode(Name name) { DirNode node; if (!_directories.TryGetValue(name, out node)) { node = new DirNode(name, this); _directories.Add(name, node); } return node; }
public void AddDirNode(Name newName, DirNode node) { node._folderInfo = node._folderInfo.WithNewPath(newName); node._parent = this; _directories.Add(newName, node); }
public DirNode(Name name, DirNode parent) { _folderInfo = new FsFolder<Name>(name); _parent = parent; _directories = new Dictionary<Name, DirNode>(); _files = new Dictionary<Name, FsFile<Name>>(); }
public bool Equals(Name other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return Equals(other._name, _name); }