Skip to content

Commit

Permalink
* More on #79
Browse files Browse the repository at this point in the history
  • Loading branch information
PWagner1 committed Jul 3, 2024
1 parent 60b3d90 commit 70a89ab
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 34 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
Expand All @@ -21,6 +22,20 @@ public PaletteUpgradeTool()
bsaInputDirectory.Click += InputDirectory_Click;

bsaOutputDirectory.Click += OutputDirectory_Click;

kcmiOpenInExplorer.Click += OpenInExplorer_Click;
}

private void OpenInExplorer_Click(object sender, EventArgs e)
{
try
{
Process.Start("explorer.exe", klbFiles.GetItemText(klbFiles.SelectedItem));
}
catch (Exception exception)
{
KryptonMessageBox.Show($"{exception.Message}");
}
}

private void OutputDirectory_Click(object sender, EventArgs e)
Expand All @@ -41,7 +56,7 @@ private void kcmdInputDirectory_Execute(object sender, EventArgs e)

if (dialog.ShowDialog() == DialogResult.OK)
{
ktxtInputDirectory.Text = Path.GetFullPath(dialog.SelectedPath);
ktxtInputDirectory.Text = $@"{Path.GetFullPath(dialog.SelectedPath)}\";
}
}
else
Expand All @@ -52,14 +67,37 @@ private void kcmdInputDirectory_Execute(object sender, EventArgs e)

if (dialog.ShowDialog() == DialogResult.OK)
{
ktxtInputDirectory.Text = Path.GetFullPath(dialog.SelectedPath);
ktxtInputDirectory.Text = $@"{Path.GetFullPath(dialog.SelectedPath)}\";
}
}

FillListBox();
}

private void kcmdOutputDirectory_Execute(object sender, EventArgs e)
{
if (kmMain.UseKryptonFileDialogs)
{
KryptonFolderBrowserDialog dialog = new KryptonFolderBrowserDialog();

if (dialog.ShowDialog() == DialogResult.OK)
{
ktxtOutputDirectory.Text = $@"{Path.GetFullPath(dialog.SelectedPath)}\Palette Version {GlobalStaticValues.CURRENT_SUPPORTED_PALETTE_VERSION}\";
}
}
else
{
FolderBrowserDialog dialog = new FolderBrowserDialog();

dialog.ShowNewFolderButton = true;

if (dialog.ShowDialog() == DialogResult.OK)
{
ktxtOutputDirectory.Text = $@"{Path.GetFullPath(dialog.SelectedPath)}\Palette Version {GlobalStaticValues.CURRENT_SUPPORTED_PALETTE_VERSION}\";
}
}

kbtnUpgrade.Enabled = true;
}

private void kbtnOptions_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -95,6 +133,17 @@ private void ValidateOutputPath(string path)

private void ktxtInputDirectory_TextChanged(object sender, EventArgs e)
{
FillListBox();
}

private void FillListBox()
{
// Clear list box first
if (klbFiles.Items.Count > 0)
{
klbFiles.Items.Clear();
}

if (ktxtInputDirectory.Text.EndsWith("\\"))
{
// Fill listbox
Expand All @@ -104,5 +153,10 @@ private void ktxtInputDirectory_TextChanged(object sender, EventArgs e)
}
}
}

private void kbtnCancel_Click(object sender, EventArgs e)
{
Close();
}
}
}

0 comments on commit 70a89ab

Please sign in to comment.