Exemple #1
0
        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);
        }
Exemple #2
0
        /// <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);
        }
Exemple #3
0
 private void O_ProgressEvent(long arg1, long arg2, string arg3)
 {
     OnProgress(new ProgressEventhandler(CloudId.ToString(), arg3, arg1, arg2));
 }