Undo Rename

This commit is contained in:
2023-02-05 11:33:56 -07:00
parent 4db52e5135
commit bac6b114a0
3 changed files with 39 additions and 6 deletions

View File

@ -7,25 +7,28 @@ public class AppSettings
{
public string Company { init; get; }
public string CopyTo { init; get; }
public string ComparePathsFile { init; get; }
public string CopyTo { init; get; }
public int MaxDegreeOfParallelism { init; get; }
public int MaxMinutesDelta { init; get; }
public bool RenameUndo { init; get; }
public string WorkingDirectoryName { init; get; }
[JsonConstructor]
public AppSettings(string company,
string copyTo,
string comparePathsFile,
string copyTo,
int maxDegreeOfParallelism,
int maxMinutesDelta,
bool renameUndo,
string workingDirectoryName)
{
Company = company;
CopyTo = copyTo;
ComparePathsFile = comparePathsFile;
CopyTo = copyTo;
MaxDegreeOfParallelism = maxDegreeOfParallelism;
MaxMinutesDelta = maxMinutesDelta;
RenameUndo = renameUndo;
WorkingDirectoryName = workingDirectoryName;
}

View File

@ -9,10 +9,11 @@ public class AppSettings
#nullable disable
public string Company { get; set; }
public string CopyTo { get; set; }
public string ComparePathsFile { get; set; }
public string CopyTo { get; set; }
public int? MaxDegreeOfParallelism { get; set; }
public int? MaxMinutesDelta { get; set; }
public bool? RenameUndo { get; set; }
public string WorkingDirectoryName { get; set; }
#nullable restore
@ -30,12 +31,15 @@ public class AppSettings
throw new NullReferenceException(nameof(appSettings.MaxDegreeOfParallelism));
if (appSettings?.MaxMinutesDelta is null)
throw new NullReferenceException(nameof(appSettings.MaxMinutesDelta));
if (appSettings?.RenameUndo is null)
throw new NullReferenceException(nameof(appSettings.RenameUndo));
result = new(
appSettings.Company,
appSettings.CopyTo,
appSettings.ComparePathsFile,
appSettings.CopyTo,
appSettings.MaxDegreeOfParallelism.Value,
appSettings.MaxMinutesDelta.Value,
appSettings.RenameUndo.Value,
appSettings.WorkingDirectoryName
);
return result;