63 lines
1.5 KiB
C#
63 lines
1.5 KiB
C#
using LCU.Library.Internal.ApiResponse.Models;
|
|
using LCU.Library.Internal.FileOperationsModels.Models.NameSettings;
|
|
using LCU.Library.Internal.FileOperationsModels.Shared;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
namespace LCU.Library.Internal.FileOperationsModels.Models
|
|
{
|
|
public class RenameFileRequest : ReturnResponse
|
|
{
|
|
[Required(ErrorMessage = "Source path is required.")]
|
|
public string SourcePath { get; set; }
|
|
|
|
[Required(ErrorMessage = "Source file is required.")]
|
|
public string SourceFile { get; set; }
|
|
|
|
[Required(ErrorMessage = "New file name is required.")]
|
|
public string NewFilename { get; set; }
|
|
|
|
public DynamicNameSetting SourceNameSetting { get; set; }
|
|
public DynamicNameSetting NewNameSetting { get; set; }
|
|
public bool SucceedOnError { get; set; }
|
|
|
|
[NotMapped]
|
|
public string FinalSourceFile
|
|
{
|
|
get
|
|
{
|
|
return DynamicNameBuilder.BuildDynamicName(SourceFile, SourceNameSetting);
|
|
}
|
|
}
|
|
|
|
[NotMapped]
|
|
public string Source
|
|
{
|
|
get
|
|
{
|
|
var finalSourcePath = SourcePath.EndsWith("\\") ? SourcePath : $"{SourcePath}\\";
|
|
return finalSourcePath + FinalSourceFile;
|
|
}
|
|
}
|
|
|
|
[NotMapped]
|
|
public string FinalNewFileName
|
|
{
|
|
get
|
|
{
|
|
return DynamicNameBuilder.BuildDynamicName(NewFilename, NewNameSetting);
|
|
}
|
|
}
|
|
|
|
[NotMapped]
|
|
public string NewFilenamePath
|
|
{
|
|
get
|
|
{
|
|
var finalSourcePath = SourcePath.EndsWith("\\") ? SourcePath : $"{SourcePath}\\";
|
|
return finalSourcePath + FinalNewFileName;
|
|
}
|
|
}
|
|
}
|
|
}
|