This commit is contained in:
2023-10-15 12:13:48 -07:00
parent cd5ab223c9
commit 37b7ad2a1f
102 changed files with 631 additions and 975 deletions

View File

@ -1,6 +1,5 @@
using Microsoft.Extensions.Configuration;
using Phares.Shared;
using Serilog;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
@ -14,7 +13,6 @@ namespace View_by_Distance.Drag_Drop_Explorer;
public partial class DragDropExplorer : Form
{
private readonly ILogger _Logger;
private readonly Calendar _Calendar;
private readonly TextBox _PathTextBox;
private readonly TextBox _JsonTextBox;
@ -27,13 +25,11 @@ public partial class DragDropExplorer : Form
public DragDropExplorer()
{
InitializeComponent();
ILogger logger;
AppSettings appSettings;
string workingDirectory;
IsEnvironment isEnvironment;
IConfigurationRoot configurationRoot;
_Calendar = new CultureInfo("en-US").Calendar;
LoggerConfiguration loggerConfiguration = new();
Assembly assembly = Assembly.GetExecutingAssembly();
bool debuggerWasAttachedAtLineZero = Debugger.IsAttached || assembly.Location.Contains(@"\bin\Debug");
isEnvironment = new(processesCount: null, nullASPNetCoreEnvironmentIsDevelopment: debuggerWasAttachedAtLineZero, nullASPNetCoreEnvironmentIsProduction: !debuggerWasAttachedAtLineZero);
@ -48,11 +44,6 @@ public partial class DragDropExplorer : Form
throw new Exception("Working path name must have parentDirectory value!");
workingDirectory = IWorkingDirectory.GetWorkingDirectory(assembly.GetName().Name, appSettings.WorkingDirectoryName);
Environment.SetEnvironmentVariable(nameof(workingDirectory), workingDirectory);
_ = ConfigurationLoggerConfigurationExtensions.Configuration(loggerConfiguration.ReadFrom, configurationRoot);
Log.Logger = loggerConfiguration.CreateLogger();
logger = Log.ForContext<DragDropExplorer>();
logger.Information("Complete");
_Logger = logger;
_AppSettings = appSettings;
_IsEnvironment = isEnvironment;
_WorkingDirectory = workingDirectory;
@ -130,7 +121,6 @@ public partial class DragDropExplorer : Form
_FirstTextBox.Text = string.Empty;
_PathTextBox.Text = string.Empty;
_JsonTextBox.Text = string.Empty;
_Logger.Information("No data");
}
else
{