77 lines
2.2 KiB
C#
77 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;
|
|
|
|
namespace LCU.Library.Internal.FileOperationsModels.Models
|
|
{
|
|
public class UnzipPasswordProtectedFileRequest : ReturnResponse
|
|
{
|
|
[Required(ErrorMessage = "Source path is required")]
|
|
public string SourceDirectory { get; set; }
|
|
|
|
[Required(ErrorMessage = "Password protected zip file name is required")]
|
|
public string PasswordProtectedZipFileName { get; set; }
|
|
|
|
[Required(ErrorMessage = "Password is required")]
|
|
public string Password { get; set; }
|
|
|
|
[Required(ErrorMessage = "Destination path is required")]
|
|
public string DestinationPath { get; set; }
|
|
|
|
public bool UseZipFileNameAsFinalDestination { get; set; }
|
|
|
|
public DynamicNameSetting FileNameSetting { get; set; }
|
|
public DynamicNameSetting SourceDirectorySetting { get; set; }
|
|
public DynamicNameSetting DestinationPathSetting { get; set; }
|
|
|
|
[NotMapped]
|
|
public string PasswordProtectedZipFileNameWithDate
|
|
{
|
|
get
|
|
{
|
|
return DynamicNameBuilder.BuildDynamicName(PasswordProtectedZipFileName, FileNameSetting);
|
|
}
|
|
}
|
|
|
|
[NotMapped]
|
|
public string FormattedSourceDirectoryPath
|
|
{
|
|
get
|
|
{
|
|
var sourceDirectoryWithDates = DynamicNameBuilder.BuildDynamicName(SourceDirectory, SourceDirectorySetting);
|
|
return sourceDirectoryWithDates.EndsWith("\\") ? sourceDirectoryWithDates : $"{sourceDirectoryWithDates}\\";
|
|
}
|
|
}
|
|
|
|
[NotMapped]
|
|
public string FinalPasswordProtectedZipFileName
|
|
{
|
|
get
|
|
{
|
|
return PasswordProtectedZipFileNameWithDate.ToUpper().EndsWith(".ZIP") ? PasswordProtectedZipFileNameWithDate : $"{PasswordProtectedZipFileNameWithDate}.zip";
|
|
}
|
|
}
|
|
|
|
[NotMapped]
|
|
public string SourceFilePath
|
|
{
|
|
get
|
|
{
|
|
return FormattedSourceDirectoryPath + FinalPasswordProtectedZipFileName;
|
|
}
|
|
}
|
|
|
|
[NotMapped]
|
|
public string FormattedDestinationPath
|
|
{
|
|
get
|
|
{
|
|
var destinationPath = DynamicNameBuilder.BuildDynamicName(DestinationPath, DestinationPathSetting);
|
|
return destinationPath.EndsWith("\\") ? destinationPath : $"{destinationPath}\\"; ;
|
|
}
|
|
}
|
|
}
|
|
}
|