.editorconfig
This commit is contained in:
		| @ -83,6 +83,7 @@ dotnet_diagnostic.IDE0001.severity = warning # IDE0001: Simplify name | |||||||
| dotnet_diagnostic.IDE0004.severity = warning # IDE0004: Cast is redundant. | 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.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.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.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.IDE0049.severity = warning # Use language keywords instead of framework type names for type references (IDE0049) | ||||||
| dotnet_diagnostic.IDE0060.severity = warning # IDE0060: Remove unused parameter | 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) |     private static Models.AppSettings Get(AppSettings appSettings) | ||||||
|     { |     { | ||||||
|         Models.AppSettings result; |         Models.AppSettings result; | ||||||
|         if (appSettings.DateFormat is null) throw new NullReferenceException(nameof(DateFormat)); |         if (appSettings.DateFormat is null) | ||||||
|         if (appSettings.Directory is null) throw new NullReferenceException(nameof(Directory)); |             throw new NullReferenceException(nameof(DateFormat)); | ||||||
|         if (appSettings.LogFilter is null) throw new NullReferenceException(nameof(LogFilter)); |         if (appSettings.Directory is null) | ||||||
|         if (appSettings.MessageFilters is null) throw new NullReferenceException(nameof(MessageFilters)); |             throw new NullReferenceException(nameof(Directory)); | ||||||
|         if (appSettings.MillisecondsDelay is null) throw new NullReferenceException(nameof(MillisecondsDelay)); |         if (appSettings.LogFilter is null) | ||||||
|         if (appSettings.MonitorApplicationResource is null) throw new NullReferenceException(nameof(MonitorApplicationResource)); |             throw new NullReferenceException(nameof(LogFilter)); | ||||||
|         if (appSettings.MonitorApplicationSite is null) throw new NullReferenceException(nameof(MonitorApplicationSite)); |         if (appSettings.MessageFilters is null) | ||||||
|         if (appSettings.RollingMinutes is null) throw new NullReferenceException(nameof(RollingMinutes)); |             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); |         result = new(appSettings.DateFormat, appSettings.Directory, appSettings.LogFilter, appSettings.MessageFilters, appSettings.MonitorApplicationResource, appSettings.MonitorApplicationSite, appSettings.MillisecondsDelay.Value, appSettings.RollingMinutes.Value); | ||||||
|         return result; |         return result; | ||||||
|     } |     } | ||||||
|  | |||||||
							
								
								
									
										26
									
								
								Program.cs
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								Program.cs
									
									
									
									
									
								
							| @ -1,12 +1,20 @@ | |||||||
| using WinLog; | using WinLog; | ||||||
|  |  | ||||||
| IHost host = Host.CreateDefaultBuilder(args) | internal class Program | ||||||
|     .ConfigureServices((hostContext, services) => | { | ||||||
|     { |  | ||||||
|         _ = services.AddSingleton(WinLog.Models.Binder.AppSettings.Get(hostContext.Configuration)); |  | ||||||
|         _ = services.AddHostedService<Worker>(); |  | ||||||
|     }) |  | ||||||
|     .UseWindowsService() |  | ||||||
|     .Build(); |  | ||||||
|  |  | ||||||
| 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(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  | } | ||||||
		Reference in New Issue
	
	Block a user