remove appsettings

This commit is contained in:
2023-10-19 22:28:40 -07:00
parent 9a525b44cc
commit b985898ab2
19 changed files with 246 additions and 411 deletions

View File

@ -1,4 +1,3 @@
using System.ComponentModel.DataAnnotations;
using System.Text.Json;
namespace Barcode.Host.Server.Models.Binder;
@ -6,34 +5,32 @@ namespace Barcode.Host.Server.Models.Binder;
public class AppSettings
{
[Display(Name = "Build Number"), Required] public string? BuildNumber { get; set; }
[Display(Name = "Build Source Version"), Required] public string? BuildSourceVersion { get; set; }
[Display(Name = "Last Scan Service Clear After"), Required] public int? ClearLastScanServiceAfter { get; set; }
[Display(Name = "Company"), Required] public string? Company { get; set; }
[Display(Name = "Device Name Ends With"), Required] public string? DeviceNameEndsWith { get; set; }
[Display(Name = "Equipment Name"), Required] public string? EquipmentName { get; set; }
[Display(Name = "ExpectedScanLengthA"), Required] public int? ExpectedScanLengthA { get; set; }
[Display(Name = "ExpectedScanLengthB"), Required] public int? ExpectedScanLengthB { get; set; }
[Display(Name = "File Share"), Required] public string? FileShare { get; set; }
[Display(Name = "Is Development"), Required] public bool? IsDevelopment { get; set; }
[Display(Name = "Is Staging"), Required] public bool? IsStaging { get; set; }
[Display(Name = "Linux Device Path"), Required] public string? LinuxDevicePath { get; set; }
[Display(Name = "Mock Root"), Required] public string? MockRoot { get; set; }
[Display(Name = "MonA Resource"), Required] public string? MonAResource { get; set; }
[Display(Name = "MonA Site"), Required] public string? MonASite { get; set; }
[Display(Name = "Notify Minimum"), Required] public int? NotifyMinimum { get; set; }
[Display(Name = "OpenInsight Application Programming Interface"), Required] public string? OpenInsightApplicationProgrammingInterface { get; set; }
[Display(Name = "PostTo"), Required] public string? PostTo { get; set; }
[Display(Name = "Post to Every"), Required] public int? PostToEvery { get; set; }
[Display(Name = "RootPassword"), Required] public string? RootPassword { get; set; }
[Display(Name = "Serial Port Name"), Required] public string? SerialPortName { get; set; }
[Display(Name = "Share to Every"), Required] public int? ShareToEvery { get; set; }
[Display(Name = "ToolClass"), Required] public string? ToolClass { get; set; }
[Display(Name = "URLs"), Required] public string? URLs { get; set; }
[Display(Name = "Working Directory Name"), Required] public string? WorkingDirectoryName { get; set; }
[Display(Name = "WriteToSerialEvery"), Required] public int? WriteToSerialEvery { get; set; }
#nullable restore
public string? BuildNumber { get; set; }
public string? BuildSourceVersion { get; set; }
public int? ClearLastScanServiceAfter { get; set; }
public string? Company { get; set; }
public string? DeviceNameEndsWith { get; set; }
public string? EquipmentName { get; set; }
public int? ExpectedScanLengthA { get; set; }
public int? ExpectedScanLengthB { get; set; }
public string? FileShare { get; set; }
public bool? IsDevelopment { get; set; }
public bool? IsStaging { get; set; }
public string? LinuxDevicePath { get; set; }
public string? MockRoot { get; set; }
public string? MonAResource { get; set; }
public string? MonASite { get; set; }
public int? NotifyMinimum { get; set; }
public string? OpenInsightApplicationProgrammingInterface { get; set; }
public string? PostTo { get; set; }
public int? PostToEvery { get; set; }
public string? RootPassword { get; set; }
public string? SerialPortName { get; set; }
public int? ShareToEvery { get; set; }
public string? ToolClass { get; set; }
public string? URLs { get; set; }
public string? WorkingDirectoryName { get; set; }
public int? WriteToSerialEvery { get; set; }
public override string ToString()
{
@ -44,60 +41,33 @@ public class AppSettings
private static Models.AppSettings Get(AppSettings? appSettings)
{
Models.AppSettings result;
if (appSettings is null)
throw new NullReferenceException(nameof(appSettings));
if (appSettings.BuildNumber is null)
throw new NullReferenceException(nameof(BuildNumber));
if (appSettings.BuildSourceVersion is null)
throw new NullReferenceException(nameof(BuildSourceVersion));
if (appSettings.ClearLastScanServiceAfter is null)
throw new NullReferenceException(nameof(ClearLastScanServiceAfter));
if (appSettings.Company is null)
throw new NullReferenceException(nameof(Company));
if (appSettings.DeviceNameEndsWith is null)
throw new NullReferenceException(nameof(DeviceNameEndsWith));
if (appSettings.EquipmentName is null)
throw new NullReferenceException(nameof(EquipmentName));
if (appSettings.ExpectedScanLengthA is null)
throw new NullReferenceException(nameof(ExpectedScanLengthA));
if (appSettings.ExpectedScanLengthB is null)
throw new NullReferenceException(nameof(ExpectedScanLengthB));
if (appSettings.FileShare is null)
throw new NullReferenceException(nameof(FileShare));
if (appSettings.IsDevelopment is null)
throw new NullReferenceException(nameof(IsDevelopment));
if (appSettings.IsStaging is null)
throw new NullReferenceException(nameof(IsStaging));
if (appSettings.LinuxDevicePath is null)
throw new NullReferenceException(nameof(LinuxDevicePath));
if (appSettings.MockRoot is null)
throw new NullReferenceException(nameof(MockRoot));
if (appSettings.MonAResource is null)
throw new NullReferenceException(nameof(MonAResource));
if (appSettings.MonASite is null)
throw new NullReferenceException(nameof(MonASite));
if (appSettings.NotifyMinimum is null)
throw new NullReferenceException(nameof(NotifyMinimum));
if (appSettings.OpenInsightApplicationProgrammingInterface is null)
throw new NullReferenceException(nameof(OpenInsightApplicationProgrammingInterface));
if (appSettings.PostTo is null)
throw new NullReferenceException(nameof(PostTo));
if (appSettings.PostToEvery is null)
throw new NullReferenceException(nameof(PostToEvery));
if (appSettings.RootPassword is null)
throw new NullReferenceException(nameof(RootPassword));
if (appSettings.SerialPortName is null)
throw new NullReferenceException(nameof(SerialPortName));
if (appSettings.ShareToEvery is null)
throw new NullReferenceException(nameof(ShareToEvery));
if (appSettings.ToolClass is null)
throw new NullReferenceException(nameof(ToolClass));
if (appSettings.URLs is null)
throw new NullReferenceException(nameof(URLs));
if (appSettings.WorkingDirectoryName is null)
throw new NullReferenceException(nameof(WorkingDirectoryName));
if (appSettings.WriteToSerialEvery is null)
throw new NullReferenceException(nameof(WriteToSerialEvery));
if (appSettings is null) throw new NullReferenceException(nameof(appSettings));
if (appSettings.BuildNumber is null) throw new NullReferenceException(nameof(BuildNumber));
if (appSettings.BuildSourceVersion is null) throw new NullReferenceException(nameof(BuildSourceVersion));
if (appSettings.ClearLastScanServiceAfter is null) throw new NullReferenceException(nameof(ClearLastScanServiceAfter));
if (appSettings.Company is null) throw new NullReferenceException(nameof(Company));
if (appSettings.DeviceNameEndsWith is null) throw new NullReferenceException(nameof(DeviceNameEndsWith));
if (appSettings.EquipmentName is null) throw new NullReferenceException(nameof(EquipmentName));
if (appSettings.ExpectedScanLengthA is null) throw new NullReferenceException(nameof(ExpectedScanLengthA));
if (appSettings.ExpectedScanLengthB is null) throw new NullReferenceException(nameof(ExpectedScanLengthB));
if (appSettings.FileShare is null) throw new NullReferenceException(nameof(FileShare));
if (appSettings.IsDevelopment is null) throw new NullReferenceException(nameof(IsDevelopment));
if (appSettings.IsStaging is null) throw new NullReferenceException(nameof(IsStaging));
if (appSettings.LinuxDevicePath is null) throw new NullReferenceException(nameof(LinuxDevicePath));
if (appSettings.MockRoot is null) throw new NullReferenceException(nameof(MockRoot));
if (appSettings.MonAResource is null) throw new NullReferenceException(nameof(MonAResource));
if (appSettings.MonASite is null) throw new NullReferenceException(nameof(MonASite));
if (appSettings.NotifyMinimum is null) throw new NullReferenceException(nameof(NotifyMinimum));
if (appSettings.OpenInsightApplicationProgrammingInterface is null) throw new NullReferenceException(nameof(OpenInsightApplicationProgrammingInterface));
if (appSettings.PostTo is null) throw new NullReferenceException(nameof(PostTo));
if (appSettings.PostToEvery is null) throw new NullReferenceException(nameof(PostToEvery));
if (appSettings.RootPassword is null) throw new NullReferenceException(nameof(RootPassword));
if (appSettings.SerialPortName is null) throw new NullReferenceException(nameof(SerialPortName));
if (appSettings.ShareToEvery is null) throw new NullReferenceException(nameof(ShareToEvery));
if (appSettings.ToolClass is null) throw new NullReferenceException(nameof(ToolClass));
if (appSettings.URLs is null) throw new NullReferenceException(nameof(URLs));
if (appSettings.WorkingDirectoryName is null) throw new NullReferenceException(nameof(WorkingDirectoryName));
if (appSettings.WriteToSerialEvery is null) throw new NullReferenceException(nameof(WriteToSerialEvery));
result = new(
appSettings.BuildNumber,
appSettings.BuildSourceVersion,