Drag-Drop-Explorer

This commit is contained in:
2023-01-02 14:58:22 -07:00
parent 110b306206
commit d0cd52807d
52 changed files with 1092 additions and 846 deletions

View File

@ -1,6 +1,6 @@
namespace View_by_Distance.Drag_Drop_Explorer;
partial class Form
partial class DragDropExplorer
{
/// <summary>
/// Required designer variable.
@ -32,7 +32,7 @@ partial class Form
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(640, 100);
this.StartPosition = FormStartPosition.CenterScreen;
this.Text = "Form1";
this.Text = "Drag Drop Explorer";
}
#endregion

View File

@ -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))

View File

@ -1,4 +0,0 @@
namespace View_by_Distance.Drag_Drop_Explorer;
public record MatchNginx(string Name, string Type, DateTime MTime, long Size, string ConvertedPath)
{ }

View File

@ -9,7 +9,7 @@ static class Program
static void Main()
{
ApplicationConfiguration.Initialize();
Application.Run(new Form());
Application.Run(new DragDropExplorer());
}
}