From 8f0da57bbf859604f6d1488c094bf121f48730b5 Mon Sep 17 00:00:00 2001 From: MattNL Date: Wed, 15 Mar 2023 08:28:17 -0400 Subject: [PATCH] Fix automatic target bug in COL Editor --- PCK-Studio/Forms/Editor/COLEditor.cs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/PCK-Studio/Forms/Editor/COLEditor.cs b/PCK-Studio/Forms/Editor/COLEditor.cs index 353d7421..3fd331e8 100644 --- a/PCK-Studio/Forms/Editor/COLEditor.cs +++ b/PCK-Studio/Forms/Editor/COLEditor.cs @@ -49,17 +49,20 @@ namespace PckStudio.Forms.Editor TU69ToolStripMenuItem.Click += (sender, e) => SetUpDefaultFile(sender, e, 11); _1_9_1ToolStripMenuItem.Click += (sender, e) => SetUpDefaultFile(sender, e, 12); - SetUpTable(false); - SetUpDefaultFile(null, EventArgs.Empty, 11); - } + SetUpDefaultFile(null, EventArgs.Empty, 11, false); + } - private void SetUpDefaultFile(object sender, EventArgs e, int ID) + private void SetUpDefaultFile(object sender, EventArgs e, int ID, bool targetVersion = true) { - var result = MessageBox.Show(this, "This function will set up your colour table to match that of the chosen version. You may lose some entries in the table. Are you sure you would like to continue?", "Target update version?", MessageBoxButtons.YesNo); - if (result == DialogResult.No) return; + if(targetVersion) + { + var result = MessageBox.Show(this, "This function will set up your colour table to match that of the chosen version. You may lose some entries in the table. Are you sure you would like to continue?", "Target update version?", MessageBoxButtons.YesNo); + if (result == DialogResult.No) return; + } + var reader = new COLFileReader(); - switch (ID) + switch (ID) { case 0: using (var stream = new MemoryStream(Properties.Resources.tu12colours)) default_colourfile = reader.FromStream(stream); break; case 1: using (var stream = new MemoryStream(Properties.Resources.tu13colours)) default_colourfile = reader.FromStream(stream); break; @@ -76,7 +79,7 @@ namespace PckStudio.Forms.Editor case 12: using (var stream = new MemoryStream(Properties.Resources._1_91_colours)) default_colourfile = reader.FromStream(stream); break; default: return; } - SetUpTable(true); + SetUpTable(targetVersion); } void SetUpTable(bool targetVersion)