Save all files to wwwroot

This commit is contained in:
2025-11-20 15:44:31 +09:00
parent 34c9a44b03
commit ee80c1a40b
4 changed files with 23 additions and 9 deletions

View File

@ -12,7 +12,8 @@ namespace Hcs.WebApp.BackgroundServices
public class ResultGetService(
ResultGetState state,
ResultGetterFactory resultGetterFactory,
IServiceScopeFactory scopeFactory) : BackgroundService
IServiceScopeFactory scopeFactory,
IWebHostEnvironment webHostEnvironment) : BackgroundService
{
private class GetState
{
@ -23,10 +24,12 @@ namespace Hcs.WebApp.BackgroundServices
private const int ITERATION_TIME = 10000;
private const int SLEEP_TIME = 30000;
private const string INCOMING_DIR_NAME = "incoming";
private readonly ResultGetState state = state;
private readonly ResultGetterFactory resultGetterFactory = resultGetterFactory;
private readonly IServiceScopeFactory scopeFactory = scopeFactory;
private readonly IWebHostEnvironment webHostEnvironment = webHostEnvironment;
private readonly List<(Operation operation, GetState state)> entries = [];
private Broker.Logger.ILogger logger;
@ -130,7 +133,7 @@ namespace Hcs.WebApp.BackgroundServices
private void InitializeClient()
{
logger = new ActionLogger();
messageCapturer = new FileMessageCapturer("incoming", logger);
messageCapturer = new FileMessageCapturer(Path.Combine(webHostEnvironment.WebRootPath, INCOMING_DIR_NAME), logger);
using var scope = scopeFactory.CreateScope();
var configuration = scope.ServiceProvider.GetRequiredService<IConfiguration>();