From b991e9950f00c93ec271dc3f9c875910e9650146 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 16 May 2023 17:09:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=A9=E7=95=A5=E5=9B=BE?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/ImageAndDoc/SeriesService.cs | 40 +++++++++++-------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/SeriesService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/SeriesService.cs index 4fe42154f..8dab5e9b9 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/SeriesService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/SeriesService.cs @@ -147,30 +147,36 @@ namespace IRaCIS.Core.Application.Services #region 切换磁盘存储后 - var physicalPath = string.Empty; + var physicalPath = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, path); - //找到所有磁盘 - var drives = DriveInfo.GetDrives() - .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) + //不存在,去其他路径找 + if (!File.Exists(physicalPath)) { - 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