Rename: ForceIdName
DeleteEmptyDirectories: UnauthorizedAccessException
This commit is contained in:
@ -1,34 +1,15 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace View_by_Distance.Rename.Models;
|
||||
|
||||
public class AppSettings
|
||||
public record AppSettings(string Company,
|
||||
bool ForceIdName,
|
||||
int MaxDegreeOfParallelism,
|
||||
int MaxMinutesDelta,
|
||||
bool RenameUndo,
|
||||
string WorkingDirectoryName)
|
||||
{
|
||||
|
||||
public string Company { init; get; }
|
||||
public string ComparePathsFile { 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 comparePathsFile,
|
||||
int maxDegreeOfParallelism,
|
||||
int maxMinutesDelta,
|
||||
bool renameUndo,
|
||||
string workingDirectoryName)
|
||||
{
|
||||
Company = company;
|
||||
ComparePathsFile = comparePathsFile;
|
||||
MaxDegreeOfParallelism = maxDegreeOfParallelism;
|
||||
MaxMinutesDelta = maxMinutesDelta;
|
||||
RenameUndo = renameUndo;
|
||||
WorkingDirectoryName = workingDirectoryName;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
||||
|
@ -6,16 +6,12 @@ namespace View_by_Distance.Rename.Models.Binder;
|
||||
public class AppSettings
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
public string Company { get; set; }
|
||||
public string ComparePathsFile { get; set; }
|
||||
public string? Company { get; set; }
|
||||
public bool? ForceIdName { get; set; }
|
||||
public int? MaxDegreeOfParallelism { get; set; }
|
||||
public int? MaxMinutesDelta { get; set; }
|
||||
public bool? RenameUndo { get; set; }
|
||||
public string WorkingDirectoryName { get; set; }
|
||||
|
||||
#nullable restore
|
||||
public string? WorkingDirectoryName { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
@ -26,15 +22,21 @@ public class AppSettings
|
||||
private static Models.AppSettings Get(AppSettings? appSettings)
|
||||
{
|
||||
Models.AppSettings result;
|
||||
if (appSettings?.Company is null)
|
||||
throw new NullReferenceException(nameof(appSettings.Company));
|
||||
if (appSettings?.ForceIdName is null)
|
||||
throw new NullReferenceException(nameof(appSettings.ForceIdName));
|
||||
if (appSettings?.MaxDegreeOfParallelism is null)
|
||||
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));
|
||||
if (appSettings?.WorkingDirectoryName is null)
|
||||
throw new NullReferenceException(nameof(appSettings.WorkingDirectoryName));
|
||||
result = new(
|
||||
appSettings.Company,
|
||||
appSettings.ComparePathsFile,
|
||||
appSettings.ForceIdName.Value,
|
||||
appSettings.MaxDegreeOfParallelism.Value,
|
||||
appSettings.MaxMinutesDelta.Value,
|
||||
appSettings.RenameUndo.Value,
|
||||
|
Reference in New Issue
Block a user