35 lines
1.2 KiB
C#
35 lines
1.2 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.IO;
|
|
using LCU.Library.Internal.FileOperationsModels.Models.NameSettings;
|
|
using LCU.Library.Internal.FileOperationsModels.Shared;
|
|
|
|
namespace LCU.Library.Internal.FileOperationsModels.Models.Requests;
|
|
|
|
public class FileSourceRequest
|
|
{
|
|
[Required(ErrorMessage = "Source path is required")]
|
|
public string SourcePath { get; set; } = string.Empty;
|
|
public DynamicNameSetting SourcePathSettings { get; set; } = new();
|
|
|
|
[Required(ErrorMessage = "Source file is required")]
|
|
public string SourceFile { get; set; } = string.Empty;
|
|
|
|
public DynamicNameSetting SourceFileSettings { get; set; } = new();
|
|
|
|
[NotMapped]
|
|
public string FinalSourceFile => DynamicNameBuilder.BuildDynamicName(SourceFile, SourceFileSettings);
|
|
|
|
[NotMapped]
|
|
public string FinalSourcePath
|
|
{
|
|
get
|
|
{
|
|
var sourcePath = SourcePath.EndsWith("\\") ? SourcePath : $"{SourcePath}\\";
|
|
return DynamicNameBuilder.BuildDynamicName(sourcePath, SourcePathSettings);
|
|
}
|
|
}
|
|
|
|
[NotMapped]
|
|
public string Source => Path.Combine(FinalSourcePath, FinalSourceFile);
|
|
} |