Example #1
0
 public override StorageFile GetFile(DriveFileCollection driveFile)
 {
     var id = driveFile.Select(x => x.StorageFileId).FirstOrDefault(x => x != null);
     if (id == null)
     {
         return null;
     }
     MockStorageFile ret;
     files.TryGetValue(id, out ret);
     return ret;
 }
Example #2
0
        public override StorageFile GetFile(DriveFileCollection driveFile)
        {
            var id = driveFile.Select(x => x.StorageFileId).FirstOrDefault(x => x != null);

            if (id == null)
            {
                return(null);
            }
            MockStorageFile ret;

            files.TryGetValue(id, out ret);
            return(ret);
        }
Example #3
0
 public abstract StorageFile GetFile(DriveFileCollection driveFile);
Example #4
0
 private static bool TryFindFileByName(string fileName, bool isLantinOnlySupport, IEnumerable<DriveFileCollection> fileCollections, 
     out DriveFileCollection collection)
 {
     foreach (var item in fileCollections.Where(item => GetFileName(item.FirstOrDefault(), isLantinOnlySupport) == fileName))
     {
         collection = item;
         return true;
     }
     collection = null;
     return false;
 }
Example #5
0
 private void PutFileTo(DriveFile file, IDictionary<string, DriveFileCollection> fileCollections)
 {
     DriveFileCollection collection;
     if (file.StorageFileId == null)
     {
         if (!TryFindFileByName(file.Name, file.Drive.IsLantinOnlySupport, fileCollections.Values, out collection))
         {
             collection = new DriveFileCollection();
             fileCollections.Add(file.StorageFileId ?? Guid.NewGuid().ToString(), collection);
         }
     }
     else if (!fileCollections.TryGetValue(file.StorageFileId, out collection))
     {
         collection = new DriveFileCollection();
         fileCollections.Add(file.StorageFileId ?? Guid.NewGuid().ToString(), collection);
     }
     collection.Add(file);
 }
Example #6
0
 public override StorageFile GetFile(DriveFileCollection driveFiles)
 {
     return(new GlacierFile(this, driveFiles.StorageFileId, driveFiles.IsFolder, driveFiles.Name));
 }