Merge branch 'master' of http://192.168.1.2:8033/IRaCIS_Core_Api
commit
74c3b2c180
|
@ -49,7 +49,7 @@ namespace IRaCIS.Core.API
|
||||||
|
|
||||||
var isDicomFile = path.Contains($"{StaticData.Folder.DicomFolder}");
|
var isDicomFile = path.Contains($"{StaticData.Folder.DicomFolder}");
|
||||||
|
|
||||||
var defaultFileProvider = new PhysicalFileProvider(iRaCISDefaultDataFolder);
|
var defaultFileProvider = new PhysicalFileProvider(FileStoreHelper.GetIRaCISRootPath(_hostingEnv));
|
||||||
var staticFileOptions = new StaticFileOptions
|
var staticFileOptions = new StaticFileOptions
|
||||||
{
|
{
|
||||||
FileProvider = defaultFileProvider,
|
FileProvider = defaultFileProvider,
|
||||||
|
@ -65,12 +65,11 @@ namespace IRaCIS.Core.API
|
||||||
{
|
{
|
||||||
if (defaultFileProvider.GetFileInfo(context.Request.Path).Exists)
|
if (defaultFileProvider.GetFileInfo(context.Request.Path).Exists)
|
||||||
{
|
{
|
||||||
//var staticFileMiddleware = new StaticFileMiddleware(_next, _hostingEnv, Options.Create(staticFileOptions), _loggerFactory);
|
|
||||||
//await staticFileMiddleware.Invoke(context);
|
|
||||||
|
|
||||||
var actrualPath = defaultFileProvider.GetFileInfo(context.Request.Path).PhysicalPath;
|
var actrualPath = defaultFileProvider.GetFileInfo(context.Request.Path).PhysicalPath;
|
||||||
|
|
||||||
await context.Response.SendFileAsync(new PhysicalFileInfo(new FileInfo(actrualPath)));
|
await context.Response.SendFileAsync(new PhysicalFileInfo(new FileInfo(actrualPath)));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,30 +147,36 @@ namespace IRaCIS.Core.Application.Services
|
||||||
|
|
||||||
#region 切换磁盘存储后
|
#region 切换磁盘存储后
|
||||||
|
|
||||||
var physicalPath = string.Empty;
|
var physicalPath = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, path);
|
||||||
|
|
||||||
//找到所有磁盘
|
//不存在,去其他路径找
|
||||||
var drives = DriveInfo.GetDrives()
|
if (!File.Exists(physicalPath))
|
||||||
.Where(d => d.DriveType == DriveType.Fixed && d.IsReady)
|
|
||||||
//剩余空间最多的
|
|
||||||
.OrderByDescending(d => d.AvailableFreeSpace)
|
|
||||||
|
|
||||||
//存储空间相同,则按照按照总空间从大到小排序
|
|
||||||
.ThenByDescending(d => d.TotalSize - d.TotalFreeSpace)
|
|
||||||
.Select(d => d.RootDirectory.FullName)
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
|
|
||||||
foreach (var drive in drives)
|
|
||||||
{
|
{
|
||||||
physicalPath = Path.Combine(drive, _hostEnvironment.EnvironmentName, path.Trim('/'));
|
//找到所有磁盘
|
||||||
|
var drives = DriveInfo.GetDrives()
|
||||||
|
.Where(d => d.DriveType == DriveType.Fixed && d.IsReady)
|
||||||
|
//剩余空间最多的
|
||||||
|
.OrderByDescending(d => d.AvailableFreeSpace)
|
||||||
|
|
||||||
if(File.Exists(physicalPath))
|
//存储空间相同,则按照按照总空间从大到小排序
|
||||||
|
.ThenByDescending(d => d.TotalSize - d.TotalFreeSpace)
|
||||||
|
.Select(d => d.RootDirectory.FullName)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
|
||||||
|
foreach (var drive in drives)
|
||||||
{
|
{
|
||||||
break;
|
physicalPath = Path.Combine(drive, _hostEnvironment.EnvironmentName, path.Trim('/'));
|
||||||
|
|
||||||
|
if (File.Exists(physicalPath))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue