From ebd908b63080b426b452c0e07cb3ba59ae14fde1 Mon Sep 17 00:00:00 2001 From: miku-666 <74728189+NessieHax@users.noreply.github.com> Date: Wed, 8 Jun 2022 20:27:34 +0200 Subject: [PATCH] Update AudioEditor --- .../Utilities/Audio/AudioEditor.Designer.cs | 1 - .../Forms/Utilities/Audio/AudioEditor.cs | 229 +++++------------- .../Forms/Utilities/Audio/AudioEditor.resx | 196 +++++++-------- .../Utilities/Audio/addCategory.Designer.cs | 92 +++---- .../Forms/Utilities/Audio/addCategory.cs | 31 +-- .../Forms/Utilities/Audio/addCategory.resx | 4 +- 6 files changed, 217 insertions(+), 336 deletions(-) diff --git a/MinecraftUSkinEditor/Forms/Utilities/Audio/AudioEditor.Designer.cs b/MinecraftUSkinEditor/Forms/Utilities/Audio/AudioEditor.Designer.cs index 239a9982..401ce470 100644 --- a/MinecraftUSkinEditor/Forms/Utilities/Audio/AudioEditor.Designer.cs +++ b/MinecraftUSkinEditor/Forms/Utilities/Audio/AudioEditor.Designer.cs @@ -166,7 +166,6 @@ namespace PckStudio.Forms.Utilities resources.ApplyResources(this.metroLabel2, "metroLabel2"); this.metroLabel2.Name = "metroLabel2"; this.metroLabel2.Theme = MetroFramework.MetroThemeStyle.Dark; - this.metroLabel2.Click += new System.EventHandler(this.metroLabel2_Click); // // metroLabel1 // diff --git a/MinecraftUSkinEditor/Forms/Utilities/Audio/AudioEditor.cs b/MinecraftUSkinEditor/Forms/Utilities/Audio/AudioEditor.cs index d815b276..5a0faf66 100644 --- a/MinecraftUSkinEditor/Forms/Utilities/Audio/AudioEditor.cs +++ b/MinecraftUSkinEditor/Forms/Utilities/Audio/AudioEditor.cs @@ -23,7 +23,6 @@ namespace PckStudio.Forms.Utilities public string defaultType = "yes"; public string cat; public List cats = new List(); - public List totalCats = new List(); public class NodeSorter : System.Collections.IComparer { @@ -69,11 +68,11 @@ namespace PckStudio.Forms.Utilities } PCKFile audioPCK; - bool isVita; PCKFile.FileData mf; - public AudioEditor(PCKFile.FileData MineFile, bool littleEndian) + bool _isLittleEndian; + public AudioEditor(PCKFile.FileData MineFile, bool isLittleEndian) { - isVita = littleEndian; + _isLittleEndian = isLittleEndian; ImageList catImages = new ImageList(); catImages.ColorDepth = ColorDepth.Depth32Bit; catImages.Images.Add(Properties.Resources.audio_0_overworld); @@ -92,37 +91,32 @@ namespace PckStudio.Forms.Utilities mf = MineFile; using (var stream = new MemoryStream(mf.data)) { - audioPCK = PCKFileReader.Read(stream, isVita); + audioPCK = PCKFileReader.Read(stream, isLittleEndian); } - if (!audioPCK.meta_data.ContainsKey("CUENAME")) + if (!audioPCK.meta_data.ContainsKey("CUENAME") || audioPCK.type != 1) { throw new Exception("This is not a valid audio.pck file"); } - //defaultType = audioPCK.meta_data["CUENAME"]; - int index = 0; List tempMineFiles = audioPCK.file_entries; foreach (PCKFile.FileData mineFile in tempMineFiles) { - mineFile.name = getCatString(mineFile.type); - Console.WriteLine("Category Found: " + mineFile.name); + string CatString = getCatString(mineFile.type); + Console.WriteLine("Category Found: " + CatString); if (cats.Contains(mineFile.type)) { - Console.WriteLine("Duplicate category found, " + getCatString(mineFile.type) + ". Combining..."); + Console.WriteLine("Duplicate category found, " + CatString + ". Combining..."); audioPCK.file_entries.Remove(mineFile); audioPCK.file_entries.Find(category => category.name == getCatString(mineFile.type)).properties = mineFile.properties; } else { - TreeNode treeNode = new TreeNode(); - treeNode.Text = mineFile.name; + TreeNode treeNode = new TreeNode(CatString); treeNode.Tag = mineFile; - //treeNode.ImageIndex = mineFile.type; - //treeNode.SelectedImageIndex = mineFile.type; - treeView1.Nodes.Add(treeNode); - cats.Add((int)mineFile.type); + treeNode.ImageIndex = mineFile.type; + treeNode.SelectedImageIndex = mineFile.type; + treeView1.Nodes.Add(treeNode); + cats.Add(mineFile.type); } - - index++; } treeView1.TreeViewNodeSorter = new NodeSorter(); @@ -132,14 +126,13 @@ namespace PckStudio.Forms.Utilities private void treeView2_AfterSelect(object sender, TreeViewEventArgs e) { comboBox1.Items.Clear(); //Resets metadata combobox of selectable entry names - if (e.Node.Tag == null) return; - var strings = (Tuple)e.Node.Tag; - + if (e.Node.Tag == null || !(e.Node.Tag is Tuple)) return; + var strings = e.Node.Tag as Tuple; + comboBox1.Text = strings.Item1; + textBox1.Text = strings.Item2; foreach (var metaType in audioPCK.meta_data) comboBox1.Items.Add(metaType.Key); - comboBox1.Text = strings.Item1;//Sets currently selected metadata type to type selected in selected metadata node - textBox1.Text = strings.Item2;//Sets currently selected metadata value to value selected in selected metadata node } private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) @@ -160,9 +153,9 @@ namespace PckStudio.Forms.Utilities { if (treeView2.SelectedNode != null) { - //object[] strings = (object[])treeView2.SelectedNode.Tag; - //strings[1] = textBox1.Text; - } + //var strings = (Tuple)treeView2.SelectedNode.Tag; + //strings[1] = textBox1.Text; + } } private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) @@ -183,43 +176,47 @@ namespace PckStudio.Forms.Utilities int check = Enumerable.Range(0, 8).Except(cats).First(); // Exclude Unused for now if (0 <= check && check <= 8) { - PckStudio.addCategory add = new PckStudio.addCategory(this);//sets category adding dialog - add.ShowDialog();//displays metadata adding dialog + addCategory add = new addCategory(this);//sets category adding dialog + if (add.ShowDialog() == DialogResult.OK) + add.Dispose();//diposes generated metadata adding dialog data if (!cats.Contains(getCatID(cat))) cats.Add(getCatID(cat)); else return; - PCKFile.FileData mf = new PCKFile.FileData(cat, getCatID(cat)); //Creates new minefile template - TreeNode addNode = new TreeNode(mf.name) { Tag = mf };//creates node for minefile - //addNode.ImageIndex = mf.type; - //addNode.SelectedImageIndex = mf.type; - //audioPCKFile.FileDatas.Add(mf); - treeView1.Nodes.Add(addNode); + PCKFile.FileData mf = new PCKFile.FileData(cat, getCatID(cat)); + TreeNode addNode = new TreeNode(mf.name) { Tag = mf }; + audioPCK.file_entries.Add(mf); + treeView1.Nodes.Add(addNode); treeView1.Sort(); } } catch (Exception ex) { + Console.WriteLine(ex.Message); MessageBox.Show("All possible categories are used", "There are no more categories that could be added"); } } private void addEntryMenuItem_Click(object sender, EventArgs e) { - if (treeView1.SelectedNode == null) return; + if (treeView1.SelectedNode == null && !(treeView1.SelectedNode.Tag is PCKFile.FileData)) return; + var file = treeView1.SelectedNode.Tag as PCKFile.FileData; TreeNode meta = new TreeNode("New Entry"); - //meta.Tag = obj; - treeView2.Nodes.Add(meta); - //((PCKFile.FileData)treeView1.SelectedNode.Tag).properties.Add(defaultType, new List { "New Entry" }); - } + meta.Tag = file; + treeView2.Nodes.Add(meta); + file.properties.Add(new ValueTuple(defaultType, "New Entry")); + } public void treeView2_KeyDown(object sender, KeyEventArgs e) { - if (e.KeyCode == Keys.Delete && treeView2.SelectedNode != null) + if (e.KeyCode == Keys.Delete && treeView2.SelectedNode != null && + treeView2.SelectedNode.Tag is ValueTuple && + treeView1.SelectedNode.Tag is PCKFile.FileData) { - if (treeView1.SelectedNode == null) return; // makes sure you don't run this if there is nothing to delete - //((PCKFile.FileData)treeView1.SelectedNode.Tag).properties.Remove((string)treeView2.SelectedNode.Tag); - treeView2.SelectedNode.Remove(); - } + var file = treeView1.SelectedNode.Tag as PCKFile.FileData; + var property = (ValueTuple)treeView2.SelectedNode.Tag; + file.properties.Remove(property); + treeView2.SelectedNode.Remove(); + } } private void removeCategoryStripMenuItem_Click(object sender, EventArgs e) @@ -249,136 +246,28 @@ namespace PckStudio.Forms.Utilities private void Binka_DragDrop(object sender, DragEventArgs e) { - if (treeView1.SelectedNode != null) + if (treeView1.SelectedNode != null && + treeView1.SelectedNode.Tag is PCKFile.FileData) { string[] FileList = (string[])e.Data.GetData(DataFormats.FileDrop, false); - + var file = treeView1.SelectedNode.Tag as PCKFile.FileData; foreach (string binka in FileList) { - if(System.IO.Path.GetExtension(binka) == ".binka") + if(Path.GetExtension(binka) == ".binka") { - object[] obj = { }; - - TreeNode meta = new TreeNode(); - meta.Text = "CUENAME"; - meta.Tag = obj; - treeView2.Nodes.Add(meta); - ((PCKFile.FileData)treeView1.SelectedNode.Tag).properties.Add(new Tuple("CUENAME", Path.GetFileNameWithoutExtension(binka))); + TreeNode meta = new TreeNode("CUENAME"); + var property = new ValueTuple("CUENAME", Path.GetFileNameWithoutExtension(binka)); + meta.Tag = property; + treeView2.Nodes.Add(meta); + file.properties.Add(property); } } } } - //private static void writeMinecraftString(FileOutput f, string str) - //{ - // byte[] d = Encoding.BigEndianUnicode.GetBytes(str); - // f.writeInt(d.Length / 2); - // f.writeBytes(d); - // f.writeInt(0); - //} - - //private static void writeMinecraftStringVita(FileOutput f, string str) - //{ - // Console.WriteLine("WriteVita -- " + str); - // byte[] bytes = Encoding.Unicode.GetBytes(str); - // f.writeIntVita(bytes.Length / 2); - // f.writeBytes((bytes)); - // f.writeIntVita(0); - //} - - //public static byte[] buildAudioPCKVita(PCKFile pck) - //{ - // FileOutput fileOutput = new FileOutput(); - // fileOutput.Endian = Endianness.Big; - // fileOutput.writeIntVita(1); - // fileOutput.writeIntVita(pck.meta_data.Count); - //foreach (int num in pck.meta_data.Keys) - //{ - // fileOutput.writeIntVita(num); - // writeMinecraftStringVita(fileOutput, pck.meta_data[num]); - //} - //fileOutput.writeIntVita(PCKFile.FileDatas.Count); - //foreach (PCKFile.FileData mineFile in PCKFile.FileDatas) - //{ - // mineFile.name = ""; - // fileOutput.writeIntVita(mineFile.data.Length); - // fileOutput.writeIntVita(mineFile.type); - // writeMinecraftStringVita(fileOutput, mineFile.name); - //} - //foreach (PCKFile.FileData mineFile2 in PCKFile.FileDatas) - //{ - // string str = ""; - // try - // { - // fileOutput.writeIntVita(mineFile2.properties.Count); - // foreach (var array in mineFile2.properties) - // { - // str = array.Key; - // fileOutput.writeIntVita(pck.typeCodes[array.Key]); - // writeMinecraftStringVita(fileOutput, array.Value); - // } - // fileOutput.writeBytes(mineFile2.data); - // } - // catch (Exception) - // { - // MessageBox.Show(str + " is not in the main metadatabase"); - // break; - // } - //} - // return fileOutput.getBytes(); - //} - - public static byte[] buildAudioPCK(PCKFile pck) - { - //FileOutput f = new FileOutput(); - //f.Endian = pck.isLittleEndian ? Endianness.Little : Endianness.Big; - - //f.writeInt(1); - //f.writeInt(pck.meta_data.Count); - //foreach (int type in pck.meta_data.Keys) - //{ - // f.writeInt(type); - // writeMinecraftString(f, pck.meta_data[type]); - //} - - //f.writeInt(PCKFile.FileDatas.Count); - //Console.WriteLine(PCKFile.FileDatas.Count); - //foreach (PCKFile.FileData mf in PCKFile.FileDatas) - //{ - // mf.name = ""; - // f.writeInt(mf.data.Length); - // f.writeInt(mf.type); - // writeMinecraftString(f, mf.name); - //} - - //foreach (PCKFile.FileData mf in PCKFile.FileDatas) - //{ - // string missing = ""; - // try - // { - // f.writeInt(mf.properties.Count); - // foreach (var entry in mf.properties) - // { - // missing = entry.Key; - // f.writeInt(pck.typeCodes[entry.Key]); - // writeMinecraftString(f, entry.Value); - // } - - // f.writeBytes(mf.data); - // } - // catch (Exception) - // { - // MessageBox.Show(missing + " is not in the main metadatabase"); - // break; - // } - //} - //return f.getBytes(); - return new byte[0]; - } - private void saveToolStripMenuItem1_Click(object sender, EventArgs e) { - FormMain.treeViewToMineFiles(treeView1, audioPCK); + //FormMain.treeViewToMineFiles(treeView1, audioPCK); if(!cats.Contains(0) || !cats.Contains(1) || !cats.Contains(2)) { @@ -389,23 +278,21 @@ namespace PckStudio.Forms.Utilities bool emptyCat = false; foreach (PCKFile.FileData mf in audioPCK.file_entries) - emptyCat = mf.properties.Count == 0; + if(mf.properties.Count == 0) emptyCat = true; if (emptyCat) { MessageBox.Show("The game will crash upon loading your pack if a category is empty", "Empty Category"); return; } - - //mf.data = isVita ? buildAudioPCKVita(audioPCK) : buildAudioPCK(audioPCK); + using(var stream = new MemoryStream()) + { + PCKFileWriter.Write(stream, audioPCK, _isLittleEndian); + mf.SetData(stream.ToArray()); + } saved = true; } - private void metroLabel2_Click(object sender, EventArgs e) - { - - } - private void treeView2_DragEnter(object sender, DragEventArgs e) { e.Effect = DragDropEffects.All; diff --git a/MinecraftUSkinEditor/Forms/Utilities/Audio/AudioEditor.resx b/MinecraftUSkinEditor/Forms/Utilities/Audio/AudioEditor.resx index 16146c71..e5aae834 100644 --- a/MinecraftUSkinEditor/Forms/Utilities/Audio/AudioEditor.resx +++ b/MinecraftUSkinEditor/Forms/Utilities/Audio/AudioEditor.resx @@ -125,43 +125,6 @@ 127, 8 - - 169, 48 - - - contextMenuStrip1 - - - System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 20, 84 - - - 0, 0, 0, 0 - - - 205, 350 - - - 118, 230 - - - - 12 - - - treeView1 - - - System.Windows.Forms.TreeView, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 4 - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO @@ -182,12 +145,74 @@ Remove Category + + 169, 48 + + + contextMenuStrip1 + + + System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 20, 84 + + + 0, 0, 0, 0 + + + 128, 230 + + + + 12 + + + treeView1 + + + System.Windows.Forms.TreeView, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 4 + 19, 8 False + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4yMfEgaZUAAADfSURBVDhPYxg8 + QLt++3yTGbf/Fm599P/Nh49wfPXxq/+rTt37f+Dak/8gOSBgAGEMANIMxGBFyAasPf/0v8GE8//z1t8C + y4HU4DIALIluwLpLL+HiMANAGKoNAWASCavv/n/57gPcgOvP3oENOXj7NViOoAFGU6791+k4ghWD5Aga + QCyGakMAkODcU89R/I8Ng9TgNADk14dPn/8/c+kqVgySgwUqVBsCwAx49urN/zsPHmPFIDmaGvAXJInN + 38gYasBfqDYE0K7dOn/Wvut/sfkdGYPUgJI9VNuAAwYGAGn6yvdevWgPAAAAAElFTkSuQmCC + + + + 98, 22 + + + Save + + + 37, 20 + + + File + + + 44, 20 + + + Help + 20, 60 @@ -212,70 +237,12 @@ 8 - - 37, 20 - - - File - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - vwAADr8BOAVTJAAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4yMfEgaZUAAADfSURBVDhPYxg8 - QLt++3yTGbf/Fm599P/Nh49wfPXxq/+rTt37f+Dak/8gOSBgAGEMANIMxGBFyAasPf/0v8GE8//z1t8C - y4HU4DIALIluwLpLL+HiMANAGKoNAWASCavv/n/57gPcgOvP3oENOXj7NViOoAFGU6791+k4ghWD5Aga - QCyGakMAkODcU89R/I8Ng9TgNADk14dPn/8/c+kqVgySgwUqVBsCwAx49urN/zsPHmPFIDmaGvAXJInN - 38gYasBfqDYE0K7dOn/Wvut/sfkdGYPUgJI9VNuAAwYGAGn6yvdevWgPAAAAAElFTkSuQmCC - - - - 98, 22 - - - Save - - - 44, 20 - - - Help - - Top, Bottom + Top, Bottom, Left 282, 8 - - 148, 48 - - - contextMenuStrip2 - - - System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 141, 84 - - - 143, 230 - - - 13 - - - treeView2 - - - System.Windows.Forms.TreeView, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 7 - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO @@ -296,8 +263,38 @@ Remove Entry + + 148, 48 + + + contextMenuStrip2 + + + System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 151, 84 + + + 133, 230 + + + 13 + + + treeView2 + + + System.Windows.Forms.TreeView, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 7 + - Top, Right + Top, Left, Right 290, 155 @@ -321,7 +318,7 @@ 6 - Top, Right + Top, Left, Right 290, 209 @@ -416,6 +413,9 @@ 450, 330 + + 450, 330 + Music Editor diff --git a/MinecraftUSkinEditor/Forms/Utilities/Audio/addCategory.Designer.cs b/MinecraftUSkinEditor/Forms/Utilities/Audio/addCategory.Designer.cs index 8537f076..83d88844 100644 --- a/MinecraftUSkinEditor/Forms/Utilities/Audio/addCategory.Designer.cs +++ b/MinecraftUSkinEditor/Forms/Utilities/Audio/addCategory.Designer.cs @@ -28,52 +28,52 @@ /// private void InitializeComponent() { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(addCategory)); - this.label2 = new System.Windows.Forms.Label(); - this.button1 = new System.Windows.Forms.Button(); - this.comboBox1 = new System.Windows.Forms.ComboBox(); - this.SuspendLayout(); - // - // label2 - // - resources.ApplyResources(this.label2, "label2"); - this.label2.ForeColor = System.Drawing.Color.White; - this.label2.Name = "label2"; - // - // button1 - // - resources.ApplyResources(this.button1, "button1"); - this.button1.ForeColor = System.Drawing.Color.White; - this.button1.Name = "button1"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // comboBox1 - // - this.comboBox1.FormattingEnabled = true; - resources.ApplyResources(this.comboBox1, "comboBox1"); - this.comboBox1.Name = "comboBox1"; - this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - // - // addCategory - // - resources.ApplyResources(this, "$this"); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ControlBox = false; - this.Controls.Add(this.comboBox1); - this.Controls.Add(this.button1); - this.Controls.Add(this.label2); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "addCategory"; - this.Resizable = false; - this.ShadowType = MetroFramework.Forms.MetroFormShadowType.DropShadow; - this.Style = MetroFramework.MetroColorStyle.Silver; - this.Theme = MetroFramework.MetroThemeStyle.Dark; - this.Load += new System.EventHandler(this.addCategory_Load); - this.ResumeLayout(false); - this.PerformLayout(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(addCategory)); + this.label2 = new System.Windows.Forms.Label(); + this.button1 = new System.Windows.Forms.Button(); + this.comboBox1 = new System.Windows.Forms.ComboBox(); + this.SuspendLayout(); + // + // label2 + // + resources.ApplyResources(this.label2, "label2"); + this.label2.ForeColor = System.Drawing.Color.White; + this.label2.Name = "label2"; + // + // button1 + // + resources.ApplyResources(this.button1, "button1"); + this.button1.ForeColor = System.Drawing.Color.White; + this.button1.Name = "button1"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // comboBox1 + // + this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBox1.FormattingEnabled = true; + resources.ApplyResources(this.comboBox1, "comboBox1"); + this.comboBox1.Name = "comboBox1"; + // + // addCategory + // + resources.ApplyResources(this, "$this"); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ControlBox = false; + this.Controls.Add(this.comboBox1); + this.Controls.Add(this.button1); + this.Controls.Add(this.label2); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "addCategory"; + this.Resizable = false; + this.ShadowType = MetroFramework.Forms.MetroFormShadowType.DropShadow; + this.Style = MetroFramework.MetroColorStyle.Silver; + this.Theme = MetroFramework.MetroThemeStyle.Dark; + this.ResumeLayout(false); + this.PerformLayout(); + } #endregion diff --git a/MinecraftUSkinEditor/Forms/Utilities/Audio/addCategory.cs b/MinecraftUSkinEditor/Forms/Utilities/Audio/addCategory.cs index edf80ec9..8ec383de 100644 --- a/MinecraftUSkinEditor/Forms/Utilities/Audio/addCategory.cs +++ b/MinecraftUSkinEditor/Forms/Utilities/Audio/addCategory.cs @@ -14,31 +14,26 @@ namespace PckStudio { public partial class addCategory : MetroFramework.Forms.MetroForm { - PckStudio.Forms.Utilities.AudioEditor audio; - public addCategory(PckStudio.Forms.Utilities.AudioEditor audioIn) + public string Category { get; private set; } + public addCategory(Forms.Utilities.AudioEditor audioIn) { InitializeComponent(); - audio = audioIn; - if(!audio.cats.Contains(0)) comboBox1.Items.Add("Overworld"); - if(!audio.cats.Contains(1)) comboBox1.Items.Add("Nether"); - if(!audio.cats.Contains(2)) comboBox1.Items.Add("End"); - if(!audio.cats.Contains(3)) comboBox1.Items.Add("Creative"); - if(!audio.cats.Contains(4)) comboBox1.Items.Add("Menu"); - if(!audio.cats.Contains(5)) comboBox1.Items.Add("Battle"); - if(!audio.cats.Contains(6)) comboBox1.Items.Add("Tumble"); - if(!audio.cats.Contains(7)) comboBox1.Items.Add("Glide"); + if(!audioIn.cats.Contains(0)) comboBox1.Items.Add("Overworld"); + if(!audioIn.cats.Contains(1)) comboBox1.Items.Add("Nether"); + if(!audioIn.cats.Contains(2)) comboBox1.Items.Add("End"); + if(!audioIn.cats.Contains(3)) comboBox1.Items.Add("Creative"); + if(!audioIn.cats.Contains(4)) comboBox1.Items.Add("Menu"); + if(!audioIn.cats.Contains(5)) comboBox1.Items.Add("Battle"); + if(!audioIn.cats.Contains(6)) comboBox1.Items.Add("Tumble"); + if(!audioIn.cats.Contains(7)) comboBox1.Items.Add("Glide"); FormBorderStyle = FormBorderStyle.None; } private void button1_Click(object sender, EventArgs e) { - audio.cat = comboBox1.Text; - if(comboBox1.SelectedIndex > -1) this.Close(); - } - - private void addCategory_Load(object sender, EventArgs e) - { - + Category = comboBox1.Text; + DialogResult = DialogResult.OK; + if(comboBox1.SelectedIndex > -1) Close(); } } diff --git a/MinecraftUSkinEditor/Forms/Utilities/Audio/addCategory.resx b/MinecraftUSkinEditor/Forms/Utilities/Audio/addCategory.resx index 2140f0ef..4fa7f66d 100644 --- a/MinecraftUSkinEditor/Forms/Utilities/Audio/addCategory.resx +++ b/MinecraftUSkinEditor/Forms/Utilities/Audio/addCategory.resx @@ -151,7 +151,7 @@ Flat - 96, 78 + 94, 75 75, 23 @@ -160,7 +160,7 @@ 4 - Create + Add button1