26 lines
1.0 KiB
C#
26 lines
1.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Newtonsoft.Json;
|
|
using Serilog;
|
|
using LCU.Library.Internal.FileOperationsModels.Models;
|
|
using LCU.Library.Internal.FileOperationsModels.Shared;
|
|
using LCU.Library.Internal.Exceptions;
|
|
namespace LCU.Api.Internal.FileOperations.Services;
|
|
|
|
public class DynamicDirectoryService : IDynamicDirectoryService
|
|
{
|
|
public IEnumerable<string> BuildDirectoryList(DynamicDirectoryListRequest request)
|
|
{
|
|
try
|
|
{
|
|
var dynamicDirectoryNameWithDates = DynamicNameBuilder.BuildDynamicName(request.DynamicDirectoryName, request.DynamicFileSettings);
|
|
var directoryNameList = RegexNameHandler.BuildDirectoryList(request.Path, dynamicDirectoryNameWithDates, request.DynamicFileSettings);
|
|
return directoryNameList;
|
|
}
|
|
catch (Exception exception)
|
|
{
|
|
Log.Error(exception, $"Error while trying to build directory list. Request: {JsonConvert.SerializeObject(request)}");
|
|
throw new ServiceException(exception.Message);
|
|
}
|
|
}
|
|
} |