Uat_Study
he 2023-05-18 09:49:09 +08:00
commit ceb1337cde
2 changed files with 34 additions and 26 deletions

View File

@ -49,20 +49,21 @@ namespace IRaCIS.Core.API
var isDicomFile = path.Contains($"{StaticData.Folder.DicomFolder}"); var isDicomFile = path.Contains($"{StaticData.Folder.DicomFolder}");
var defaultFileProvider = new PhysicalFileProvider(FileStoreHelper.GetIRaCISRootPath(_hostingEnv));
var staticFileOptions = new StaticFileOptions
{
FileProvider = defaultFileProvider,
RequestPath = $"/{StaticData.Folder.IRaCISDataFolder}",
ServeUnknownFileTypes = true,
DefaultContentType = "application/octet-stream"
};
var defaultRoot = Path.GetPathRoot(iRaCISDefaultDataFolder);
//先从默认里面去找 //先从默认里面去找
if (isIRacisFile) if (isIRacisFile)
{ {
var defaultFileProvider = new PhysicalFileProvider(FileStoreHelper.GetIRaCISRootPath(_hostingEnv));
var staticFileOptions = new StaticFileOptions
{
FileProvider = defaultFileProvider,
RequestPath = $"/{StaticData.Folder.IRaCISDataFolder}",
ServeUnknownFileTypes = true,
DefaultContentType = "application/octet-stream"
};
if (defaultFileProvider.GetFileInfo(context.Request.Path).Exists) if (defaultFileProvider.GetFileInfo(context.Request.Path).Exists)
{ {
@ -78,7 +79,14 @@ namespace IRaCIS.Core.API
//dicom影像从多个文件夹尝试因为会存在切换磁盘 //dicom影像从多个文件夹尝试因为会存在切换磁盘
if (isDicomFile) if (isDicomFile)
{ {
var disks = GetDisks().Where(t=>!t.Contains(defaultRoot)); var defaultRoot = Path.GetPathRoot(iRaCISDefaultDataFolder);
//除默认部署路径的其他路径
var disks = DriveInfo.GetDrives()
.Where(d => d.IsReady && d.DriveType == DriveType.Fixed)/*.Where(t => !t.Name.Contains("C") && !t.Name.Contains("c"))*/
.OrderBy(d => d.AvailableFreeSpace)
.Select(d => d.RootDirectory.FullName)
.ToArray().Where(t=>!t.Contains(defaultRoot));
foreach (var item in disks) foreach (var item in disks)
@ -92,13 +100,7 @@ namespace IRaCIS.Core.API
var otherFileProvider= new PhysicalFileProvider(otherFileStoreFolder); var otherFileProvider= new PhysicalFileProvider(otherFileStoreFolder);
var otherStaticFileOptions = new StaticFileOptions
{
FileProvider = otherFileProvider,
RequestPath = $"/{StaticData.Folder.IRaCISDataFolder}",
ServeUnknownFileTypes = true,
DefaultContentType = "application/octet-stream"
};
if (otherFileProvider.GetFileInfo(context.Request.Path).Exists) if (otherFileProvider.GetFileInfo(context.Request.Path).Exists)
{ {
@ -108,9 +110,20 @@ namespace IRaCIS.Core.API
//方式一 //方式一
await context.Response.SendFileAsync( new PhysicalFileInfo(new FileInfo(actrualPath))); await context.Response.SendFileAsync( new PhysicalFileInfo(new FileInfo(actrualPath)));
//方式二 #region 方式二 报错 otherFileProvider 应该还包含/{StaticData.Folder.IRaCISDataFolder} 这一层级
//var otherStaticFileOptions = new StaticFileOptions
//{
// FileProvider = otherFileProvider,
// RequestPath = $"/{StaticData.Folder.IRaCISDataFolder}",
// ServeUnknownFileTypes = true,
// DefaultContentType = "application/octet-stream"
//};
//var staticFileMiddleware = new StaticFileMiddleware(_next, _hostingEnv, Options.Create(otherStaticFileOptions), _loggerFactory); //var staticFileMiddleware = new StaticFileMiddleware(_next, _hostingEnv, Options.Create(otherStaticFileOptions), _loggerFactory);
//await staticFileMiddleware.Invoke(context); //await staticFileMiddleware.Invoke(context);
#endregion
return; return;
} }
} }
@ -123,14 +136,7 @@ namespace IRaCIS.Core.API
private string[] GetDisks()
{
// 获取系统中所有可用的磁盘
return DriveInfo.GetDrives()
.Where(d => d.IsReady && d.DriveType == DriveType.Fixed).Where(t => !t.Name.Contains("C") && !t.Name.Contains("c"))
.Select(d => d.RootDirectory.FullName)
.ToArray();
}
//private static string GetContentType(string path) //private static string GetContentType(string path)

View File

@ -40,6 +40,8 @@
//存放在instance 上面 //存放在instance 上面
public string WindowCenter { get; set; } = string.Empty; public string WindowCenter { get; set; } = string.Empty;
public string WindowWidth { get; set; } = string.Empty; public string WindowWidth { get; set; } = string.Empty;
public string IamgeResizePath { get; set; }
} }
public class DicomSeriesWithLabelDTO : DicomSeriesDTO public class DicomSeriesWithLabelDTO : DicomSeriesDTO