2023-01-25
This commit is contained in:
@ -10,15 +10,22 @@ public class AppSettings
|
||||
public string CopyTo { init; get; }
|
||||
public string ComparePathsFile { init; get; }
|
||||
public int MaxDegreeOfParallelism { init; get; }
|
||||
public int MaxMinutesDelta { init; get; }
|
||||
public string WorkingDirectoryName { init; get; }
|
||||
|
||||
[JsonConstructor]
|
||||
public AppSettings(string company, string copyTo, string comparePathsFile, int maxDegreeOfParallelism, string workingDirectoryName)
|
||||
public AppSettings(string company,
|
||||
string copyTo,
|
||||
string comparePathsFile,
|
||||
int maxDegreeOfParallelism,
|
||||
int maxMinutesDelta,
|
||||
string workingDirectoryName)
|
||||
{
|
||||
Company = company;
|
||||
CopyTo = copyTo;
|
||||
ComparePathsFile = comparePathsFile;
|
||||
MaxDegreeOfParallelism = maxDegreeOfParallelism;
|
||||
MaxMinutesDelta = maxMinutesDelta;
|
||||
WorkingDirectoryName = workingDirectoryName;
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@ public class AppSettings
|
||||
public string CopyTo { get; set; }
|
||||
public string ComparePathsFile { get; set; }
|
||||
public int? MaxDegreeOfParallelism { get; set; }
|
||||
public int? MaxMinutesDelta { get; set; }
|
||||
public string WorkingDirectoryName { get; set; }
|
||||
|
||||
#nullable restore
|
||||
@ -27,11 +28,14 @@ public class AppSettings
|
||||
Models.AppSettings result;
|
||||
if (appSettings?.MaxDegreeOfParallelism is null)
|
||||
throw new NullReferenceException(nameof(appSettings.MaxDegreeOfParallelism));
|
||||
if (appSettings?.MaxMinutesDelta is null)
|
||||
throw new NullReferenceException(nameof(appSettings.MaxMinutesDelta));
|
||||
result = new(
|
||||
appSettings.Company,
|
||||
appSettings.CopyTo,
|
||||
appSettings.ComparePathsFile,
|
||||
appSettings.MaxDegreeOfParallelism.Value,
|
||||
appSettings.MaxMinutesDelta.Value,
|
||||
appSettings.WorkingDirectoryName
|
||||
);
|
||||
return result;
|
||||
|
@ -176,7 +176,7 @@ public class Rename
|
||||
dateTime = Metadata.Models.Stateless.Methods.IMetadata.GetMinimumDateTime(dateTimes, year, directories);
|
||||
timeSpan = new TimeSpan(int.MaxValue);
|
||||
}
|
||||
if (dateTime is not null && string.IsNullOrEmpty(_AppSettings.CopyTo) && timeSpan.TotalMinutes > 2)
|
||||
if (dateTime is not null && string.IsNullOrEmpty(_AppSettings.CopyTo) && timeSpan.TotalMinutes > _AppSettings.MaxMinutesDelta)
|
||||
{
|
||||
checkFileExtension = fileHolder.ExtensionLowered == jpeg ? jpg : fileHolder.ExtensionLowered;
|
||||
checkFile = Path.Combine(fileHolder.DirectoryName, $"{dateTime.Value:yyyy-MM-dd}.{dateTime.Value.Ticks}.{fileHolder.Length}{checkFileExtension}");
|
||||
|
@ -1,12 +1,13 @@
|
||||
{
|
||||
"ComparePathsFile": "C:/Users/mikep/AppData/Local/PharesApps/Drag-Drop-Explorer/2023_03/638095825580115652.json",
|
||||
"CopyTo": "",
|
||||
"ComparePathsFile": "C:/Users/mikep/AppData/Local/PharesApps/Drag-Drop-Explorer/2023_04/638105008748068423.json",
|
||||
"CopyTo": "L",
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Log4netProvider": "Debug"
|
||||
}
|
||||
},
|
||||
"MaxDegreeOfParallelism": 6,
|
||||
"MaxMinutesDelta": 2,
|
||||
"Serilog": {
|
||||
"MinimumLevel": "Debug"
|
||||
},
|
||||
|
@ -12,6 +12,7 @@
|
||||
}
|
||||
},
|
||||
"MaxDegreeOfParallelism": 6,
|
||||
"MaxMinutesDelta": 2,
|
||||
"Serilog": {
|
||||
"Using": [
|
||||
"Serilog.Sinks.Console",
|
||||
|
Reference in New Issue
Block a user