97 lines
2.5 KiB
C#
97 lines
2.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 UnzipFileRequest : ReturnResponse
|
|
{
|
|
[Required(ErrorMessage = "Source path is required")]
|
|
public string SourceDirectory { get; set; }
|
|
|
|
[Required(ErrorMessage = "Zip file name is required.")]
|
|
public string ZipFileName { get; set; }
|
|
|
|
[Required(ErrorMessage = "Destination path is required.")]
|
|
public string DestinationPath { get; set; }
|
|
|
|
public bool UseZipFileNameAsFinalDestination { get; set; }
|
|
public bool IgnoreFileNameSubFolderAsDestination { get; set; }
|
|
|
|
public int MaxFileDepth { get; set; } = 0;
|
|
|
|
public DynamicNameSetting FileNameSetting { get; set; }
|
|
public DynamicNameSetting SourceDirectorySetting { get; set; }
|
|
public DynamicNameSetting DestinationPathSetting { get; set; }
|
|
|
|
[NotMapped]
|
|
public string ZipFileNameWithDate
|
|
{
|
|
get
|
|
{
|
|
return DynamicNameBuilder.BuildDynamicName(ZipFileName, FileNameSetting);
|
|
}
|
|
}
|
|
|
|
[NotMapped]
|
|
public string FormattedSourceDirectoryPath
|
|
{
|
|
get
|
|
{
|
|
var sourceDirectoryWithDates = DynamicNameBuilder.BuildDynamicName(SourceDirectory, SourceDirectorySetting);
|
|
return sourceDirectoryWithDates.EndsWith("\\") ? sourceDirectoryWithDates : $"{sourceDirectoryWithDates}\\";
|
|
}
|
|
}
|
|
|
|
[NotMapped]
|
|
public string FinalZipFileName
|
|
{
|
|
get
|
|
{
|
|
return ZipFileNameWithDate.ToUpper().EndsWith(".ZIP") ? ZipFileNameWithDate : $"{ZipFileNameWithDate}.zip";
|
|
}
|
|
}
|
|
|
|
[NotMapped]
|
|
public string SourceFilePath
|
|
{
|
|
get
|
|
{
|
|
return FormattedSourceDirectoryPath + FinalZipFileName;
|
|
}
|
|
}
|
|
|
|
[NotMapped]
|
|
public string FormattedDestinationPath
|
|
{
|
|
get
|
|
{
|
|
var destinationPathDates = DynamicNameBuilder.BuildDynamicName(DestinationPath, DestinationPathSetting);
|
|
return destinationPathDates.EndsWith("\\") ? destinationPathDates : $"{destinationPathDates}\\";
|
|
}
|
|
}
|
|
|
|
[NotMapped]
|
|
public string ZipFileNameWithoutZip
|
|
{
|
|
get
|
|
{
|
|
return FinalZipFileName.ToUpper().EndsWith(".ZIP") ?
|
|
FinalZipFileName.ToUpper().Replace(".ZIP", "") :
|
|
FinalZipFileName;
|
|
}
|
|
}
|
|
|
|
[NotMapped]
|
|
public string DestinationPathZipFileNameWithoutZip
|
|
{
|
|
get
|
|
{
|
|
return $"{FormattedDestinationPath}{ZipFileNameWithoutZip}\\";
|
|
}
|
|
}
|
|
}
|
|
}
|