From 5b6703f337b7965552712a0f1c7bd6185ebcf446 Mon Sep 17 00:00:00 2001 From: miku-666 <74728189+NessieHax@users.noreply.github.com> Date: Fri, 16 Aug 2024 17:28:43 +0200 Subject: [PATCH] MainForm - Fix issue where new packs would overwrite last open pck file --- PCK-Studio/MainForm.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/PCK-Studio/MainForm.cs b/PCK-Studio/MainForm.cs index e4e1b464..35eefda8 100644 --- a/PCK-Studio/MainForm.cs +++ b/PCK-Studio/MainForm.cs @@ -1461,8 +1461,7 @@ namespace PckStudio if (namePrompt.ShowDialog(this) == DialogResult.OK) { currentPCK = InitializePack(new Random().Next(8000, int.MaxValue), 0, namePrompt.NewText, true); - isTemplateFile = true; - wasModified = true; + MarkTemplateFile(); LoadEditorTab(); } } @@ -1474,8 +1473,7 @@ namespace PckStudio if (packPrompt.ShowDialog(this) == DialogResult.OK) { currentPCK = InitializeTexturePack(new Random().Next(8000, int.MaxValue), 0, packPrompt.PackName, packPrompt.PackRes, packPrompt.CreateSkinsPck); - isTemplateFile = true; - wasModified = true; + MarkTemplateFile(); LoadEditorTab(); } } @@ -1487,12 +1485,18 @@ namespace PckStudio if (packPrompt.ShowDialog(this) == DialogResult.OK) { currentPCK = InitializeMashUpPack(new Random().Next(8000, int.MaxValue), 0, packPrompt.PackName, packPrompt.PackRes); - isTemplateFile = true; - wasModified = false; + MarkTemplateFile(); LoadEditorTab(); } } + private void MarkTemplateFile() + { + isTemplateFile = true; + wasModified = true; + saveLocation = string.Empty; + } + private void quickChangeToolStripMenuItem_Click(object sender, EventArgs e) { using AdvancedOptions advanced = new AdvancedOptions(currentPCK); @@ -1839,6 +1843,8 @@ namespace PckStudio { if (!string.IsNullOrEmpty(saveLocation)) Save(saveLocation); + if (string.IsNullOrWhiteSpace(saveLocation) || isTemplateFile) + SaveTemplate(); } private void saveAsPCK(object sender, EventArgs e)