Updating
This commit is contained in:
+40
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text;
|
||||
using LCU.Library.Internal.ApiResponse.Models;
|
||||
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models
|
||||
{
|
||||
public class AppendFileRequest : ReturnResponse
|
||||
{
|
||||
[Required(ErrorMessage = "Destination path is required.")]
|
||||
public string DestinationPath { get; set; }
|
||||
[Required(ErrorMessage = "FileName is required.")]
|
||||
public string FileName { get; set; }
|
||||
[Required(ErrorMessage = "Extension is required.")]
|
||||
public string Extension { get; set; }
|
||||
[Required(ErrorMessage = "FileData is required.")]
|
||||
public string FileData { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string FullFilePath
|
||||
{
|
||||
get
|
||||
{
|
||||
return DestinationPath.EndsWith("\\") ? $"{DestinationPath}{FileNameWithExtension}" : $"{DestinationPath}\\{FileNameWithExtension}";
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public string FileNameWithExtension
|
||||
{
|
||||
get
|
||||
{
|
||||
return Extension.StartsWith(".") ? $"{FileName}{Extension}" : $"{FileName}.{Extension}";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using LCU.Library.Internal.ApiResponse.Models;
|
||||
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models
|
||||
{
|
||||
public class BatchParsePdfRequest : ReturnResponse
|
||||
{
|
||||
private string rootPath;
|
||||
|
||||
[Required(AllowEmptyStrings = false)]
|
||||
public string RootPath
|
||||
{
|
||||
get
|
||||
{
|
||||
return rootPath;
|
||||
}
|
||||
set
|
||||
{
|
||||
rootPath = string.IsNullOrWhiteSpace(value) || value.EndsWith("\\") ? value : $"{value}\\";
|
||||
}
|
||||
}
|
||||
|
||||
[Required(AllowEmptyStrings = false)]
|
||||
public string PdfName { get; set; }
|
||||
|
||||
public List<BatchPdf> BatchPdfs { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string FullPdfPath
|
||||
{
|
||||
get
|
||||
{
|
||||
return RootPath + PdfName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class BatchPdf
|
||||
{
|
||||
private string parsedPdfname;
|
||||
|
||||
[Required]
|
||||
[Range(1, int.MaxValue, ErrorMessage = "PageStart must be larger then 0.")]
|
||||
public int PageStart { get; set; }
|
||||
|
||||
[Required]
|
||||
[Range(1, int.MaxValue, ErrorMessage = "PageStop must be larger then 0.")]
|
||||
public int PageStop { get; set; }
|
||||
|
||||
public string ParsedPdfname
|
||||
{
|
||||
get
|
||||
{
|
||||
return parsedPdfname;
|
||||
}
|
||||
set
|
||||
{
|
||||
parsedPdfname = value.ToLower().EndsWith(".pdf") || string.IsNullOrWhiteSpace(value) ? value : $"{value}.pdf";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using LCU.Library.Internal.ApiResponse.Models;
|
||||
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models
|
||||
{
|
||||
public class BulkOperationRequest<TRequest> : ReturnResponse
|
||||
{
|
||||
public List<TRequest> OperationRequests { get; set; }
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models
|
||||
{
|
||||
public class CopyFileRequest : FileRequest
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
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 CreateDirectoryRequest : ReturnResponse
|
||||
{
|
||||
[Required(ErrorMessage = "Directory name is required.")]
|
||||
public string DirectoryName { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "Directory path is required")]
|
||||
public string DirectoryPath { get; set; }
|
||||
|
||||
public DynamicNameSetting NameSetting { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string FinalDirectoryName
|
||||
{
|
||||
get
|
||||
{
|
||||
return DynamicNameBuilder.BuildDynamicName(DirectoryName, NameSetting);
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public string DirectoryDestination
|
||||
{
|
||||
get
|
||||
{
|
||||
var finalDestinationPath = DirectoryPath.EndsWith("\\") ? DirectoryPath : $"{DirectoryPath}\\";
|
||||
return $"{finalDestinationPath}{FinalDirectoryName}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
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 DeleteDirectoryRequest : ReturnResponse
|
||||
{
|
||||
[Required(ErrorMessage = "Directory name is required.")]
|
||||
public string DirectoryName { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "Directory path is required")]
|
||||
public string DirectoryRootPath { get; set; }
|
||||
|
||||
[Range(0, 25, ErrorMessage = "MaxAmountOfDirectories must be between {1} and {2}.")]
|
||||
public int MaxAmountOfDirectories { get; set; } = 0;
|
||||
|
||||
public bool Recursive { get; set; }
|
||||
|
||||
public DynamicNameSetting DirectoryNameSettings { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string FinalDirectoryName
|
||||
{
|
||||
get
|
||||
{
|
||||
return DynamicNameBuilder.BuildDynamicName(DirectoryName, DirectoryNameSettings);
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public string FinalDirectoryPath
|
||||
{
|
||||
get
|
||||
{
|
||||
return $"{DirectoryRootPath}\\{FinalDirectoryName}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using LCU.Library.Internal.FileOperationsModels.Models.NameSettings;
|
||||
using LCU.Library.Internal.FileOperationsModels.Shared;
|
||||
using LCU.Library.Internal.ApiResponse.Models;
|
||||
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models
|
||||
{
|
||||
public class DeleteEmptyDirectoryRequest : ReturnResponse
|
||||
{
|
||||
[Required(ErrorMessage = "Sub directory path is required.")]
|
||||
public string SubDirectoryPath { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "Dynamic directory name is required")]
|
||||
public string DynamicDirectoryName { get; set; }
|
||||
|
||||
public DynamicNameSetting DirectoryNameSettings { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string FinalDirectoryName
|
||||
{
|
||||
get
|
||||
{
|
||||
return DynamicNameBuilder.BuildDynamicName(DynamicDirectoryName, DirectoryNameSettings);
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public string FinalDirectoryPath
|
||||
{
|
||||
get
|
||||
{
|
||||
return SubDirectoryPath.EndsWith("\\") ? $"{SubDirectoryPath}{FinalDirectoryName}" : $"{SubDirectoryPath}\\{FinalDirectoryName}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
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 DeleteFileRequest : ReturnResponse
|
||||
{
|
||||
[Required(ErrorMessage = "Source path is required")]
|
||||
public string SourcePath { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "Source file is required")]
|
||||
public string SourceFile { get; set; }
|
||||
|
||||
public DynamicNameSetting FileNameSetting { get; set; }
|
||||
|
||||
public bool SucceedOnError { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string FinalSourceFile
|
||||
{
|
||||
get
|
||||
{
|
||||
return DynamicNameBuilder.BuildDynamicName(SourceFile, FileNameSetting);
|
||||
}
|
||||
}
|
||||
[NotMapped]
|
||||
public string Source
|
||||
{
|
||||
get
|
||||
{
|
||||
var finalSourcePath = SourcePath.EndsWith("\\") ? SourcePath : $"{SourcePath}\\";
|
||||
return finalSourcePath + FinalSourceFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
using LCU.Library.Internal.FileOperationsModels.Models.NameSettings;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models
|
||||
{
|
||||
public class DynamicDirectoryListRequest
|
||||
{
|
||||
[Required(ErrorMessage = "Path is required")]
|
||||
public string Path { get; set; }
|
||||
[Required(ErrorMessage = "Dynamic Directory Name is required")]
|
||||
public string DynamicDirectoryName { get; set; }
|
||||
public DynamicNameSetting DynamicFileSettings { get; set; }
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
using LCU.Library.Internal.FileOperationsModels.Models.NameSettings;
|
||||
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models
|
||||
{
|
||||
public class DynamicFileListRequest
|
||||
{
|
||||
public string Path { get; set; }
|
||||
public string Filename { get; set; }
|
||||
public DynamicNameSetting DynamicFileSettings { get; set; }
|
||||
}
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
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 EncryptFileDataRequest : 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 = "Destination path is required.")]
|
||||
public string DestinationPath { 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}\\";
|
||||
finalDestinationPath = Path.Combine(finalDestinationPath, Path.GetFileNameWithoutExtension(FinalSourceFile)) + ".pgp";
|
||||
return finalDestinationPath;
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public string KeySource
|
||||
{
|
||||
get
|
||||
{
|
||||
var finalKeyPath = KeySourcePath.EndsWith("\\") ? KeySourcePath : $"{KeySourcePath}\\";
|
||||
finalKeyPath = Path.Combine(finalKeyPath, KeySourceFile);
|
||||
return finalKeyPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models.ExcelModels.Requests;
|
||||
|
||||
public class ExcelDataRequest
|
||||
{
|
||||
[Required(AllowEmptyStrings = false, ErrorMessage = "FileContent is required")]
|
||||
public string FileContent { get; set; }
|
||||
public List<SheetRequest> SheetRequests { get; set; } = null;
|
||||
|
||||
public bool SkipSheetForExtraction(string sheetName, out SheetRequest currentSheetRequest)
|
||||
{
|
||||
currentSheetRequest = SheetRequests is null || !SheetRequests.Any() ?
|
||||
null :
|
||||
SheetRequests.FirstOrDefault(sheetReq => sheetReq.SheetName == sheetName);
|
||||
|
||||
if (this is not null &&
|
||||
SheetRequests is not null &&
|
||||
SheetRequests.Any() &&
|
||||
currentSheetRequest is null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
currentSheetRequest ??= new SheetRequest();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models.ExcelModels.Requests;
|
||||
|
||||
public class SheetRequest
|
||||
{
|
||||
[Required(AllowEmptyStrings = false, ErrorMessage = "Sheet Name is required")]
|
||||
public string SheetName { get; set; }
|
||||
public List<string> Columns { get; set; } = null;
|
||||
public List<int> Rows { get; set; } = null;
|
||||
|
||||
public bool SkipRowForExtraction(int rowIndex)
|
||||
{
|
||||
if (this is not null && Rows is not null && Rows.Any())
|
||||
{
|
||||
if (!Rows.Contains(rowIndex))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool SkipColumnForExtraction(string columnName)
|
||||
{
|
||||
if (this is not null && Columns is not null && Columns.Any())
|
||||
{
|
||||
if (!Columns.Contains(columnName, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models.ExcelModels.Responses;
|
||||
|
||||
public class CellResponse
|
||||
{
|
||||
public string ColumnName { get; set; }
|
||||
public int Row { get; set; }
|
||||
public string Value { get; set; }
|
||||
public string Formula { get; set; }
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models.ExcelModels.Responses;
|
||||
|
||||
public class ExcelDataResponse
|
||||
{
|
||||
public ExcelDataResponse()
|
||||
{
|
||||
WorkBook = new WorkBook();
|
||||
}
|
||||
|
||||
public WorkBook WorkBook { get; set; }
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models.ExcelModels.Responses;
|
||||
|
||||
public class SheetResponse
|
||||
{
|
||||
public SheetResponse(string sheetName)
|
||||
{
|
||||
SheetName = sheetName;
|
||||
CellResponses = new List<CellResponse>();
|
||||
}
|
||||
|
||||
public string SheetName { get; set; }
|
||||
public List<CellResponse> CellResponses { get; set; }
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models.ExcelModels.Responses;
|
||||
|
||||
public class WorkBook
|
||||
{
|
||||
public WorkBook()
|
||||
{
|
||||
SheetResponses = new List<SheetResponse>();
|
||||
}
|
||||
|
||||
public List<SheetResponse> SheetResponses { get; set; }
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.IO;
|
||||
using LCU.Library.Internal.ApiResponse.Models;
|
||||
using LCU.Library.Internal.FileOperationsModels.Enums;
|
||||
using LCU.Library.Internal.FileOperationsModels.Models.NameSettings;
|
||||
using LCU.Library.Internal.FileOperationsModels.Shared;
|
||||
using LCU.Library.Internal.LcuEvaluationModels.Entities;
|
||||
|
||||
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models;
|
||||
|
||||
public class ExtractIndexFileDataRequest : ReturnResponse
|
||||
{
|
||||
public string IndexFilePath { get; set; }
|
||||
public DynamicNameSetting IndexFilePathSetting { get; set; }
|
||||
public string IndexFileName { get; set; }
|
||||
public DynamicNameSetting IndexFileNameSetting { get; set; }
|
||||
public Delimiters DelimiterType { get; set; }
|
||||
public bool ExtractAllIndexes { get; set; }
|
||||
public List<int> IndexesToExtract { get; set; }
|
||||
public EvaluationDetail EvaluationRule { get; set; }
|
||||
public string DestinationIndexFileName { get; set; }
|
||||
public string DestinationFilePath { get; set; }
|
||||
public DynamicNameSetting DestinationFilePathSetting { get; set; }
|
||||
public bool AppendToDestinationIndexFile { get; set; }
|
||||
public bool IndexHasHeaders { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string FinalIndexFileName => DynamicNameBuilder.BuildDynamicName(IndexFileName, IndexFileNameSetting);
|
||||
|
||||
[NotMapped]
|
||||
public string FinalIndexFileDirectory
|
||||
{
|
||||
get
|
||||
{
|
||||
var indexFilePath = IndexFilePath.EndsWith("\\") ? IndexFilePath : $"{IndexFilePath}\\";
|
||||
return DynamicNameBuilder.BuildDynamicName(indexFilePath, IndexFilePathSetting);
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public string FinalIndexFilePath => Path.Combine(FinalIndexFileDirectory, FinalIndexFileName);
|
||||
|
||||
[NotMapped]
|
||||
public string FinalDestinationPath
|
||||
{
|
||||
get
|
||||
{
|
||||
var destinationFilePath = DestinationFilePath.EndsWith("\\") ? DestinationFilePath : $"{DestinationFilePath}\\";
|
||||
return DynamicNameBuilder.BuildDynamicName(destinationFilePath, DestinationFilePathSetting);
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public string FinalDestinationIndexFilePath => Path.Combine(FinalDestinationPath, DestinationIndexFileName);
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models;
|
||||
public enum FileOperationType
|
||||
{
|
||||
Move = 0,
|
||||
Copy = 1,
|
||||
Delete = 2,
|
||||
Rename = 3,
|
||||
ZipDirectory = 4,
|
||||
CreateDirectory = 5,
|
||||
RenameDirectory = 6,
|
||||
BulkMoveFile = 7,
|
||||
UnzipFile = 8,
|
||||
EncryptFileData = 9,
|
||||
DecryptFileData = 10,
|
||||
Modify = 11,
|
||||
UnzipPasswordProtectedFile = 12,
|
||||
BatchPdfParser = 13,
|
||||
WriteFile = 14,
|
||||
DeleteDirectory = 15,
|
||||
Validate = 16,
|
||||
AppendFile = 17,
|
||||
ExtractIndexFileData = 18,
|
||||
DeleteEmptyDirectory = 19,
|
||||
ValidateFileSizeInRange = 20
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
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 abstract class FileRequest : 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 = "Destination path is required.")]
|
||||
public string DestinationPath { get; set; }
|
||||
|
||||
public string DestinationName { get; set; }
|
||||
|
||||
public bool Overwrite { get; set; }
|
||||
|
||||
public bool SucceedOnError { get; set; }
|
||||
|
||||
public DynamicNameSetting FileNameSetting { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string FinalSourceFile
|
||||
{
|
||||
get
|
||||
{
|
||||
return DynamicNameBuilder.BuildDynamicName(SourceFile, FileNameSetting);
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public string FinalDestinationName
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(DestinationName) ? FinalSourceFile : DestinationName;
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public string Source
|
||||
{
|
||||
get
|
||||
{
|
||||
var finalSourcePath = SourcePath.EndsWith("\\") ? SourcePath : $"{SourcePath}\\";
|
||||
return finalSourcePath + FinalSourceFile;
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public string Destination
|
||||
{
|
||||
get
|
||||
{
|
||||
var finalDestinationPath = DestinationPath.EndsWith("\\") ? DestinationPath : $"{DestinationPath}\\";
|
||||
return finalDestinationPath + FinalDestinationName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models.HtmlToPdfModels;
|
||||
|
||||
public class HtmlToPdfRequest
|
||||
{
|
||||
[Required(AllowEmptyStrings = false)]
|
||||
public string HtmlTemplateFilePath { get; set; }
|
||||
[Required]
|
||||
[RegularExpression(@"^[^\.]+$", ErrorMessage = "File extensions are not allowed.")]
|
||||
public string PdfName { get; set; }
|
||||
public bool KeepHtmlFile { get; set; } = false;
|
||||
public bool KeepPdfFile { get; set; } = false;
|
||||
[Required(AllowEmptyStrings = false)]
|
||||
public string HtmlSaveFilePath { get; set; }
|
||||
[Required(AllowEmptyStrings = false)]
|
||||
public string PdfSaveFilePath { get; set; }
|
||||
public List<TagValue> BodyTagValues { get; set; }
|
||||
public List<ValueCollection> BodyValueCollections { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string FinalHtmlSaveFilePath
|
||||
{
|
||||
get
|
||||
{
|
||||
var finalHtmlSavePath = HtmlSaveFilePath.EndsWith("\\") ?
|
||||
HtmlSaveFilePath :
|
||||
$"{HtmlSaveFilePath}\\";
|
||||
return finalHtmlSavePath;
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public string FinalPdfSaveFilePath
|
||||
{
|
||||
get
|
||||
{
|
||||
var finalPdfSaveFilePath = PdfSaveFilePath.EndsWith("\\") ?
|
||||
PdfSaveFilePath :
|
||||
$"{PdfSaveFilePath}\\";
|
||||
return finalPdfSaveFilePath;
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public string FinalHtmlSaveFilePathWithFile
|
||||
{
|
||||
get
|
||||
{
|
||||
return $"{FinalHtmlSaveFilePath}{PdfName}.html";
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public string FinalPdfSaveFilePathWithFile
|
||||
{
|
||||
get
|
||||
{
|
||||
return $"{FinalPdfSaveFilePath}{PdfName}.pdf";
|
||||
}
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models.HtmlToPdfModels;
|
||||
|
||||
public class TagValue
|
||||
{
|
||||
[Required(AllowEmptyStrings = false)]
|
||||
public string Tag { get; set; }
|
||||
[Required(AllowEmptyStrings = false)]
|
||||
public string Value { get; set; }
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models.HtmlToPdfModels;
|
||||
|
||||
public class ValueCollection
|
||||
{
|
||||
[Required(AllowEmptyStrings = false)]
|
||||
public string CollectionTag { get; set; }
|
||||
[Required(AllowEmptyStrings = false)]
|
||||
public string CollectionHtmlTemplateFilePath { get; set; }
|
||||
public List<ValueCollectionItem> ValueCollectionItems { get; set; }
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models.HtmlToPdfModels;
|
||||
|
||||
public class ValueCollectionItem
|
||||
{
|
||||
public List<TagValue> TagValues { get; set; }
|
||||
public List<ValueCollection> ValueCollections { get; set; }
|
||||
}
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using LCU.Library.Internal.ApiResponse.Models;
|
||||
using LCU.Library.Internal.FileOperationsModels.Models.NameSettings;
|
||||
using LCU.Library.Internal.FileOperationsModels.Shared;
|
||||
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models
|
||||
{
|
||||
public class ModifyFileRequest : ReturnResponse
|
||||
{
|
||||
[Required(ErrorMessage = "Source path is required")]
|
||||
public string SourcePath { get; set; }
|
||||
[Required(ErrorMessage = "Source file is required")]
|
||||
public string SourceFile { get; set; }
|
||||
public string PrependText { get; set; }
|
||||
public string SourceExtension { get; set; }
|
||||
public string AppendText { get; set; }
|
||||
public string NewExtension { get; set; }
|
||||
public int MaxAmountOfFiles { get; set; } = 0;
|
||||
public bool SucceedOnError { get; set; }
|
||||
public DynamicNameSetting FileNameSetting { get; set; }
|
||||
[NotMapped]
|
||||
public string OriginalSource
|
||||
{
|
||||
get
|
||||
{
|
||||
var finalSourcePath = SourcePath.EndsWith("\\") ? SourcePath : $"{SourcePath}\\";
|
||||
return finalSourcePath + OriginalSourceFile;
|
||||
}
|
||||
}
|
||||
[NotMapped]
|
||||
public string OriginalSourceFile
|
||||
{
|
||||
get
|
||||
{
|
||||
var fileName = DynamicNameBuilder.BuildDynamicName($"{SourceFile}.{SourceExtension}", FileNameSetting);
|
||||
return fileName;
|
||||
}
|
||||
}
|
||||
[NotMapped]
|
||||
public string FinalSourceFile
|
||||
{
|
||||
get
|
||||
{
|
||||
var fileName = DynamicNameBuilder.BuildDynamicName(SourceFile, FileNameSetting);
|
||||
var finalFileName = $"{PrependText}{fileName}{AppendText}.{FinalExtension}";
|
||||
return finalFileName;
|
||||
}
|
||||
}
|
||||
[NotMapped]
|
||||
public string FinalSource
|
||||
{
|
||||
get
|
||||
{
|
||||
var finalSourcePath = SourcePath.EndsWith("\\") ? SourcePath : $"{SourcePath}\\";
|
||||
return finalSourcePath + FinalSourceFile;
|
||||
}
|
||||
}
|
||||
public static string GetNameWithoutExtension(string name, string extension)
|
||||
{
|
||||
var fileNameWithOutExtension = name.Replace("." + extension, string.Empty);
|
||||
return fileNameWithOutExtension;
|
||||
}
|
||||
[NotMapped]
|
||||
public string FinalExtension
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(NewExtension))
|
||||
{
|
||||
return SourceExtension;
|
||||
}
|
||||
|
||||
return NewExtension;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models
|
||||
{
|
||||
public class MoveFileRequest : FileRequest
|
||||
{
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models.NameSettings
|
||||
{
|
||||
public class DateFormatSetting
|
||||
{
|
||||
public string Tag { get; set; }
|
||||
public string DateFormat { get; set; }
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models.NameSettings
|
||||
{
|
||||
public class DynamicNameSetting
|
||||
{
|
||||
public List<DateFormatSetting> DateFormatSettings { get; set; }
|
||||
public List<RegexSetting> RegexSettings { get; set; }
|
||||
public int DaysFromToday { get; set; }
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models.NameSettings
|
||||
{
|
||||
public class RegexSetting
|
||||
{
|
||||
public string Tag { get; set; }
|
||||
public string Regex { get; set; }
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models
|
||||
{
|
||||
public class ParsePdfRequest
|
||||
{
|
||||
private string rootPath;
|
||||
private string parsedPdfname;
|
||||
|
||||
[Required(AllowEmptyStrings = false)]
|
||||
public string RootPath
|
||||
{
|
||||
get
|
||||
{
|
||||
return rootPath;
|
||||
}
|
||||
set
|
||||
{
|
||||
rootPath = string.IsNullOrWhiteSpace(value) || value.EndsWith("\\") ? value : $"{value}\\";
|
||||
}
|
||||
}
|
||||
|
||||
[Required(AllowEmptyStrings = false)]
|
||||
public string PdfName { get; set; }
|
||||
|
||||
[Required]
|
||||
[Range(1, int.MaxValue, ErrorMessage = "PageStart must be larger then 0.")]
|
||||
public int PageStart { get; set; }
|
||||
|
||||
[Required]
|
||||
[Range(1, int.MaxValue, ErrorMessage = "PageStop must be larger then 0.")]
|
||||
public int PageStop { get; set; }
|
||||
|
||||
public string ParsedPdfname
|
||||
{
|
||||
get
|
||||
{
|
||||
return parsedPdfname;
|
||||
}
|
||||
set
|
||||
{
|
||||
parsedPdfname = value.ToLower().EndsWith(".pdf") || string.IsNullOrWhiteSpace(value) ? value : $"{value}.pdf";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using LCU.Library.Internal.ApiResponse.Models;
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models;
|
||||
public class QueueRequest
|
||||
{
|
||||
public ReturnResponse ReturnResponse { get; set; }
|
||||
public FileOperationType FileOperationType { get; set; }
|
||||
public string Request { get; set; }
|
||||
public int? Attempts { get; set; }
|
||||
public DateTime QueueTimeStamp { get; set; }
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
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 RenameDirectoryRequest : ReturnResponse
|
||||
{
|
||||
[Required(ErrorMessage = "Source directory path is required.")]
|
||||
public string SourceDirectoryPath { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "Source directory name is required.")]
|
||||
public string SourceDirectoryName { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "Directory name is required.")]
|
||||
public string NewDirectoryName { get; set; }
|
||||
|
||||
public DynamicNameSetting SourceDirectoryNameSetting { get; set; }
|
||||
|
||||
public DynamicNameSetting NewDirectoryNameSetting { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string FinalSourceDirectoryName
|
||||
{
|
||||
get
|
||||
{
|
||||
return DynamicNameBuilder.BuildDynamicName(SourceDirectoryName, SourceDirectoryNameSetting);
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public string FinalSourceDirectoryPath
|
||||
{
|
||||
get
|
||||
{
|
||||
var finalDestinationPath = SourceDirectoryPath.EndsWith("\\") ? SourceDirectoryPath : $"{SourceDirectoryPath}\\";
|
||||
return $"{finalDestinationPath}{FinalSourceDirectoryName}";
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public string FinalNewDirectoryName
|
||||
{
|
||||
get
|
||||
{
|
||||
return DynamicNameBuilder.BuildDynamicName(NewDirectoryName, NewDirectoryNameSetting);
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public string NewDirectoryDestination
|
||||
{
|
||||
get
|
||||
{
|
||||
var finalDestinationPath = SourceDirectoryPath.EndsWith("\\") ? SourceDirectoryPath : $"{SourceDirectoryPath}\\";
|
||||
return $"{finalDestinationPath}{FinalNewDirectoryName}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
using System.Collections.Generic;
|
||||
using LCU.Library.Internal.ApiResponse.Models;
|
||||
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models
|
||||
{
|
||||
public class RequestResponse
|
||||
{
|
||||
public RequestResponse()
|
||||
{
|
||||
MessageStack = new List<string>();
|
||||
IsSuccessful = true;
|
||||
ReturnResponse = null;
|
||||
}
|
||||
|
||||
public List<string> MessageStack { get; set; }
|
||||
public bool IsSuccessful { get; set; }
|
||||
public ReturnResponse ReturnResponse { get; set; }
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
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 FileDestinationRequest
|
||||
{
|
||||
[Required(ErrorMessage = "Destination path is required.")]
|
||||
public string DestinationPath { get; set; }
|
||||
public DynamicNameSetting DestinationPathSettings { get; set; }
|
||||
public string DestinationName { get; set; } = string.Empty;
|
||||
public bool Overwrite { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string FinalDestinationPath
|
||||
{
|
||||
get
|
||||
{
|
||||
var destinationPath = DestinationPath.EndsWith("\\") ? DestinationPath : $"{DestinationPath}\\";
|
||||
return DynamicNameBuilder.BuildDynamicName(destinationPath, DestinationPathSettings);
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public string Destination => Path.Combine(FinalDestinationPath, DestinationName);
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
using LCU.Library.Internal.FileOperationsModels.Enums;
|
||||
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models.Requests;
|
||||
|
||||
public class FileSizeRequest : IFileSourceRequest
|
||||
{
|
||||
public FileSourceRequest FileSourceRequest { get; set; } = new();
|
||||
public FileSizeTypes FileSizeType { get; set; }
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
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);
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models.Requests;
|
||||
|
||||
public interface IFileDestinationRequest
|
||||
{
|
||||
public FileDestinationRequest FileDestinationRequest { get; set; }
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models.Requests;
|
||||
|
||||
public interface IFileSourceRequest
|
||||
{
|
||||
public FileSourceRequest FileSourceRequest { get; set; }
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
using LCU.Library.Internal.ApiResponse.Models;
|
||||
using LCU.Library.Internal.FileOperationsModels.Enums;
|
||||
using System.ComponentModel;
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models.Requests;
|
||||
|
||||
public class ValidateFileRequest : ReturnResponse, IFileSourceRequest
|
||||
{
|
||||
public FileSourceRequest FileSourceRequest { get; set; } = new();
|
||||
[DefaultValue(false)]
|
||||
public bool CheckFileCount { get; set; } = false;
|
||||
public int FileCount { get; set; }
|
||||
public OperatorTypes OperatorType { get; set; }
|
||||
public bool FileDoesExist { get; set; }
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
using LCU.Library.Internal.ApiResponse.Models;
|
||||
using LCU.Library.Internal.FileOperationsModels.Enums;
|
||||
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models.Requests;
|
||||
|
||||
public class ValidateFileSizeInRangeRequest : ReturnResponse, IFileSourceRequest
|
||||
{
|
||||
public FileSourceRequest FileSourceRequest { get; set; } = new();
|
||||
public FileSizeTypes FileSizeType { get; set; }
|
||||
public decimal StartFileSizeRange { get; set; }
|
||||
public decimal EndFileSizeRange { get; set; }
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using LCU.Library.Internal.ApiResponse.Models;
|
||||
using LCU.Library.Internal.FileOperationsModels.Enums;
|
||||
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models.Responses;
|
||||
|
||||
public class FileSizeResponse : ReturnResponse
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public decimal FileSize { get; set; }
|
||||
public FileSizeTypes FileSizeType { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string FileSizeString
|
||||
{
|
||||
get
|
||||
{
|
||||
var fileSizeType = FileSizeType.GetType().GetMember(FileSizeType.ToString()).First().GetCustomAttribute<DisplayAttribute>()?.Name;
|
||||
return $"{Math.Round(FileSize, 6):0.######} {fileSizeType}";
|
||||
}
|
||||
}
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
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}\\";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
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}\\"; ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
using LCU.Library.Internal.ApiResponse.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models
|
||||
{
|
||||
public class WriteFileRequest : ReturnResponse
|
||||
{
|
||||
[Required(ErrorMessage = "Destination path is required.")]
|
||||
public string DestinationPath { get; set; }
|
||||
[Required(ErrorMessage = "FileName is required.")]
|
||||
public string FileName { get; set; }
|
||||
[Required(ErrorMessage = "Extension is required.")]
|
||||
public string Extension { get; set; }
|
||||
[Required(ErrorMessage = "FileData is required.")]
|
||||
public string FileData { get; set; }
|
||||
public bool Overwrite { get; set; } = false;
|
||||
|
||||
[NotMapped]
|
||||
public string FullFilePath
|
||||
{
|
||||
get
|
||||
{
|
||||
return DestinationPath.EndsWith("\\") ? $"{DestinationPath}{FileNameWithExtension}" : $"{DestinationPath}\\{FileNameWithExtension}";
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public string FileNameWithExtension
|
||||
{
|
||||
get
|
||||
{
|
||||
return Extension.StartsWith(".") ? $"{FileName}{Extension}" : $"{FileName}.{Extension}";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
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 ZipDirectoryRequest : ReturnResponse
|
||||
{
|
||||
[Required(ErrorMessage = "Source path is required")]
|
||||
public string SourceDirectory { get; set; }
|
||||
|
||||
public string DirectoryName { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "Zip path is required.")]
|
||||
public string ZipPath { get; set; }
|
||||
|
||||
public string ZipFileName { get; set; }
|
||||
|
||||
public DynamicNameSetting FileNameSetting { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string DynamicDirectoryName
|
||||
{
|
||||
get
|
||||
{
|
||||
return DynamicNameBuilder.BuildDynamicName(DirectoryName, FileNameSetting);
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public string FormattedSourceDirectory
|
||||
{
|
||||
get
|
||||
{
|
||||
return SourceDirectory.EndsWith("\\") ? SourceDirectory : $"{SourceDirectory}\\";
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public string ZipDestination
|
||||
{
|
||||
get
|
||||
{
|
||||
var finalDestinationPath = ZipPath.EndsWith("\\") ? ZipPath : $"{ZipPath}\\";
|
||||
var finalZipName = !string.IsNullOrWhiteSpace(ZipFileName) ? ZipFileName : DirectoryName;
|
||||
finalZipName = finalZipName.ToUpper().EndsWith(".ZIP") ? finalZipName : $"{finalZipName}.zip";
|
||||
return finalDestinationPath + finalZipName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user