消除部分warning

This commit is contained in:
2023-05-16 15:21:04 +08:00
parent e7e2cea7bd
commit 67d599dce6
17 changed files with 396 additions and 54 deletions

View File

@@ -505,6 +505,7 @@ public class FileHelper
#endregion
#pragma warning disable CA1416 // 验证平台兼容性
#region
/// <summary>
@@ -669,6 +670,7 @@ public class FileHelper
}
#endregion
#pragma warning restore CA1416 // 验证平台兼容性
#region
@@ -712,7 +714,8 @@ public class FileHelper
if (selectFiles.Count > 0)
{
return selectFiles.FirstOrDefault().FullName;
//modified by PhilPan
return selectFiles.First().FullName;
}
return Path.Combine(folderPath, $@"{prefix}_{DateTime.Now.ParseToUnixTime()}.log");
@@ -737,7 +740,7 @@ public class FileHelper
Microsoft.AspNetCore.Http.HttpContext? httpContext = App.HttpContext;
httpContext.Response.ContentType = "application/octet-stream";
httpContext.Response.Headers.Add("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(fileName, Encoding.UTF8));
httpContext.Response.Headers.Add("Content-Length", buff.Length.ToString());
httpContext.Response.Headers.Add("Content-Length", buff?.Length.ToString());
httpContext.Response.Body.WriteAsync(buff);
httpContext.Response.Body.Flush();
httpContext.Response.Body.Close();