This commit is contained in:
2023-10-15 09:51:56 -07:00
parent 2cd2c2b434
commit cd5ab223c9
75 changed files with 895 additions and 722 deletions

View File

@ -59,6 +59,7 @@ public partial class DragDropSetPropertyItem : Form
Log.Logger = loggerConfiguration.CreateLogger();
logger = Log.ForContext<DragDropSetPropertyItem>();
Property.Models.Configuration propertyConfiguration = Property.Models.Binder.Configuration.Get(isEnvironment, configurationRoot);
Property.Models.Configuration.Verify(propertyConfiguration, requireExist: false);
_PropertyConfiguration = propertyConfiguration;
logger.Information("Complete");
_Logger = logger;
@ -169,7 +170,7 @@ public partial class DragDropSetPropertyItem : Form
{
if (record.PropertyItemType is not null && record.PropertyItemType.Value != type)
throw new NotSupportedException();
if ((record.DateTimeOriginal is null || !string.IsNullOrEmpty(record.Value) || record.Value == setTo) && !_AppSettings.IgnoreRulesKeyWords.Contains(setTo))
if ((record.DateTimeOriginal is null || !string.IsNullOrEmpty(record.Value) || record.Value == setTo) && !_PropertyConfiguration.IgnoreRulesKeyWords.Contains(setTo))
continue;
checkFile = $"{record.FileHolder.FullName}.exif";
propertyItem = Property.Models.Stateless.IProperty.GetPropertyItem(constructorInfo, tagId, type, setTo);

View File

@ -3,7 +3,6 @@ using System.Text.Json;
namespace View_by_Distance.Drag.Drop.Set.Item.Models;
public record AppSettings(string Company,
string[] IgnoreRulesKeyWords,
int MaxDegreeOfParallelism,
string[] ValidKeyWords,
string WorkingDirectoryName)

View File

@ -0,0 +1,2 @@
[*.cs]
csharp_preserve_single_line_statements = true

View File

@ -7,7 +7,6 @@ public class AppSettings
{
public string? Company { get; set; }
public string[]? IgnoreRulesKeyWords { get; set; }
public int? MaxDegreeOfParallelism { get; set; }
public string[]? ValidKeyWords { get; set; }
public string? WorkingDirectoryName { get; set; }
@ -21,19 +20,12 @@ 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?.IgnoreRulesKeyWords is null)
throw new NullReferenceException(nameof(appSettings.IgnoreRulesKeyWords));
if (appSettings?.MaxDegreeOfParallelism is null)
throw new NullReferenceException(nameof(appSettings.MaxDegreeOfParallelism));
if (appSettings?.ValidKeyWords is null)
throw new NullReferenceException(nameof(appSettings.ValidKeyWords));
if (appSettings?.WorkingDirectoryName is null)
throw new NullReferenceException(nameof(appSettings.WorkingDirectoryName));
if (appSettings?.Company is null) throw new NullReferenceException(nameof(appSettings.Company));
if (appSettings?.MaxDegreeOfParallelism is null) throw new NullReferenceException(nameof(appSettings.MaxDegreeOfParallelism));
if (appSettings?.ValidKeyWords is null) throw new NullReferenceException(nameof(appSettings.ValidKeyWords));
if (appSettings?.WorkingDirectoryName is null) throw new NullReferenceException(nameof(appSettings.WorkingDirectoryName));
result = new(
appSettings.Company,
appSettings.IgnoreRulesKeyWords,
appSettings.MaxDegreeOfParallelism.Value,
appSettings.ValidKeyWords,
appSettings.WorkingDirectoryName