45 lines
1.3 KiB
C#
45 lines
1.3 KiB
C#
using IRaCIS.Core.Domain.Share;
|
|
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.Extensions.FileProviders;
|
|
using System.IO;
|
|
|
|
namespace IRaCIS.Core.API
|
|
{
|
|
public static class IRacisHostFileStore
|
|
{
|
|
|
|
public static void UseIRacisHostStaticFileStore(this IApplicationBuilder app, IWebHostEnvironment env)
|
|
{
|
|
|
|
var uploadPath = Path.Combine(Directory.GetParent(env.ContentRootPath.TrimEnd('\\')).FullName, StaticData.UploadFileFolder);
|
|
var dicomPath = Path.Combine(Directory.GetParent(env.ContentRootPath.TrimEnd('\\')).FullName, StaticData.TrialDataFolder);
|
|
|
|
|
|
if (!Directory.Exists(uploadPath))
|
|
{
|
|
Directory.CreateDirectory(uploadPath);
|
|
}
|
|
|
|
if (!Directory.Exists(dicomPath))
|
|
{
|
|
Directory.CreateDirectory(dicomPath);
|
|
}
|
|
|
|
app.UseStaticFiles(new StaticFileOptions
|
|
{
|
|
FileProvider = new PhysicalFileProvider(uploadPath),
|
|
RequestPath = $"/{StaticData.UploadFileFolder}"
|
|
});
|
|
|
|
|
|
app.UseStaticFiles(new StaticFileOptions
|
|
{
|
|
FileProvider = new PhysicalFileProvider(dicomPath),
|
|
RequestPath = $"/{StaticData.TrialDataFolder}"
|
|
});
|
|
|
|
}
|
|
}
|
|
}
|