切换存储

This commit is contained in:
2023-05-16 16:31:25 +08:00
parent ff3b0db3ea
commit 5210684c50
6 changed files with 114 additions and 31 deletions
@@ -17,6 +17,7 @@ using System.Text.Encodings.Web;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using IRaCIS.Core.Infrastructure;
using IRaCIS.Core.Application.Helper;
namespace IRaCIS.Core.Application.Service.Common
{
@@ -45,9 +46,6 @@ namespace IRaCIS.Core.Application.Service.Common
}
public string GetBestStoreDisk()
{
@@ -69,7 +67,7 @@ namespace IRaCIS.Core.Application.Service.Common
}
//默认存储的路径
var defaultStoreRootFolder = Path.Combine((Directory.GetParent(_hostEnvironment.ContentRootPath.TrimEnd('\\'))).IfNullThrowException().FullName, StaticData.Folder.IRaCISDataFolder);
var defaultStoreRootFolder = FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment);
DriveInfo defaultDrive = new DriveInfo(Path.GetPathRoot(defaultStoreRootFolder));
@@ -96,14 +94,13 @@ namespace IRaCIS.Core.Application.Service.Common
}
//找到最优驱动器
DriveInfo drive = new DriveInfo(Path.GetPathRoot(bestStoreRootFolder));
////找到最优驱动器
//DriveInfo drive = new DriveInfo(Path.GetPathRoot(bestStoreRootFolder));
//最优盘符使用率超过百分之80
if (((double)(drive.TotalSize - drive.TotalFreeSpace) / drive.TotalSize) * 100 > switchingRatio)
{
}
////最优盘符使用率超过百分之80
//if (((double)(drive.TotalSize - drive.TotalFreeSpace) / drive.TotalSize) * 100 > switchingRatio)
//{
//}
if (!Directory.Exists(bestStoreRootFolder))
{
@@ -113,6 +110,9 @@ namespace IRaCIS.Core.Application.Service.Common
return bestStoreRootFolder;
}
public class GeneralRule
{
public string Endpoint { get; set; }