mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-05-28 18:44:50 +00:00
PckAssetExtensions - [SetSkin] Add null check for loc file
This commit is contained in:
@@ -103,16 +103,25 @@ namespace PckStudio.Extensions
|
||||
// TODO: keep filepath
|
||||
asset.Filename = $"dlcskin{skinId}.png";
|
||||
|
||||
string skinLocKey = $"IDS_dlcskin{skinId}_DISPLAYNAME";
|
||||
asset.SetProperty("DISPLAYNAME", skin.MetaData.Name);
|
||||
asset.SetProperty("DISPLAYNAMEID", skinLocKey);
|
||||
localizationFile.SetLocEntry(skinLocKey, skin.MetaData.Name);
|
||||
|
||||
if (localizationFile is not null)
|
||||
{
|
||||
string skinLocKey = $"IDS_dlcskin{skinId}_DISPLAYNAME";
|
||||
asset.SetProperty("DISPLAYNAMEID", skinLocKey);
|
||||
localizationFile.SetLocEntry(skinLocKey, skin.MetaData.Name);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(skin.MetaData.Theme))
|
||||
{
|
||||
asset.SetProperty("THEMENAME", skin.MetaData.Theme);
|
||||
asset.SetProperty("THEMENAMEID", $"IDS_dlcskin{skinId}_THEMENAME");
|
||||
localizationFile.SetLocEntry($"IDS_dlcskin{skinId}_THEMENAME", skin.MetaData.Theme);
|
||||
|
||||
if (localizationFile is not null)
|
||||
{
|
||||
string skinThemeLocKey = $"IDS_dlcskin{skinId}_THEMENAME";
|
||||
asset.SetProperty("THEMENAMEID", skinThemeLocKey);
|
||||
localizationFile.SetLocEntry(skinThemeLocKey, skin.MetaData.Theme);
|
||||
}
|
||||
}
|
||||
|
||||
if (skin.HasCape)
|
||||
|
||||
@@ -756,7 +756,7 @@ namespace PckStudio
|
||||
DelegatedSaveContext<Skin> saveContext = new DelegatedSaveContext<Skin>(Settings.Default.AutoSaveChanges, (customSkin) =>
|
||||
{
|
||||
if (!TryGetLocFile(out LOCFile locFile))
|
||||
Debug.Fail("Failed to aquire loc file.");
|
||||
Debug.WriteLine("Failed to aquire loc file.");
|
||||
asset.SetSkin(customSkin, locFile);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user