/// <summary> /// Is Lock File /// </summary> /// <returns>Is Lock</returns> private bool IsLockFile(string token) { bool isLock = false; log.Info($"IsLockFile access_token: {token}"); try { IEASAPIHelper fileHelper = new EASAPIHelper(); // User info var userInfo = fileHelper.UserGetPost(token); // Lock info var lockInfo = fileHelper.AutolockGetlockinfoPost(token); // Locked & Not me if ((lockInfo.Islocked.HasValue && lockInfo.Islocked.Value) && (userInfo.Account != lockInfo.Lockeraccount)) { isLock = true; } } catch (Exception ex) { log.Info($"IsLockFile Exception: {ex.Message}"); } return(isLock); }
/// <summary> /// Upload File /// </summary> /// <param name="fileFullName">file path</param> private UploadRes UploadFile(string token, string fileFullName, bool isNew) { UploadRes uploadRes = null; try { log.Info($"UploadFile access_token: {token}, file path: {fileFullName}"); // Upload file IEASAPIHelper eASHelper = new EASAPIHelper(); uploadRes = eASHelper.FileSingleUpload(fileFullName, isNew, token); log.Info($"UploadFile End"); } catch (Exception ex) { log.Info($"UploadFile Exception: {ex.Message}"); } return(uploadRes); }
/// <summary> /// Download file by identifier. /// </summary> /// <param name="fileId">File identifier.</param> /// <returns>File</returns> private FileInfo DownLoadFile(string fileId, string token, bool isShare) { try { log.Info($"DownLoadFile file id: {fileId}, access_token: {token}"); string filePath = string.Empty; if (isShare) { // Download share file IEASLinkAPIHelper fileHelper = new EASLinkAPIHelper(); filePath = fileHelper.SingleFileDownload(_hostingEnvironment.ContentRootPath, fileId, token); } else { string rev = CommonHelper.GetDocRev(token); // Download file IEASAPIHelper fileHelper = new EASAPIHelper(); filePath = fileHelper.SingleFileDownload(_hostingEnvironment.ContentRootPath, fileId, rev, token); if (string.IsNullOrEmpty(rev)) { SetLocalPath(fileId, filePath); } } log.Info($"DownLoadFile file end."); return(new FileInfo(filePath)); } catch (Exception ex) { SetLocalPath(fileId, null); log.Info($"Download file Exception: {ex.Message}"); throw new NotImplementedException(); } }