.editorconfig
This commit is contained in:
parent
94643d7c4d
commit
59db921a65
@ -83,6 +83,7 @@ dotnet_diagnostic.IDE0001.severity = warning # IDE0001: Simplify name
|
||||
dotnet_diagnostic.IDE0004.severity = warning # IDE0004: Cast is redundant.
|
||||
dotnet_diagnostic.IDE0002.severity = warning # Simplify (member access) - System.Version.Equals("1", "2"); Version.Equals("1", "2");
|
||||
dotnet_diagnostic.IDE0005.severity = warning # Using directive is unnecessary
|
||||
dotnet_diagnostic.IDE0031.severity = warning # Use null propagation (IDE0031)
|
||||
dotnet_diagnostic.IDE0047.severity = warning # IDE0047: Parentheses can be removed
|
||||
dotnet_diagnostic.IDE0049.severity = warning # Use language keywords instead of framework type names for type references (IDE0049)
|
||||
dotnet_diagnostic.IDE0060.severity = warning # IDE0060: Remove unused parameter
|
||||
|
1
.vscode/format-report.json
vendored
Normal file
1
.vscode/format-report.json
vendored
Normal file
@ -0,0 +1 @@
|
||||
[]
|
@ -28,14 +28,22 @@ public class AppSettings
|
||||
private static Models.AppSettings Get(AppSettings appSettings)
|
||||
{
|
||||
Models.AppSettings result;
|
||||
if (appSettings.DateFormat is null) throw new NullReferenceException(nameof(DateFormat));
|
||||
if (appSettings.Directory is null) throw new NullReferenceException(nameof(Directory));
|
||||
if (appSettings.LogFilter is null) throw new NullReferenceException(nameof(LogFilter));
|
||||
if (appSettings.MessageFilters is null) throw new NullReferenceException(nameof(MessageFilters));
|
||||
if (appSettings.MillisecondsDelay is null) throw new NullReferenceException(nameof(MillisecondsDelay));
|
||||
if (appSettings.MonitorApplicationResource is null) throw new NullReferenceException(nameof(MonitorApplicationResource));
|
||||
if (appSettings.MonitorApplicationSite is null) throw new NullReferenceException(nameof(MonitorApplicationSite));
|
||||
if (appSettings.RollingMinutes is null) throw new NullReferenceException(nameof(RollingMinutes));
|
||||
if (appSettings.DateFormat is null)
|
||||
throw new NullReferenceException(nameof(DateFormat));
|
||||
if (appSettings.Directory is null)
|
||||
throw new NullReferenceException(nameof(Directory));
|
||||
if (appSettings.LogFilter is null)
|
||||
throw new NullReferenceException(nameof(LogFilter));
|
||||
if (appSettings.MessageFilters is null)
|
||||
throw new NullReferenceException(nameof(MessageFilters));
|
||||
if (appSettings.MillisecondsDelay is null)
|
||||
throw new NullReferenceException(nameof(MillisecondsDelay));
|
||||
if (appSettings.MonitorApplicationResource is null)
|
||||
throw new NullReferenceException(nameof(MonitorApplicationResource));
|
||||
if (appSettings.MonitorApplicationSite is null)
|
||||
throw new NullReferenceException(nameof(MonitorApplicationSite));
|
||||
if (appSettings.RollingMinutes is null)
|
||||
throw new NullReferenceException(nameof(RollingMinutes));
|
||||
result = new(appSettings.DateFormat, appSettings.Directory, appSettings.LogFilter, appSettings.MessageFilters, appSettings.MonitorApplicationResource, appSettings.MonitorApplicationSite, appSettings.MillisecondsDelay.Value, appSettings.RollingMinutes.Value);
|
||||
return result;
|
||||
}
|
||||
|
26
Program.cs
26
Program.cs
@ -1,12 +1,20 @@
|
||||
using WinLog;
|
||||
|
||||
IHost host = Host.CreateDefaultBuilder(args)
|
||||
.ConfigureServices((hostContext, services) =>
|
||||
{
|
||||
_ = services.AddSingleton(WinLog.Models.Binder.AppSettings.Get(hostContext.Configuration));
|
||||
_ = services.AddHostedService<Worker>();
|
||||
})
|
||||
.UseWindowsService()
|
||||
.Build();
|
||||
internal class Program
|
||||
{
|
||||
|
||||
await host.RunAsync();
|
||||
private static async Task Main(string[] args)
|
||||
{
|
||||
IHost host = Host.CreateDefaultBuilder(args)
|
||||
.ConfigureServices((hostContext, services) =>
|
||||
{
|
||||
_ = services.AddSingleton(WinLog.Models.Binder.AppSettings.Get(hostContext.Configuration));
|
||||
_ = services.AddHostedService<Worker>();
|
||||
})
|
||||
.UseWindowsService()
|
||||
.Build();
|
||||
|
||||
await host.RunAsync();
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user