|
|
|
@ -6,11 +6,12 @@ using System.Globalization;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Text.Json;
|
|
|
|
|
using View_by_Distance.Drag_Drop_Explorer.Models;
|
|
|
|
|
using View_by_Distance.Shared.Models;
|
|
|
|
|
using View_by_Distance.Shared.Models.Stateless.Methods;
|
|
|
|
|
|
|
|
|
|
namespace View_by_Distance.Drag_Drop_Explorer;
|
|
|
|
|
|
|
|
|
|
public partial class Form : System.Windows.Forms.Form
|
|
|
|
|
public partial class DragDropExplorer : Form
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
private readonly ILogger _Logger;
|
|
|
|
@ -23,7 +24,7 @@ public partial class Form : System.Windows.Forms.Form
|
|
|
|
|
private readonly string _WorkingDirectory;
|
|
|
|
|
private readonly IsEnvironment _IsEnvironment;
|
|
|
|
|
|
|
|
|
|
public Form()
|
|
|
|
|
public DragDropExplorer()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
ILogger logger;
|
|
|
|
@ -48,17 +49,17 @@ public partial class Form : System.Windows.Forms.Form
|
|
|
|
|
Environment.SetEnvironmentVariable(nameof(workingDirectory), workingDirectory);
|
|
|
|
|
_ = ConfigurationLoggerConfigurationExtensions.Configuration(loggerConfiguration.ReadFrom, configurationRoot);
|
|
|
|
|
Log.Logger = loggerConfiguration.CreateLogger();
|
|
|
|
|
logger = Log.ForContext<Form>();
|
|
|
|
|
logger = Log.ForContext<DragDropExplorer>();
|
|
|
|
|
logger.Information("Complete");
|
|
|
|
|
_Logger = logger;
|
|
|
|
|
_AppSettings = appSettings;
|
|
|
|
|
Text = "Drag Drop Explorer";
|
|
|
|
|
_IsEnvironment = isEnvironment;
|
|
|
|
|
_WorkingDirectory = workingDirectory;
|
|
|
|
|
_ProgressBar = new() { Location = new(5, 5), Dock = DockStyle.Top, Visible = false };
|
|
|
|
|
_FirstTextBox = new() { Location = new(5, 5), Dock = DockStyle.Top, Text = _IsEnvironment.Profile };
|
|
|
|
|
_PathTextBox = new() { Location = new(5, 5), Dock = DockStyle.Top, Text = _AppSettings.WorkingDirectoryName };
|
|
|
|
|
_JsonTextBox = new() { Location = new(5, 5), Dock = DockStyle.Top, Text = JsonSerializer.Serialize(_AppSettings, new JsonSerializerOptions { WriteIndented = true }), Multiline = true, MinimumSize = new(1, 80) };
|
|
|
|
|
_ProgressBar = new() { TabIndex = 4, Location = new(5, 5), Dock = DockStyle.Top, Visible = false };
|
|
|
|
|
string json = JsonSerializer.Serialize(_AppSettings, new JsonSerializerOptions { WriteIndented = true });
|
|
|
|
|
_FirstTextBox = new() { TabIndex = 1, Text = _IsEnvironment.Profile, Location = new(5, 5), Dock = DockStyle.Top };
|
|
|
|
|
_PathTextBox = new() { TabIndex = 2, Text = _AppSettings.WorkingDirectoryName, Location = new(5, 5), Dock = DockStyle.Top };
|
|
|
|
|
_JsonTextBox = new() { TabIndex = 3, Text = json, Multiline = true, MinimumSize = new(1, 80), Location = new(5, 5), Dock = DockStyle.Top };
|
|
|
|
|
Load += new EventHandler(Form1_Load);
|
|
|
|
|
Controls.Add(_ProgressBar);
|
|
|
|
|
Controls.Add(_JsonTextBox);
|
|
|
|
@ -94,6 +95,7 @@ public partial class Form : System.Windows.Forms.Form
|
|
|
|
|
{
|
|
|
|
|
if (sender is TextBox textBox)
|
|
|
|
|
{
|
|
|
|
|
textBox.Text = GetConverted(textBox.Text);
|
|
|
|
|
if (textBox.Text == "ps")
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
|
|
|
|
@ -133,10 +135,10 @@ public partial class Form : System.Windows.Forms.Form
|
|
|
|
|
{
|
|
|
|
|
string converted;
|
|
|
|
|
FileInfo fileInfo;
|
|
|
|
|
_FirstTextBox.Text = paths[0];
|
|
|
|
|
List<MatchNginx> files = new();
|
|
|
|
|
DateTime dateTime = DateTime.Now;
|
|
|
|
|
List<MatchNginx> directories = new();
|
|
|
|
|
_FirstTextBox.Text = GetConverted(paths[0]);
|
|
|
|
|
string weekOfYear = _Calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
|
|
|
|
string directory = Path.Combine(_WorkingDirectory, $"{dateTime.Year}_{weekOfYear}");
|
|
|
|
|
if (!Directory.Exists(directory))
|