diff --git a/PCK-Studio/Forms/Editor/AudioEditor.Designer.cs b/PCK-Studio/Forms/Editor/AudioEditor.Designer.cs index ea8d144b..e622c609 100644 --- a/PCK-Studio/Forms/Editor/AudioEditor.Designer.cs +++ b/PCK-Studio/Forms/Editor/AudioEditor.Designer.cs @@ -60,6 +60,7 @@ namespace PckStudio.Forms.Editor this.playOverworldInCreative = new MetroFramework.Controls.MetroCheckBox(); this.compressionUpDown = new System.Windows.Forms.NumericUpDown(); this.metroLabel1 = new MetroFramework.Controls.MetroLabel(); + this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.contextMenuStrip1.SuspendLayout(); this.menuStrip.SuspendLayout(); this.contextMenuStrip2.SuspendLayout(); @@ -132,6 +133,7 @@ namespace PckStudio.Forms.Editor // fileToolStripMenuItem // this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.openToolStripMenuItem, this.saveToolStripMenuItem1}); this.fileToolStripMenuItem.ForeColor = System.Drawing.Color.White; this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; @@ -305,6 +307,13 @@ namespace PckStudio.Forms.Editor this.metroLabel1.Name = "metroLabel1"; this.metroLabel1.Theme = MetroFramework.MetroThemeStyle.Dark; // + // openToolStripMenuItem + // + this.openToolStripMenuItem.Image = global::PckStudio.Properties.Resources.file_import; + this.openToolStripMenuItem.Name = "openToolStripMenuItem"; + resources.ApplyResources(this.openToolStripMenuItem, "openToolStripMenuItem"); + this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click); + // // AudioEditor // resources.ApplyResources(this, "$this"); @@ -363,5 +372,6 @@ namespace PckStudio.Forms.Editor private System.Windows.Forms.ToolStripMenuItem changeCategoryToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem organizeTracksToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem convertToWAVToolStripMenuItem; - } + private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem; + } } \ No newline at end of file diff --git a/PCK-Studio/Forms/Editor/AudioEditor.cs b/PCK-Studio/Forms/Editor/AudioEditor.cs index 4ca6a27a..eaeeb92f 100644 --- a/PCK-Studio/Forms/Editor/AudioEditor.cs +++ b/PCK-Studio/Forms/Editor/AudioEditor.cs @@ -643,5 +643,35 @@ namespace PckStudio.Forms.Editor saveToolStripMenuItem1_Click(sender, EventArgs.Empty); } } - } + + private void openToolStripMenuItem_Click(object sender, EventArgs e) + { + using (var ofd = new OpenFileDialog()) + { + ofd.CheckFileExists = true; + ofd.Multiselect = false; + ofd.Filter = "Audio.pck (Minecraft Music Cues)|*.pck"; + if (ofd.ShowDialog() == DialogResult.OK) + { + try + { + var reader = new PckAudioFileReader( + _isLittleEndian + ? OMI.Endianness.LittleEndian + : OMI.Endianness.BigEndian); + audioFile = reader.FromFile(ofd.FileName); + SetUpTree(); + } + catch (Exception ex) + { + MessageBox.Show(this, $"Failed to read the selected file\nError: {ex.Message}", "Failed to read audio file"); + } + } + else if (audioPCK is null) + { + Close(); + } + } + } + } } diff --git a/PCK-Studio/Forms/Editor/AudioEditor.resx b/PCK-Studio/Forms/Editor/AudioEditor.resx index b4767439..3e28b292 100644 --- a/PCK-Studio/Forms/Editor/AudioEditor.resx +++ b/PCK-Studio/Forms/Editor/AudioEditor.resx @@ -172,7 +172,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACK - NAAAAk1TRnQBSQFMAgEBCQEAAdgBAAHYAQABEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA + NAAAAk1TRnQBSQFMAgEBCQEAAeABAAHgAQABEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA AwABMAMAAQEBAAEgBgABMBIAATkBXgFzAf8BOQFeAXMB/wE5AV4BcwH/AT4BYgF8Af8BMwFUAWkB/wEz AVQBaQH/AT4BYgF8Af8BMwFUAWkB/wE5AV4BcwH/ATkBXgFzAf8BOQFeAXMB/wEzAVQBaQH/ASYBPQFM Af8BMwFUAWkB/wEzAVQBaQH/ATkBXgFzAf/AAAFiAZgBvAH/AWIBmAG8Af8BTQGEAZ8B/wFNAYQBnwH/ @@ -432,6 +432,12 @@ False + + 180, 22 + + + Open + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO @@ -443,7 +449,7 @@ - 98, 22 + 180, 22 Save @@ -840,6 +846,12 @@ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + openToolStripMenuItem + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + AudioEditor diff --git a/PCK-Studio/Forms/Editor/BehaviourEditor.cs b/PCK-Studio/Forms/Editor/BehaviourEditor.cs index e09c8bc7..6747267d 100644 --- a/PCK-Studio/Forms/Editor/BehaviourEditor.cs +++ b/PCK-Studio/Forms/Editor/BehaviourEditor.cs @@ -300,7 +300,7 @@ namespace PckStudio.Forms.Editor } catch (Exception ex) { - MessageBox.Show(this, $"Failed to save the selected file\nError: {ex.Message}", "Failed to save .col file"); + MessageBox.Show(this, $"Failed to save the selected file\nError: {ex.Message}", "Failed to save behaviour file"); } } else return;