From 3ed5598a977f40cd7086651d13bb5166f5ae2d78 Mon Sep 17 00:00:00 2001 From: MattNL Date: Tue, 9 Aug 2022 05:16:10 -0400 Subject: [PATCH] slight change to audio file classes this also fixes the "Include Overworld songs in Creative" feature. The code for that functionality was already perfect, so that hasn't been touched at all. Just needed to adjust the class a little. (: --- .../Classes/FileTypes/PCKAudioFile.cs | 14 +++++--------- .../Classes/IO/PCK/PCKAudioFileReader.cs | 3 +-- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/MinecraftUSkinEditor/Classes/FileTypes/PCKAudioFile.cs b/MinecraftUSkinEditor/Classes/FileTypes/PCKAudioFile.cs index 1fab8740..43ea24b4 100644 --- a/MinecraftUSkinEditor/Classes/FileTypes/PCKAudioFile.cs +++ b/MinecraftUSkinEditor/Classes/FileTypes/PCKAudioFile.cs @@ -47,17 +47,13 @@ namespace PckStudio.Classes.FileTypes public EAudioType audioType { get; } public List SongNames { get; } = new List(); - public AudioCategory(EAudioParameterType parameterType, EAudioType audioType) + public AudioCategory(string name, EAudioParameterType parameterType, EAudioType audioType) { + this.Name = name; this.parameterType = parameterType; this.audioType = audioType; } - - public AudioCategory(string name, EAudioParameterType parameterType, EAudioType audioType) : this(parameterType, audioType) - { - Name = name; - } - } + } public string[] GetCredits() => Credits.Values.ToArray(); public string GetCreditsString() => string.Join("\n", Credits.Values.ToArray()); @@ -135,13 +131,13 @@ namespace PckStudio.Classes.FileTypes /// True when category was created, otherwise false /// - public bool AddCategory(AudioCategory.EAudioParameterType parameterType, AudioCategory.EAudioType category) + public bool AddCategory(AudioCategory.EAudioParameterType parameterType, AudioCategory.EAudioType category, string name = "") { if (category < AudioCategory.EAudioType.Overworld || category > AudioCategory.EAudioType.Unused) throw new InvalidCategoryException(nameof(category)); bool exists = HasCategory(category); - if (!exists) _categories[(int)category] = new AudioCategory(parameterType, category); + if (!exists) _categories[(int)category] = new AudioCategory(name, parameterType, category); return !exists; } diff --git a/MinecraftUSkinEditor/Classes/IO/PCK/PCKAudioFileReader.cs b/MinecraftUSkinEditor/Classes/IO/PCK/PCKAudioFileReader.cs index bfa23923..5137ba9b 100644 --- a/MinecraftUSkinEditor/Classes/IO/PCK/PCKAudioFileReader.cs +++ b/MinecraftUSkinEditor/Classes/IO/PCK/PCKAudioFileReader.cs @@ -64,8 +64,7 @@ namespace PckStudio.Classes.IO.PCK var parameterType = (PCKAudioFile.AudioCategory.EAudioParameterType)ReadInt(stream); var audioType = (PCKAudioFile.AudioCategory.EAudioType)ReadInt(stream); string name = ReadString(stream); - Console.WriteLine(name); - _file.AddCategory(parameterType, audioType); + _file.AddCategory(parameterType, audioType, name); } }