72 lines
2.2 KiB
C#
72 lines
2.2 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;
|
|
using System.IO;
|
|
|
|
namespace LCU.Library.Internal.FileOperationsModels.Models
|
|
{
|
|
public class DecryptFileDataRequest : 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 = "Key source path is required")]
|
|
public string KeySourcePath { get; set; }
|
|
|
|
[Required(ErrorMessage = "Key source file is required")]
|
|
public string KeySourceFile { get; set; }
|
|
|
|
[Required(ErrorMessage = "PassPhrase is required")]
|
|
public string PassPhrase { get; set; }
|
|
|
|
[Required(ErrorMessage = "Destination path is required.")]
|
|
public string DestinationPath { get; set; }
|
|
|
|
public string DestinationFile { get; set; }
|
|
|
|
public bool Overwrite { get; set; }
|
|
|
|
public DynamicNameSetting FileNameSetting { get; set; }
|
|
|
|
[NotMapped] public string FinalSourceFile => DynamicNameBuilder.BuildDynamicName(SourceFile, FileNameSetting);
|
|
|
|
[NotMapped]
|
|
public string Source
|
|
{
|
|
get
|
|
{
|
|
var finalSourcePath = SourcePath.EndsWith("\\") ? SourcePath : $"{SourcePath}\\";
|
|
finalSourcePath = Path.Combine(finalSourcePath, FinalSourceFile);
|
|
return finalSourcePath;
|
|
}
|
|
}
|
|
|
|
[NotMapped]
|
|
public string Destination
|
|
{
|
|
get
|
|
{
|
|
var finalDestinationPath = DestinationPath.EndsWith("\\") ? DestinationPath : $"{DestinationPath}\\";
|
|
var finalDestinationFileName = string.IsNullOrWhiteSpace(DestinationFile) ? SourceFile : DestinationFile;
|
|
finalDestinationPath = Path.Combine(finalDestinationPath, Path.GetFileNameWithoutExtension(finalDestinationFileName));
|
|
return finalDestinationPath;
|
|
}
|
|
}
|
|
|
|
[NotMapped]
|
|
public string KeySource
|
|
{
|
|
get
|
|
{
|
|
var finalKeyPath = KeySourcePath.EndsWith("\\") ? KeySourcePath : $"{KeySourcePath}\\";
|
|
finalKeyPath = Path.Combine(finalKeyPath, KeySourceFile);
|
|
return finalKeyPath;
|
|
}
|
|
}
|
|
}
|
|
} |