|
@@ -60,7 +60,7 @@ namespace PDF_Master.ViewModels.HomePanel.CloudDrive.CloudDriveType
|
|
/// 获取帐号
|
|
/// 获取帐号
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <returns>返回用户帐号地址</returns>
|
|
/// <returns>返回用户帐号地址</returns>
|
|
- private async Task<UserInfo> GetUserAcount()
|
|
|
|
|
|
+ private UserInfo GetUserAcount()
|
|
{
|
|
{
|
|
UserInfo userInfo = null;
|
|
UserInfo userInfo = null;
|
|
if (Service != null)
|
|
if (Service != null)
|
|
@@ -81,9 +81,9 @@ namespace PDF_Master.ViewModels.HomePanel.CloudDrive.CloudDriveType
|
|
/// 获取帐号
|
|
/// 获取帐号
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <returns>返回用户帐号地址</returns>
|
|
/// <returns>返回用户帐号地址</returns>
|
|
- public async Task<UserInfo> GetUserAcountAsync()
|
|
|
|
|
|
+ public UserInfo GetUserAcountAsync()
|
|
{
|
|
{
|
|
- return await GetUserAcount();
|
|
|
|
|
|
+ return GetUserAcount();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -97,7 +97,7 @@ namespace PDF_Master.ViewModels.HomePanel.CloudDrive.CloudDriveType
|
|
/// <param name="service"></param>
|
|
/// <param name="service"></param>
|
|
/// <param name="parentFilesId">文件夹ID:file.Id</param>
|
|
/// <param name="parentFilesId">文件夹ID:file.Id</param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- public async Task<List<GoogleDriveFiles>> GetDriveFiles(DriveService service = null, string parentFilesId = null)
|
|
|
|
|
|
+ public List<GoogleDriveFiles> GetDriveFiles(DriveService service = null, string parentFilesId = null)
|
|
{
|
|
{
|
|
if (service == null)
|
|
if (service == null)
|
|
return null;
|
|
return null;
|
|
@@ -174,7 +174,7 @@ namespace PDF_Master.ViewModels.HomePanel.CloudDrive.CloudDriveType
|
|
/// 上传文件
|
|
/// 上传文件
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <param name="filepath">本地文件路径</param>
|
|
/// <param name="filepath">本地文件路径</param>
|
|
- public async Task<bool> FileUpload(string filepath,string desFolderId)
|
|
|
|
|
|
+ public bool FileUpload(string filepath,string desFolderId)
|
|
{
|
|
{
|
|
if (Service == null)
|
|
if (Service == null)
|
|
return false;
|
|
return false;
|
|
@@ -217,7 +217,7 @@ namespace PDF_Master.ViewModels.HomePanel.CloudDrive.CloudDriveType
|
|
/// <param name="savePath"></param>
|
|
/// <param name="savePath"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
//
|
|
//
|
|
- public async Task<string> DownloadGoogleFile(GoogleDriveFiles googleDriveFiles, string savePath)
|
|
|
|
|
|
+ public string DownloadGoogleFile(GoogleDriveFiles googleDriveFiles, string savePath)
|
|
{
|
|
{
|
|
if (Service == null)
|
|
if (Service == null)
|
|
return "";
|
|
return "";
|
|
@@ -297,7 +297,6 @@ namespace PDF_Master.ViewModels.HomePanel.CloudDrive.CloudDriveType
|
|
/// 异步获取Google服务的包信息,避免UI线程卡死
|
|
/// 异步获取Google服务的包信息,避免UI线程卡死
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <param name="userInfoFile"></param>
|
|
/// <param name="userInfoFile"></param>
|
|
- [Obsolete]
|
|
|
|
public static async Task<Tuple<DriveService, UserCredential>> GetServiceAsync(string userInfoFile = "")
|
|
public static async Task<Tuple<DriveService, UserCredential>> GetServiceAsync(string userInfoFile = "")
|
|
{
|
|
{
|
|
Tuple<DriveService, UserCredential> tuple = null;
|
|
Tuple<DriveService, UserCredential> tuple = null;
|
|
@@ -313,7 +312,6 @@ namespace PDF_Master.ViewModels.HomePanel.CloudDrive.CloudDriveType
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <param name="FilePath">登录过的用户文件;若为空,则为新用户登录</param>
|
|
/// <param name="FilePath">登录过的用户文件;若为空,则为新用户登录</param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- [Obsolete]
|
|
|
|
public static Tuple<DriveService, UserCredential> GetService(string FilePath = "")
|
|
public static Tuple<DriveService, UserCredential> GetService(string FilePath = "")
|
|
{
|
|
{
|
|
Tuple<DriveService, UserCredential> tuple = null;
|
|
Tuple<DriveService, UserCredential> tuple = null;
|
|
@@ -330,7 +328,7 @@ namespace PDF_Master.ViewModels.HomePanel.CloudDrive.CloudDriveType
|
|
using (var stream = new FileStream(CredentialsPath, FileMode.Open, FileAccess.Read))
|
|
using (var stream = new FileStream(CredentialsPath, FileMode.Open, FileAccess.Read))
|
|
{
|
|
{
|
|
credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
|
|
credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
|
|
- GoogleClientSecrets.Load(stream).Secrets,
|
|
|
|
|
|
+ GoogleClientSecrets.FromStream(stream).Secrets,
|
|
Scopes,
|
|
Scopes,
|
|
"user",
|
|
"user",
|
|
CancellationToken.None,
|
|
CancellationToken.None,
|
|
@@ -346,7 +344,7 @@ namespace PDF_Master.ViewModels.HomePanel.CloudDrive.CloudDriveType
|
|
return tuple = new Tuple<DriveService, UserCredential>(service, credential);
|
|
return tuple = new Tuple<DriveService, UserCredential>(service, credential);
|
|
|
|
|
|
}
|
|
}
|
|
- catch (Exception e)
|
|
|
|
|
|
+ catch (Exception)
|
|
{
|
|
{
|
|
//网络连接失败的情况
|
|
//网络连接失败的情况
|
|
return null;
|
|
return null;
|
|
@@ -359,6 +357,7 @@ namespace PDF_Master.ViewModels.HomePanel.CloudDrive.CloudDriveType
|
|
/// 获取登录过的账号
|
|
/// 获取登录过的账号
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <returns>历史账号</returns>
|
|
/// <returns>历史账号</returns>
|
|
|
|
+ [Obsolete]
|
|
public static async Task<List<Tuple<DriveService, UserCredential>>> GetHistoryService()
|
|
public static async Task<List<Tuple<DriveService, UserCredential>>> GetHistoryService()
|
|
{
|
|
{
|
|
DirectoryInfo TheFolder = new DirectoryInfo(FilesPathTemp);
|
|
DirectoryInfo TheFolder = new DirectoryInfo(FilesPathTemp);
|