OriginalFileName
This commit is contained in:
@ -4,11 +4,7 @@ using System.Text.Json.Serialization;
|
||||
namespace View_by_Distance.Rename.Models;
|
||||
|
||||
public record AppSettings(string Company,
|
||||
string DefaultUnknownDirectoryName,
|
||||
bool ForceIdName,
|
||||
int MaxDegreeOfParallelism,
|
||||
int MaxMinutesDelta,
|
||||
bool RenameUndo)
|
||||
int MaxDegreeOfParallelism)
|
||||
{
|
||||
|
||||
public override string ToString()
|
||||
|
@ -8,11 +8,7 @@ public class AppSettings
|
||||
{
|
||||
|
||||
public string? Company { get; set; }
|
||||
public string? DefaultUnknownDirectoryName { get; set; }
|
||||
public bool? ForceIdName { get; set; }
|
||||
public int? MaxDegreeOfParallelism { get; set; }
|
||||
public int? MaxMinutesDelta { get; set; }
|
||||
public bool? RenameUndo { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
@ -24,19 +20,10 @@ public class AppSettings
|
||||
{
|
||||
Models.AppSettings result;
|
||||
if (appSettings?.Company is null) throw new NullReferenceException(nameof(appSettings.Company));
|
||||
if (appSettings?.DefaultUnknownDirectoryName is null) throw new NullReferenceException(nameof(appSettings.DefaultUnknownDirectoryName));
|
||||
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));
|
||||
result = new(
|
||||
appSettings.Company,
|
||||
appSettings.DefaultUnknownDirectoryName,
|
||||
appSettings.ForceIdName.Value,
|
||||
appSettings.MaxDegreeOfParallelism.Value,
|
||||
appSettings.MaxMinutesDelta.Value,
|
||||
appSettings.RenameUndo.Value
|
||||
);
|
||||
appSettings.MaxDegreeOfParallelism.Value);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -37,15 +37,7 @@ public class Configuration
|
||||
public static Models.Configuration Get(IConfigurationRoot configurationRoot, Metadata.Models.MetadataConfiguration metadataConfiguration)
|
||||
{
|
||||
Models.Configuration result;
|
||||
#if Linux
|
||||
string environmentName = "Linux";
|
||||
#elif OSX
|
||||
string environmentName = "OSX";
|
||||
#elif Windows
|
||||
string environmentName = "Windows";
|
||||
#endif
|
||||
string section = string.Concat(environmentName, ":", nameof(Configuration));
|
||||
IConfigurationSection configurationSection = configurationRoot.GetSection(section);
|
||||
IConfigurationSection configurationSection = configurationRoot.GetSection(nameof(Configuration));
|
||||
#pragma warning disable IL3050, IL2026
|
||||
Configuration? configuration = configurationSection.Get<Configuration>();
|
||||
#pragma warning restore IL3050, IL2026
|
||||
|
Reference in New Issue
Block a user