Ejemplo n.º 1
0
 public MockDriveFile(Drive drive,
     string name,
     bool isFolder = false,
     bool isImage = false,
     bool isRoot = false,
     string mimeType = "",
     int imageHeight = 0,
     int imageWidth = 0,
     int originalImageHeight = 0,
     int originalImageWidth = 0,
     long originalSize = 0,
     DateTime createdDate = new DateTime(),
     DateTime modifiedDate = new DateTime()
     ) : base(drive)
 {
     Id = name;
     Name = name;
     IsFolder = isFolder;
     IsImage = isImage;
     IsRoot = isRoot;
     MimeType = mimeType;
     CreatedDate = createdDate;
     ModifiedDate = modifiedDate;
     ImageHeight = imageHeight;
     ImageWidth = imageWidth;
     OriginalImageHeight = originalImageHeight;
     OriginalImageWidth = originalImageWidth;
     OriginalSize = originalSize;
 }
Ejemplo n.º 2
0
 public DriveFile GetDriveFile(Drive drive)
 {
     return(GetDriveFile(drive.Id));
     // return DriveFiles.FirstOrDefault(file => file.Drive == drive);
 }
Ejemplo n.º 3
0
 public DriveFile GetDriveFile(Drive drive)
 {
     return GetDriveFile(drive.Id);
     // return DriveFiles.FirstOrDefault(file => file.Drive == drive);
 }
Ejemplo n.º 4
0
 public async Task<DriveFile> GetFileAndCreateIfFolderIsNotExistsAsync(Drive drive, CancellationToken token)
 {
     var stack = new Stack<AccountFile>();
     var curr = this;
     var driveFile = curr.DriveFiles.SingleOrDefault(file => file.Drive == drive);
     while (driveFile == null)
     {
         stack.Push(curr);
         if (curr.Parent == null)
         {
             break;
         }
         curr = curr.Parent;
         driveFile = curr.DriveFiles.SingleOrDefault(file => file.Drive == drive);
     }
     while (stack.Count > 0)
     {
         var f = stack.Pop();
         var dirs = await drive.GetSubfoldersAsync(driveFile, token);
         var dir = dirs.FirstOrDefault(x => x.Name == f.Name);
         if (dir == null)
         {
             driveFile = await drive.CreateFolderAsync(f.Name, driveFile, token);
         }
         else
         {
             driveFile = dir;
         }
         f.DriveFiles.Add(driveFile);
     }
     return driveFile;
 }
Ejemplo n.º 5
0
 protected DriveFile(Drive drive)
 {
     this.Drive = drive;
 }
Ejemplo n.º 6
0
 protected DriveFile(Drive drive)
 {
     this.Drive = drive;
 }