public async Task <DriveFileCollection> CreateFolderAsync(string folderName, DriveFileCollection destFolder, CancellationToken token) { var tasks = destFolder.Select(x => x.Drive.CreateFolderAsync(folderName, x, token)); var ret = new DriveFileCollection(await Task.WhenAll(tasks)); return(ret); }
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 abstract StorageFile GetFile(DriveFileCollection driveFile);
public async Task DeleteFolderAsync(DriveFileCollection driveFolder, CancellationToken token) { var tasks = driveFolder.Select(x => x.Drive.DeleteFolderAsync(x, token)); await Task.WhenAll(tasks); }
public async Task <DriveFileCollection> UploadFileAsync(string pathName, DriveFileCollection destFolder, string storageFileId, CancellationToken token) { throw new NotImplementedException(); }
public async Task <Stream> ReadFileAsync(DriveFileCollection file, CancellationToken token) { throw new NotImplementedException(); }
public async Task <Image> GetThumbnailAsync(DriveFileCollection file, CancellationToken token) { throw new NotImplementedException(); }
public async Task <ICollection <DriveFileCollection> > GetSubfoldersAsync(DriveFileCollection folder, CancellationToken token) { throw new NotImplementedException(); }
public async Task EnumerateFilesRecursive(DriveFileCollection driveFolder, Action <DriveFileCollection> action, CancellationToken token) { throw new NotImplementedException(); }
public async Task DownloadFileAsync(DriveFileCollection driveFile, string destFolder, ActionIfFileExists actionIfFileExists, CancellationToken token) { var file = driveFile.First(x => !x.Drive.IsIgnored); await file.Drive.DownloadFileAsync(file, destFolder, actionIfFileExists, token); }