From 7d57ef70fc08faf4d71a803472d2dce3a1d843d0 Mon Sep 17 00:00:00 2001 From: miku-666 <74728189+NessieHax@users.noreply.github.com> Date: Sat, 3 Jun 2023 17:53:18 +0200 Subject: [PATCH] MainForm - Improved pck file access by specifing the filetype --- PCK-Studio/MainForm.cs | 28 ++++++++++++++-------------- Vendor/OMI-Lib | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/PCK-Studio/MainForm.cs b/PCK-Studio/MainForm.cs index c7910e40..43b836fb 100644 --- a/PCK-Studio/MainForm.cs +++ b/PCK-Studio/MainForm.cs @@ -348,7 +348,7 @@ namespace PckStudio if (!(file.Filename.StartsWith("res/textures/blocks/") || file.Filename.StartsWith("res/textures/items/"))) return; - if (file.IsMipmappedFile() && currentPCK.Files.TryGetValue(file.GetNormalPath(), out PckFile.FileData originalAnimationFile)) + if (file.IsMipmappedFile() && currentPCK.Files.TryGetValue(file.GetNormalPath(), PckFile.FileData.FileType.TextureFile, out PckFile.FileData originalAnimationFile)) { file = originalAnimationFile; } @@ -424,18 +424,18 @@ namespace PckStudio using (var ms = new MemoryStream(file.Data)) { var texture = Image.FromStream(ms); - if (file.Properties.HasProperty("BOX")) - { - using generateModel generate = new generateModel(file.Properties, texture); - if (generate.ShowDialog() == DialogResult.OK) - { - entryDataTextBox.Text = entryTypeTextBox.Text = string.Empty; - wasModified = true; - ReloadMetaTreeView(); - } - } - else - { + if (file.Properties.HasProperty("BOX")) + { + using generateModel generate = new generateModel(file.Properties, texture); + if (generate.ShowDialog() == DialogResult.OK) + { + entryDataTextBox.Text = entryTypeTextBox.Text = string.Empty; + wasModified = true; + ReloadMetaTreeView(); + } + } + else + { SkinPreview frm = new SkinPreview(texture, file.Properties.GetPropertyValue("ANIM", SkinANIM.FromString)); frm.ShowDialog(this); frm.Dispose(); @@ -836,7 +836,7 @@ namespace PckStudio // MessageBox.Show("There is already an music cues PCK present in this PCK!", "Can't create audio.pck"); // return; //} - if (currentPCK.Files.Contains("audio.pck")) + if (currentPCK.Files.Contains("audio.pck", PckFile.FileData.FileType.AudioFile)) { // the chance of this happening is really really slim but just in case MessageBox.Show("There is already a file in this PCK named \"audio.pck\"!", "Can't create audio.pck"); diff --git a/Vendor/OMI-Lib b/Vendor/OMI-Lib index cf6ccf93..ad926eec 160000 --- a/Vendor/OMI-Lib +++ b/Vendor/OMI-Lib @@ -1 +1 @@ -Subproject commit cf6ccf9365e7ded9df717abcc52ef69762316584 +Subproject commit ad926eeca12d34189af05afc63c65d9c61d60a14