Esempio n. 1
0
 //            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;
 }
Esempio n. 2
0
 /*  /// <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);
 }
Esempio n. 3
0
 public DirNode EnsureDirNode(Name name)
 {
     DirNode node;
     if (!_directories.TryGetValue(name, out node))
     {
         node = new DirNode(name, this);
         _directories.Add(name, node);
     }
     return node;
 }
Esempio n. 4
0
 public void AddDirNode(Name newName, DirNode node)
 {
     node._folderInfo = node._folderInfo.WithNewPath(newName);
     node._parent = this;
     _directories.Add(newName, node);
 }
Esempio n. 5
0
 public DirNode(Name name, DirNode parent)
 {
     _folderInfo = new FsFolder<Name>(name);
     _parent = parent;
     _directories = new Dictionary<Name, DirNode>();
     _files = new Dictionary<Name, FsFile<Name>>();
 }
Esempio n. 6
0
 public bool Equals(Name other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return Equals(other._name, _name);
 }