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; }
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); }
public abstract StorageFile GetFile(DriveFileCollection driveFile);
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; }
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); }
public override StorageFile GetFile(DriveFileCollection driveFiles) { return(new GlacierFile(this, driveFiles.StorageFileId, driveFiles.IsFolder, driveFiles.Name)); }