public override async Task <bool> Start(FileInformation source, string target, OperaType operaType) { bool isSuccess = false; switch (operaType) { case OperaType.UpLoad: try { var o = new OneDriveFileUpload(); o.ProgressEvent += O_ProgressEvent; isSuccess = await o.UpLoadFile(Cloud.CloudToken, source, Guid.NewGuid().ToString()); } catch (Exception e) { OnException(new ExceptionEventHandler(CloudId.ToString(), "", e.ToString())); } break; case OperaType.DownLoad: try { var o = new OneDriveFileLoad(); o.ProgressEvent += O_ProgressEvent; isSuccess = await o.DownloadFile(Cloud.CloudToken, source, target, Guid.NewGuid().ToString()); } catch (Exception e) { OnException(new ExceptionEventHandler(CloudId.ToString(), "", e.ToString())); } break; } return(isSuccess); }
/// <summary> /// 搜寻文件夹 /// </summary> /// <param name="fileid"></param> /// <returns></returns> public override IList <FileInformation> Search(string fileid) { List <FileInformation> fileInfoList = new List <FileInformation>(); OneDriveFileSearch oneDriveFileSearch = new OneDriveFileSearch(); try { fileInfoList = (List <FileInformation>)oneDriveFileSearch.SearchFile(Cloud.CloudToken, fileid); } catch (Exception ex) { OnException(new ExceptionEventHandler(CloudId.ToString(), "", ex.ToString())); throw; } return(fileInfoList); }
private void O_ProgressEvent(long arg1, long arg2, string arg3) { OnProgress(new ProgressEventhandler(CloudId.ToString(), arg3, arg1, arg2)); }