MainForm - Fix unable to create skin when no loc file is found

This commit is contained in:
miku-666
2024-03-13 18:04:48 +01:00
parent c645cef9ed
commit 2ec739d4c0
2 changed files with 16 additions and 11 deletions

View File

@@ -242,15 +242,23 @@ namespace PckStudio.Popups
}
string skinId = _skinId.ToString("d08");
skin.Filename = $"dlcskin{skinId}.png";
string skinDisplayNameLocKey = $"IDS_dlcskin{skinId}_DISPLAYNAME";
currentLoc.AddLocKey(skinDisplayNameLocKey, textSkinName.Text);
skin.Properties.Add("DISPLAYNAME", textSkinName.Text);
skin.Properties.Add("DISPLAYNAMEID", skinDisplayNameLocKey);
if (currentLoc is not null)
{
string skinDisplayNameLocKey = $"IDS_dlcskin{skinId}_DISPLAYNAME";
skin.Properties.Add("DISPLAYNAMEID", skinDisplayNameLocKey);
currentLoc.AddLocKey(skinDisplayNameLocKey, textSkinName.Text);
}
if (!string.IsNullOrEmpty(textThemeName.Text))
{
skin.Properties.Add("THEMENAME", textThemeName.Text);
skin.Properties.Add("THEMENAMEID", $"IDS_dlcskin{skinId}_THEMENAME");
currentLoc.AddLocKey($"IDS_dlcskin{skinId}_THEMENAME", textThemeName.Text);
if (currentLoc is not null)
{
skin.Properties.Add("THEMENAMEID", $"IDS_dlcskin{skinId}_THEMENAME");
currentLoc.AddLocKey($"IDS_dlcskin{skinId}_THEMENAME", textThemeName.Text);
}
}
skin.Properties.Add("ANIM", anim);
skin.Properties.Add("GAME_FLAGS", "0x18");

View File

@@ -801,12 +801,9 @@ namespace PckStudio
private void createSkinToolStripMenuItem_Click(object sender, EventArgs e)
{
if (!TryGetLocFile(out LOCFile locFile))
{
MessageBox.Show("No .loc file found", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
using (AddNewSkin add = new AddNewSkin(locFile))
LOCFile locFile = null;
TryGetLocFile(out locFile);
using AddNewSkin add = new AddNewSkin(locFile);
if (add.ShowDialog() == DialogResult.OK)
{