コード例 #1
0
        public async Task <(bool success, IDocument result)> TryMoveToAsync(IDocument entry, ICollection collection, string name, CancellationToken ct)
        {
            LocalDiskDocument ldd = null;

            try {
                ldd = DocDict[FullPath(entry.FullPath())];
            } catch { }
            return(ldd != null, ldd == null? null: await ldd.MoveToAsync(collection, name, ct));
        }
コード例 #2
0
        public async Task <(bool success, Stream result)> TryCreateAsync(IDocument entry, CancellationToken ct)
        {
            LocalDiskDocument ldd = null;

            try {
                ldd = DocDict[FullPath(entry.FullPath())];
            } catch { }
            return(ldd != null, ldd == null? null: await ldd.CreateAsync(ct));
        }
コード例 #3
0
        public async Task <(bool success, Stream result)> TryOpenReadAsync(IDocument entry, CancellationToken ct)
        {
            LocalDiskDocument ldd      = null;
            string            fullPath = FullPath(entry.FullPath());

            try {
                ldd = DocDict[fullPath];
            } catch {
                //Manual search?
            }
            return(ldd != null, ldd == null? null: await ldd.OpenReadAsync(ct));
        }
コード例 #4
0
        public Task <IDocument> CreateDocumentAsync(string name, CancellationToken ct)
        {
            string path = System.IO.Path.Combine(AbsolutePath, name);

            LocalDiskDocument ldd = DocDict.Select(x => x.Value).Where(x => x.AbsolutePath == path).FirstOrDefault();

            if (ldd == null)
            {
                ldd = LocalDiskDocument.RequestTracked(new FileInfo(path), Chain, FileSystem, _Parent, ColDict, DocDict);
            }

            return(Task.FromResult <IDocument>(ldd));
        }
コード例 #5
0
        public static LocalDiskDocument RequestTracked(FileInfo di, LocalDiskAccessFileChain chain, IFileSystem fileSystem, LocalDiskCollection localDiskCollection, IDictionary <string, LocalDiskCollection> colDict, IDictionary <string, LocalDiskDocument> docDict)
        {
            LocalDiskDocument ret;
            string            name = di.FullName.ScrubPath();

            if (docDict != null && docDict.ContainsKey(name))
            {
                ret = docDict[name];
            }
            else
            {
                ret = new LocalDiskDocument(di, chain, fileSystem, localDiskCollection, colDict, docDict);
                if (docDict != null)
                {
                    docDict.Add(ret.AbsolutePath, ret);
                }
            }
            ret.FileSystemInfo.Refresh();
            return(ret);
        }