Ejemplo n.º 1
0
 public LocalDiskAccessFileChain(LocalDiskAccessFileChain_Options options, IFileSystem system)
 {
     Options  = options;
     ColDict  = new Dictionary <string, LocalDiskCollection>();
     DocDict  = new Dictionary <string, LocalDiskDocument>();
     FastRoot = LocalDiskCollection.RequestTracked(new DirectoryInfo(Options.RootPath), this, system, null, ColDict, DocDict);
 }
Ejemplo n.º 2
0
        public async Task <(bool success, IDocument result)> TryCreateDocumentAsync(ICollection entry, string name, CancellationToken ct)
        {
            LocalDiskCollection ldd = null;

            try {
                ldd = ColDict[FullPath(entry.FullPath())];
            } catch { }
            return(ldd != null, ldd == null? null: await ldd.CreateDocumentAsync(name, ct));
        }
Ejemplo n.º 3
0
        public Task <ICollection> CreateCollectionAsync(string name, CancellationToken ct)
        {
            name = Uri.UnescapeDataString(name);
            Info.CreateSubdirectory(name);
            string path             = System.IO.Path.Combine(AbsolutePath, name);
            LocalDiskCollection ldc = LocalDiskCollection.RequestTracked(new DirectoryInfo(path), Chain, FileSystem, _Parent, ColDict, DocDict);

            return(Task.FromResult <ICollection>(ldc));
        }
Ejemplo n.º 4
0
        public LocalDiskEntry(FileSystemInfo info, LocalDiskAccessFileChain chain, IFileSystem system, LocalDiskCollection parent = null, IDictionary <string, LocalDiskCollection> colDict = null, IDictionary <string, LocalDiskDocument> docDict = null)
        {
            FileSystemInfo = info;

            ColDict = colDict;
            DocDict = docDict;

            Chain      = chain;
            FileSystem = system;

            _Parent = parent;

            //if(name.Contains(".txt")) {
            //    int i = 0;
            //}
        }
Ejemplo n.º 5
0
        public static LocalDiskCollection RequestTracked(DirectoryInfo di, LocalDiskAccessFileChain chain, IFileSystem fileSystem, LocalDiskCollection localDiskCollection, IDictionary <string, LocalDiskCollection> colDict, IDictionary <string, LocalDiskDocument> docDict)
        {
            LocalDiskCollection ret;
            string name = di.FullName.ScrubPath();

            if (colDict != null && colDict.ContainsKey(name))
            {
                ret = colDict[name];
            }
            else
            {
                ret = new LocalDiskCollection(di, chain, fileSystem, localDiskCollection, colDict, docDict);
                if (colDict != null)
                {
                    colDict.Add(ret.AbsolutePath, ret);
                }
            }
            ret.FileSystemInfo.Refresh();
            return(ret);
        }
Ejemplo n.º 6
0
 public LocalDiskCollection(DirectoryInfo info, LocalDiskAccessFileChain chain, IFileSystem system, LocalDiskCollection parent, IDictionary <string, LocalDiskCollection> colDict, IDictionary <string, LocalDiskDocument> docDict)
     : base(info, chain, system, parent, colDict, docDict)
 {
 }
Ejemplo n.º 7
0
 private LocalDiskCollection(string path, LocalDiskAccessFileChain chain, IFileSystem system, LocalDiskCollection parent = null, IDictionary <string, LocalDiskCollection> colDict = null, IDictionary <string, LocalDiskDocument> docDict = null)
     : this(new DirectoryInfo(path), chain, system, parent, colDict, docDict)
 {
 }