fly 8 月之前
父节点
当前提交
136b8afa93
共有 1 个文件被更改,包括 13 次插入6 次删除
  1. 13 6
      Interfaces/FileTransfer/FileTransferService.cs

+ 13 - 6
Interfaces/FileTransfer/FileTransferService.cs

@@ -49,7 +49,7 @@ namespace WingServerCommon.Interfaces.FileTransfer
         /// <param name="oriFileName">FileName</param>
         /// <param name="fileSize">文件大小</param>
         /// <returns>是否存在</returns>
-        public async Task<bool> CheckFileIsExist(string oriFileName, long fileSize, bool isNeedPartUpload = true, bool isUpgradePackage = false)
+        public async Task<bool> CheckFileIsExist(string oriFileName, long fileSize = 104857600, bool isNeedPartUpload = true, bool isUpgradePackage = false)
         {
             bool result = true;
             if (!isNeedPartUpload)
@@ -193,13 +193,13 @@ namespace WingServerCommon.Interfaces.FileTransfer
         }
 
         /// <summary>
-        /// 分块传输上传文件 
+        /// 分块传输上传文件
         /// </summary>
         /// <param name="sourceFilePath">源文件地址 </param>
         /// <param name="isRechristen">Rename</param>
         /// <param name="isCopy">is Copy to OtherNode</param>
         /// <returns>FileUrl List</returns>
-        public async Task<List<string>> FileTransferAsync(string sourceFilePath, bool isRechristen = true, bool isNeedPartUpload = true, bool isCopy = false)
+        public async Task<List<string>> FileTransferAsync(string sourceFilePath, bool isRechristen = true, bool isNeedPartUpload = true, bool isCopy = false, string newFileName = "")
         {
             var returnFileUrlList = new List<string>();
             FileTransferRecorder record = new FileTransferRecorder();
@@ -207,7 +207,7 @@ namespace WingServerCommon.Interfaces.FileTransfer
             {
                 if (string.IsNullOrEmpty(sourceFilePath) || !File.Exists(sourceFilePath)) 
                 {
-                    Logger.WriteLineWarn("File Absolute Path Error!");
+                    Logger.WriteLineWarn("File Absolute Path Error! ");
                     return new List<string>();
                 }
                 //读取缓存文件, 如果存在就是需要断点upload
@@ -226,7 +226,14 @@ namespace WingServerCommon.Interfaces.FileTransfer
                 }
                 if (isRechristen) 
                 { 
-                    factName = Guid.NewGuid().ToString("N").ToUpper();
+                    if (!string.IsNullOrEmpty(newFileName))
+                    {
+                        factName = newFileName;
+                    }
+                    else 
+                    {
+                        factName = Guid.NewGuid().ToString("N").ToUpper();
+                    }
                 }
                 if (_manualDivisionForUpload <= 0) 
                 {
@@ -568,7 +575,7 @@ namespace WingServerCommon.Interfaces.FileTransfer
             }
             catch (Exception ex) 
             {
-                Logger.WriteLineError($"Download And Save File fail, {ex}");
+                Logger.WriteLineError($"Download And Save File fail, error: {ex}");
                 return string.Empty;
             }
             finally