Ready to beta test
This commit is contained in:
59
classlib/Binder/AppSettings.cs
Normal file
59
classlib/Binder/AppSettings.cs
Normal file
@ -0,0 +1,59 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Mesa_Backlog.Library.Binder;
|
||||
|
||||
public class AppSettings
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
public Client Client { get; set; }
|
||||
public string Company { get; set; }
|
||||
public Excel Excel { get; set; }
|
||||
public string WorkingDirectoryName { get; set; }
|
||||
public string URLs { get; set; }
|
||||
|
||||
#nullable restore
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
||||
return result;
|
||||
}
|
||||
|
||||
private static Library.AppSettings Get(AppSettings appSettings)
|
||||
{
|
||||
Library.AppSettings result;
|
||||
Library.Client client = new(
|
||||
appSettings.Client.API,
|
||||
appSettings.Client.BaseAddress,
|
||||
appSettings.Client.BasePage,
|
||||
appSettings.Client.PAT,
|
||||
appSettings.Client.Project,
|
||||
appSettings.Client.Query
|
||||
);
|
||||
Library.Excel excel = new(
|
||||
appSettings.Excel.Sheet,
|
||||
appSettings.Excel.SourceFile,
|
||||
appSettings.Excel.TargetFile
|
||||
);
|
||||
result = new(
|
||||
client,
|
||||
appSettings.Company,
|
||||
excel,
|
||||
appSettings.WorkingDirectoryName,
|
||||
appSettings.URLs
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Library.AppSettings Get(IConfigurationRoot configurationRoot)
|
||||
{
|
||||
Library.AppSettings result;
|
||||
AppSettings appSettings = configurationRoot.Get<AppSettings>();
|
||||
result = Get(appSettings);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
48
classlib/Binder/Client.cs
Normal file
48
classlib/Binder/Client.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Mesa_Backlog.Library.Binder;
|
||||
|
||||
public class Client
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
public string API { get; set; }
|
||||
public string BaseAddress { get; set; }
|
||||
public string BasePage { get; set; }
|
||||
public string PAT { get; set; }
|
||||
public string Project { get; set; }
|
||||
public string Query { get; set; }
|
||||
|
||||
#nullable restore
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
||||
return result;
|
||||
}
|
||||
|
||||
private static Library.Client Get(Client client)
|
||||
{
|
||||
Library.Client result;
|
||||
result = new(
|
||||
client.API,
|
||||
client.BaseAddress,
|
||||
client.BasePage,
|
||||
client.PAT,
|
||||
client.Project,
|
||||
client.Query
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Library.Client Get(IConfigurationRoot configurationRoot)
|
||||
{
|
||||
Library.Client result;
|
||||
Client client = configurationRoot.Get<Client>();
|
||||
result = Get(client);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
42
classlib/Binder/Excel.cs
Normal file
42
classlib/Binder/Excel.cs
Normal file
@ -0,0 +1,42 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Mesa_Backlog.Library.Binder;
|
||||
|
||||
public class Excel
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
public string Sheet { get; set; }
|
||||
public string SourceFile { get; set; }
|
||||
public string TargetFile { get; set; }
|
||||
|
||||
#nullable restore
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
||||
return result;
|
||||
}
|
||||
|
||||
private static Library.Excel Get(Excel excel)
|
||||
{
|
||||
Library.Excel result;
|
||||
result = new(
|
||||
excel.Sheet,
|
||||
excel.SourceFile,
|
||||
excel.TargetFile
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Library.Excel Get(IConfigurationRoot configurationRoot)
|
||||
{
|
||||
Library.Excel result;
|
||||
Excel excel = configurationRoot.Get<Excel>();
|
||||
result = Get(excel);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user