CloudFiles.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. using Google.Apis.Auth.OAuth2;
  2. using Google.Apis.Drive.v3;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Collections.ObjectModel;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace PDF_Office.Model.CloudDrive
  10. {
  11. public class Cloud
  12. {
  13. public static ObservableCollection<UserBaseItem> CloudLists = new ObservableCollection<UserBaseItem>();
  14. public static List<CloudBoxItem> InitCloudBoxs()
  15. {
  16. List<CloudBoxItem> CloudeDrives = new List<CloudBoxItem>();
  17. var cloudDriveItem = new CloudBoxItem(CloudType.Box);
  18. CloudeDrives.Add(cloudDriveItem);
  19. cloudDriveItem = new CloudBoxItem(CloudType.DropBox);
  20. CloudeDrives.Add(cloudDriveItem);
  21. cloudDriveItem = new CloudBoxItem(CloudType.GoogleDrive);
  22. CloudeDrives.Add(cloudDriveItem);
  23. cloudDriveItem = new CloudBoxItem(CloudType.OneDrive);
  24. CloudeDrives.Add(cloudDriveItem);
  25. return CloudeDrives;
  26. }
  27. }
  28. #region 云盘基类
  29. /// <summary>
  30. /// 用户信息
  31. /// </summary>
  32. public class UserInfo
  33. {
  34. public string Name { get; set; }
  35. public int Id { get; set; }
  36. public string UserAccount { get; set; }
  37. }
  38. public class FolderBaseItem
  39. {
  40. public FileOperation Operation { get; set; }
  41. public int Level { get; set; }
  42. public string FolderName { get; set; }
  43. }
  44. /// <summary>
  45. /// 用户云盘
  46. /// </summary>
  47. public class UserBaseItem
  48. {
  49. public UserInfo userInfo { get; set; }
  50. public CloudType cloudType { get; set; }
  51. }
  52. public class FilesBaseItem
  53. {
  54. public string Id { get; set; }
  55. public bool IsFolder { get; set; }
  56. public int Level { get; set; }
  57. public string Name { get; set; }
  58. public string MimeType { get; set; }
  59. public long? Size { get; set; }
  60. public DateTime? CreatedTime { get; set; }
  61. }
  62. #endregion
  63. #region GooglrDrive
  64. //文件夹
  65. public class GoogleDriveFolder: FolderBaseItem
  66. {
  67. }
  68. /// <summary>
  69. /// 谷歌云盘的文件
  70. /// </summary>
  71. public class GoogleDriveFiles: FilesBaseItem
  72. {
  73. public long? Version { get; set; }
  74. }
  75. #endregion
  76. #region DropbBox
  77. /// <summary>
  78. /// 谷歌云盘的文件
  79. /// </summary>
  80. public class DropbBoxFiles : FilesBaseItem
  81. {
  82. public string PathDisplay { get; set; }
  83. }
  84. public class DropbBoxFolder : FolderBaseItem
  85. {
  86. }
  87. /// <summary>
  88. /// 指定某云盘某用户,对文件的操作
  89. /// </summary>
  90. public class FileOperation
  91. {
  92. public string SourceFileName { get; set; }
  93. public string SourceFile { get; set; }
  94. public UserBaseItem User { get; set; }
  95. public FilesBaseItem DoFile { get; set; }
  96. public FileOperation(UserBaseItem user, FilesBaseItem doFile)
  97. {
  98. User = user;
  99. DoFile = doFile;
  100. }
  101. }
  102. #endregion
  103. }