Add MonIn Send Status
This commit is contained in:
@ -6,49 +6,38 @@ namespace OI.Metrology.Tests.Models;
|
||||
public class AppSettings
|
||||
{
|
||||
|
||||
protected string _ApiLoggingContentTypes;
|
||||
protected string _ApiLoggingPathPrefixes;
|
||||
protected string _ApiLogPath;
|
||||
protected string _AttachmentPath;
|
||||
protected string _BuildNumber;
|
||||
protected string _Company;
|
||||
protected string _ConnectionString;
|
||||
protected string _GitCommitSeven;
|
||||
protected string _InboundApiAllowedIPList;
|
||||
protected string _MonARessource;
|
||||
protected string _OIExportPath;
|
||||
protected string _URLs;
|
||||
protected string _WorkingDirectoryName;
|
||||
public string ApiLoggingContentTypes => _ApiLoggingContentTypes;
|
||||
public string ApiLoggingPathPrefixes => _ApiLoggingPathPrefixes;
|
||||
public string ApiLogPath => _ApiLogPath;
|
||||
public string AttachmentPath => _AttachmentPath;
|
||||
public string BuildNumber => _BuildNumber;
|
||||
public string Company => _Company;
|
||||
public string ConnectionString => _ConnectionString;
|
||||
public string GitCommitSeven => _GitCommitSeven;
|
||||
public string InboundApiAllowedIPList => _InboundApiAllowedIPList;
|
||||
public string MonARessource => _MonARessource;
|
||||
public string OIExportPath => _OIExportPath;
|
||||
public string URLs => _URLs;
|
||||
public string WorkingDirectoryName => _WorkingDirectoryName;
|
||||
public string ApiLoggingContentTypes { init; get; }
|
||||
public string ApiLoggingPathPrefixes { init; get; }
|
||||
public string ApiLogPath { init; get; }
|
||||
public string AttachmentPath { init; get; }
|
||||
public string BuildNumber { init; get; }
|
||||
public string Company { init; get; }
|
||||
public string ConnectionString { init; get; }
|
||||
public string GitCommitSeven { init; get; }
|
||||
public string InboundApiAllowedIPList { init; get; }
|
||||
public string MonAResource { init; get; }
|
||||
public string MonASite { init; get; }
|
||||
public string OIExportPath { init; get; }
|
||||
public string URLs { init; get; }
|
||||
public string WorkingDirectoryName { init; get; }
|
||||
|
||||
[JsonConstructor]
|
||||
public AppSettings(string apiLoggingContentTypes, string apiLoggingPathPrefixes, string apiLogPath, string attachmentPath, string buildNumber, string company, string connectionString, string gitCommitSeven, string inboundApiAllowedIPList, string monARessource, string oiExportPath, string urls, string workingDirectoryName)
|
||||
public AppSettings(string apiLoggingContentTypes, string apiLoggingPathPrefixes, string apiLogPath, string attachmentPath, string buildNumber, string company, string connectionString, string gitCommitSeven, string inboundApiAllowedIPList, string monAResource, string monASite, string oiExportPath, string urls, string workingDirectoryName)
|
||||
{
|
||||
_ApiLoggingContentTypes = apiLoggingContentTypes;
|
||||
_ApiLoggingPathPrefixes = apiLoggingPathPrefixes;
|
||||
_ApiLogPath = apiLogPath;
|
||||
_AttachmentPath = attachmentPath;
|
||||
_BuildNumber = buildNumber;
|
||||
_Company = company;
|
||||
_ConnectionString = connectionString;
|
||||
_GitCommitSeven = gitCommitSeven;
|
||||
_InboundApiAllowedIPList = inboundApiAllowedIPList;
|
||||
_MonARessource = monARessource;
|
||||
_OIExportPath = oiExportPath;
|
||||
_URLs = urls;
|
||||
_WorkingDirectoryName = workingDirectoryName;
|
||||
ApiLoggingContentTypes = apiLoggingContentTypes;
|
||||
ApiLoggingPathPrefixes = apiLoggingPathPrefixes;
|
||||
ApiLogPath = apiLogPath;
|
||||
AttachmentPath = attachmentPath;
|
||||
BuildNumber = buildNumber;
|
||||
Company = company;
|
||||
ConnectionString = connectionString;
|
||||
GitCommitSeven = gitCommitSeven;
|
||||
InboundApiAllowedIPList = inboundApiAllowedIPList;
|
||||
MonAResource = monAResource;
|
||||
MonASite = monASite;
|
||||
OIExportPath = oiExportPath;
|
||||
URLs = urls;
|
||||
WorkingDirectoryName = workingDirectoryName;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
@ -1,3 +1,4 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json;
|
||||
|
||||
@ -6,6 +7,8 @@ namespace OI.Metrology.Tests.Models.Binder;
|
||||
public class AppSettings
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
[Display(Name = "Api Logging Content Types"), Required] public string ApiLoggingContentTypes { get; set; }
|
||||
[Display(Name = "Api Logging Path Prefixes"), Required] public string ApiLoggingPathPrefixes { get; set; }
|
||||
[Display(Name = "Api Log Path"), Required] public string ApiLogPath { get; set; }
|
||||
@ -15,27 +18,13 @@ public class AppSettings
|
||||
[Display(Name = "Connection String"), Required] public string ConnectionString { get; set; }
|
||||
[Display(Name = "Git Commit Seven"), Required] public string GitCommitSeven { get; set; }
|
||||
[Display(Name = "Inbound Api Allowed IP List"), Required] public string InboundApiAllowedIPList { get; set; }
|
||||
[Display(Name = "MonA Ressource"), Required] public string MonARessource { get; set; }
|
||||
[Display(Name = "MonA Resource"), Required] public string MonAResource { get; set; }
|
||||
[Display(Name = "MonA Site"), Required] public string MonASite { get; set; }
|
||||
[Display(Name = "OI Export Path"), Required] public string OIExportPath { get; set; }
|
||||
[Display(Name = "URLs"), Required] public string URLs { get; set; }
|
||||
[Display(Name = "Working Directory Name"), Required] public string WorkingDirectoryName { get; set; }
|
||||
|
||||
public AppSettings()
|
||||
{
|
||||
ApiLoggingContentTypes = string.Empty;
|
||||
ApiLoggingPathPrefixes = string.Empty;
|
||||
ApiLogPath = string.Empty;
|
||||
AttachmentPath = string.Empty;
|
||||
BuildNumber = string.Empty;
|
||||
Company = string.Empty;
|
||||
ConnectionString = string.Empty;
|
||||
GitCommitSeven = string.Empty;
|
||||
InboundApiAllowedIPList = string.Empty;
|
||||
MonARessource = string.Empty;
|
||||
OIExportPath = string.Empty;
|
||||
URLs = string.Empty;
|
||||
WorkingDirectoryName = string.Empty;
|
||||
}
|
||||
#nullable restore
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
@ -43,4 +32,33 @@ public class AppSettings
|
||||
return result;
|
||||
}
|
||||
|
||||
private static Models.AppSettings Get(AppSettings appSettings)
|
||||
{
|
||||
Models.AppSettings result;
|
||||
result = new(
|
||||
appSettings.ApiLoggingContentTypes,
|
||||
appSettings.ApiLoggingPathPrefixes,
|
||||
appSettings.ApiLogPath,
|
||||
appSettings.AttachmentPath,
|
||||
appSettings.BuildNumber,
|
||||
appSettings.Company,
|
||||
appSettings.ConnectionString,
|
||||
appSettings.GitCommitSeven,
|
||||
appSettings.InboundApiAllowedIPList,
|
||||
appSettings.MonAResource,
|
||||
appSettings.MonASite,
|
||||
appSettings.OIExportPath,
|
||||
appSettings.URLs,
|
||||
appSettings.WorkingDirectoryName);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Models.AppSettings Get(IConfigurationRoot configurationRoot)
|
||||
{
|
||||
Models.AppSettings result;
|
||||
AppSettings appSettings = configurationRoot.Get<AppSettings>();
|
||||
result = Get(appSettings);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace OI.Metrology.Tests.Models.Stateless;
|
||||
|
||||
public abstract class AppSettings
|
||||
{
|
||||
|
||||
#nullable enable
|
||||
|
||||
public static Models.AppSettings Get(IConfigurationRoot configurationRoot)
|
||||
{
|
||||
Models.AppSettings? result;
|
||||
Binder.AppSettings appSettings = configurationRoot.Get<Binder.AppSettings>();
|
||||
string json = JsonSerializer.Serialize(appSettings, new JsonSerializerOptions() { WriteIndented = true });
|
||||
result = JsonSerializer.Deserialize<Models.AppSettings>(json);
|
||||
if (result is null)
|
||||
throw new Exception(json);
|
||||
if (string.IsNullOrEmpty(result.Company))
|
||||
throw new Exception(json);
|
||||
string jsonThis = result.ToString();
|
||||
if (jsonThis != json)
|
||||
{
|
||||
int? check = null;
|
||||
int min = new int[] { json.Length, jsonThis.Length }.Min();
|
||||
for (int i = 0; i < min; i++)
|
||||
{
|
||||
if (json[i] == jsonThis[i])
|
||||
continue;
|
||||
check = i;
|
||||
break;
|
||||
}
|
||||
if (check is null)
|
||||
throw new Exception();
|
||||
string a = json[..check.Value].Split(',')[^1];
|
||||
string b = json[check.Value..].Split(',')[0];
|
||||
throw new Exception($"{a}{b}");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user