a
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Phares.Shared;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace View_by_Distance.Date.Group.Models.Binder;
|
||||
@ -10,13 +9,13 @@ public class Configuration
|
||||
|
||||
#nullable disable
|
||||
|
||||
[Display(Name = "By Create Date Shortcut"), Required] public bool? ByCreateDateShortcut { get; set; }
|
||||
[Display(Name = "By Date"), Required] public bool? ByDay { get; set; }
|
||||
[Display(Name = "By Hash"), Required] public bool? ByHash { get; set; }
|
||||
[Display(Name = "By Season"), Required] public bool? BySeason { get; set; }
|
||||
[Display(Name = "By Week"), Required] public bool? ByWeek { get; set; }
|
||||
[Display(Name = "Ignore Subdirectories for Rename"), Required] public bool? KeepFullPath { get; set; }
|
||||
[Display(Name = "Property Configuration"), Required] public Property.Models.Configuration PropertyConfiguration { get; set; }
|
||||
public bool? ByCreateDateShortcut { get; set; }
|
||||
public bool? ByDay { get; set; }
|
||||
public bool? ByHash { get; set; }
|
||||
public bool? BySeason { get; set; }
|
||||
public bool? ByWeek { get; set; }
|
||||
public bool? KeepFullPath { get; set; }
|
||||
public Property.Models.Configuration PropertyConfiguration { get; set; }
|
||||
|
||||
#nullable restore
|
||||
|
||||
@ -29,20 +28,13 @@ public class Configuration
|
||||
private static Models.Configuration Get(Configuration? configuration)
|
||||
{
|
||||
Models.Configuration result;
|
||||
if (configuration is null)
|
||||
throw new NullReferenceException(nameof(configuration));
|
||||
if (configuration.ByCreateDateShortcut is null)
|
||||
throw new NullReferenceException(nameof(configuration.ByCreateDateShortcut));
|
||||
if (configuration.ByDay is null)
|
||||
throw new NullReferenceException(nameof(configuration.ByDay));
|
||||
if (configuration.ByHash is null)
|
||||
throw new NullReferenceException(nameof(configuration.ByHash));
|
||||
if (configuration.BySeason is null)
|
||||
throw new NullReferenceException(nameof(configuration.BySeason));
|
||||
if (configuration.ByWeek is null)
|
||||
throw new NullReferenceException(nameof(configuration.ByWeek));
|
||||
if (configuration.KeepFullPath is null)
|
||||
throw new NullReferenceException(nameof(configuration.KeepFullPath));
|
||||
if (configuration is null) throw new NullReferenceException(nameof(configuration));
|
||||
if (configuration.ByCreateDateShortcut is null) throw new NullReferenceException(nameof(configuration.ByCreateDateShortcut));
|
||||
if (configuration.ByDay is null) throw new NullReferenceException(nameof(configuration.ByDay));
|
||||
if (configuration.ByHash is null) throw new NullReferenceException(nameof(configuration.ByHash));
|
||||
if (configuration.BySeason is null) throw new NullReferenceException(nameof(configuration.BySeason));
|
||||
if (configuration.ByWeek is null) throw new NullReferenceException(nameof(configuration.ByWeek));
|
||||
if (configuration.KeepFullPath is null) throw new NullReferenceException(nameof(configuration.KeepFullPath));
|
||||
result = new(
|
||||
configuration.PropertyConfiguration,
|
||||
configuration.ByCreateDateShortcut.Value,
|
||||
@ -68,8 +60,7 @@ public class Configuration
|
||||
configuration = configurationSection.Get<Configuration>();
|
||||
}
|
||||
result = Get(configuration);
|
||||
if (configuration is null)
|
||||
throw new NullReferenceException(nameof(configuration));
|
||||
if (configuration is null) throw new NullReferenceException(nameof(configuration));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user