mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-07-07 10:48:28 +00:00
Several small Audio Editor fixes
This commit is contained in:
@@ -63,6 +63,7 @@ namespace PckStudio.Forms.Editor
|
||||
this.treeView1.LabelEdit = true;
|
||||
this.treeView1.Name = "treeView1";
|
||||
this.treeView1.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterSelect);
|
||||
this.treeView1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.treeView1_KeyDown);
|
||||
//
|
||||
// contextMenuStrip1
|
||||
//
|
||||
|
||||
@@ -245,6 +245,12 @@ namespace PckStudio.Forms.Editor
|
||||
}
|
||||
}
|
||||
|
||||
private void treeView1_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Delete)
|
||||
removeCategoryStripMenuItem_Click(sender, e);
|
||||
}
|
||||
|
||||
public void treeView2_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Delete)
|
||||
@@ -253,13 +259,10 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
private void removeEntryMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (treeView1.SelectedNode is TreeNode main &&
|
||||
treeView2.SelectedNode is TreeNode sub &&
|
||||
sub.Tag is string s &&
|
||||
main.Tag is PCKAudioFile.AudioCategory category)
|
||||
if (treeView2.SelectedNode != null && treeView1.SelectedNode.Tag is PCKAudioFile.AudioCategory category)
|
||||
{
|
||||
if (category.SongNames.Remove(s))
|
||||
sub.Remove();
|
||||
category.SongNames.Remove(treeView2.SelectedNode.Text);
|
||||
treeView2.SelectedNode.Remove();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,11 +276,15 @@ namespace PckStudio.Forms.Editor
|
||||
bool duplicate_song = false; // To handle if a file already in the pack is dropped back in
|
||||
if (File.Exists(new_loc))
|
||||
{
|
||||
duplicate_song = File.ReadAllBytes(file).Length == File.ReadAllBytes(new_loc).Length;
|
||||
if (!duplicate_song)
|
||||
duplicate_song = File.ReadAllBytes(file) == File.ReadAllBytes(new_loc);
|
||||
if (duplicate_song)
|
||||
{
|
||||
DialogResult user_prompt = MessageBox.Show("\"" + Path.GetFileNameWithoutExtension(file) + ".binka\" already exists. Continuing will replace the existing file. Are you sure you want to continue moving the file? By pressing no, you will skip this file. You can also cancel all pending file operations.", "File already exists", MessageBoxButtons.YesNoCancel);
|
||||
if (user_prompt == DialogResult.Cancel) break;
|
||||
DialogResult user_prompt = MessageBox.Show("\"" + Path.GetFileNameWithoutExtension(file) + ".binka\" already exists. Continuing will replace the existing file. Are you sure you want to continue moving the file? By pressing no, the song entry will be added without moving the file. You can also cancel this operation and all files in queue.", "File already exists", MessageBoxButtons.YesNoCancel);
|
||||
while (user_prompt == DialogResult.None) ; // Stops the editor from adding or processing the file until the user had made their choice
|
||||
if (user_prompt == DialogResult.Cancel)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (user_prompt == DialogResult.No) continue;
|
||||
}
|
||||
}
|
||||
@@ -328,9 +335,9 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
private void Binka_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (treeView1.SelectedNode is TreeNode t && t.Tag is PCKFile.FileData &&
|
||||
// Gets the MainForm so we can access the Save Location
|
||||
Owner.Owner is MainForm parent)
|
||||
//MessageBox.Show((Owner.Owner as MainForm).saveLocation);
|
||||
// Gets the MainForm so we can access the Save Location
|
||||
if (treeView1.SelectedNode != null && Owner.Owner is MainForm parent)
|
||||
{
|
||||
string DataDirectory = Path.Combine(Path.GetDirectoryName(parent.saveLocation), "Data");
|
||||
if (!Directory.Exists(DataDirectory))
|
||||
@@ -349,7 +356,7 @@ namespace PckStudio.Forms.Editor
|
||||
!audioFile.HasCategory(PCKAudioFile.AudioCategory.EAudioType.Nether) ||
|
||||
!audioFile.HasCategory(PCKAudioFile.AudioCategory.EAudioType.End))
|
||||
{
|
||||
MessageBox.Show("The game will crash upon loading your pack if the Overworld, Nether and End categories don't all exist.", "Mandatory Categories Missing");
|
||||
MessageBox.Show("Your changes were not saved. The game will crash when loading your pack if the Overworld, Nether and End categories don't all exist with at least one valid song.", "Mandatory Categories Missing");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -412,7 +419,7 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
private void AudioEditor_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (saved) return;
|
||||
if (!saved) return;
|
||||
saveToolStripMenuItem1_Click(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADk
|
||||
MAAAAk1TRnQBSQFMAgEBCQEAATgBAAE4AQABEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA
|
||||
MAAAAk1TRnQBSQFMAgEBCQEAAUABAAFAAQABEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA
|
||||
AwABMAMAAQEBAAEgBgABMBIAAzgB/wM1Af8DNQH/AzMB/wMwAf8DLwH/Ay0B/wMtAf8DJAH/AzsB/wM4
|
||||
Af8DNQH/Ay0B/wMnAf8DNgH/AzIB/8AAAzgB/wN/Af8DeQH/A3kB/wN5Af8DcQH/A3EB/wN5Af8DeQH/
|
||||
A3EB/wNxAf8DcQH/A3kB/wN5Af8DfwH/AzIB/8AAAzIB/wN2Af8DsAH/A7AB/wOvAf8DrwH/A68B/wOo
|
||||
|
||||
Reference in New Issue
Block a user