public async Task <IDocument> MoveToAsync(ManagedDocument entry, ICollection collection, string name, CancellationToken ct)
        {
            ((ManagedCollection)entry.Parent).Documents.Remove(entry);
            IDocument ret = await FileSystem.MoveToAsync(entry, collection, name, ct);

            return(await ret.CloneManagedAsync(this, FileSystem, (ManagedCollection)collection));
        }
        public async Task <IDocument> CopyToAsync(ManagedDocument entry, ICollection collection, string name, CancellationToken ct)
        {
            IDocument tmp = await FileSystem.CopyToAsync(entry, collection, name, ct);

            ManagedDocument ret = await tmp.CloneManagedAsync(this, FileSystem, CollectionFastAccess[collection.Name]);

            return(ret);
        }
 public async Task <SelectionResult> SelectAsync(string path, CancellationToken ct)
 {
     if (string.IsNullOrEmpty(path))
     {
         return(SelectionResult.Create(CollectionFastAccess[path]));
     }
     else if (CollectionFastAccess.ContainsKey(path))
     {
         return(SelectionResult.Create(CollectionFastAccess[path]));
     }
     else if (CollectionFastAccess.ContainsKey(path + '\\'))
     {
         return(SelectionResult.Create(CollectionFastAccess[path + '\\']));
     }
     else if (CollectionFastAccess.ContainsKey(path + '/'))
     {
         return(SelectionResult.Create(CollectionFastAccess[path + '/']));
     }
     else if (DocumentFastAccess.ContainsKey(path))
     {
         ManagedDocument manDoc = DocumentFastAccess[path];
         return(SelectionResult.Create(manDoc.Parent, manDoc));
     }
     else
     {
         string[]          pathParts = path.Split('\\', '/');
         int               i         = 0;
         ManagedCollection mc        = Root;
         for (; i < pathParts.Length; i++)
         {
             ManagedCollection nmc = mc.Collections.Where(x => x.Name.Equals(pathParts[i])).SingleOrDefault();
             if (nmc == null)
             {
                 break;
             }
             mc = nmc;
         }
         return(SelectionResult.CreateMissingDocumentOrCollection(mc, new ArraySegment <string>(pathParts, i, pathParts.Length - i)));
     }
 }
 public Task <Stream> OpenReadAsync(ManagedDocument entry, CancellationToken ct)
 {
     return(FileSystem.OpenReadAsync(entry, ct));
 }
 public Task <DeleteResult> DeleteAsync(ManagedDocument entry, CancellationToken ct)
 {
     ((ManagedCollection)entry.Parent).Documents.Remove(entry);
     return(FileSystem.DeleteAsync(entry, ct));
 }