Example #1
0
        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);
        }
Example #2
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 #3
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 #4
0
 public abstract StorageFile GetFile(DriveFileCollection driveFile);
Example #5
0
 public async Task DeleteFolderAsync(DriveFileCollection driveFolder, CancellationToken token)
 {
     var tasks = driveFolder.Select(x => x.Drive.DeleteFolderAsync(x, token));
     await Task.WhenAll(tasks);
 }
Example #6
0
 public async Task <DriveFileCollection> UploadFileAsync(string pathName, DriveFileCollection destFolder, string storageFileId, CancellationToken token)
 {
     throw new NotImplementedException();
 }
Example #7
0
 public async Task <Stream> ReadFileAsync(DriveFileCollection file, CancellationToken token)
 {
     throw new NotImplementedException();
 }
Example #8
0
 public async Task <Image> GetThumbnailAsync(DriveFileCollection file, CancellationToken token)
 {
     throw new NotImplementedException();
 }
Example #9
0
 public async Task <ICollection <DriveFileCollection> > GetSubfoldersAsync(DriveFileCollection folder, CancellationToken token)
 {
     throw new NotImplementedException();
 }
Example #10
0
 public async Task EnumerateFilesRecursive(DriveFileCollection driveFolder,
                                           Action <DriveFileCollection> action, CancellationToken token)
 {
     throw new NotImplementedException();
 }
Example #11
0
 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);
 }