From 4514dc5f90211dc1f97e4b363335b91be1dfe17f Mon Sep 17 00:00:00 2001 From: Terry Hearst Date: Sun, 3 Sep 2023 00:06:26 -0400 Subject: [PATCH] Property name refactor --- Config.cs | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/Config.cs b/Config.cs index 652c75e..b1f4bcc 100644 --- a/Config.cs +++ b/Config.cs @@ -13,6 +13,10 @@ namespace CustomCosmeticLoader public const string CONFIG_FILE_NAME = "config.json"; public const string SKINS_DIR_NAME = "skins"; + public const string PROPERTY_ENABLED = "enabled"; + public const string PROPERTY_CURRENT_SKIN = "currentSkin"; + public const string PROPERTY_SKIN_TO_HIJACK = "skinToHijack"; + public static bool enabled = true; public static string currentSkin; public static string skinToHijack = "Swirl_M"; // Mirage, simple skin with nice properties @@ -49,11 +53,11 @@ namespace CustomCosmeticLoader return; } - if (data["enabled"] != null) - enabled = data["enabled"].AsBool; + if (data[PROPERTY_ENABLED] != null) + enabled = data[PROPERTY_ENABLED].AsBool; - if (data["currentSkin"] != null) - currentSkin = data["currentSkin"].Value; + if (data[PROPERTY_CURRENT_SKIN] != null) + currentSkin = data[PROPERTY_CURRENT_SKIN].Value; if (currentSkin == null || !skins.ContainsKey(currentSkin)) { if (skins.Count == 0) @@ -65,17 +69,17 @@ namespace CustomCosmeticLoader currentSkin = skins.Keys.ToList()[0]; } - if (data["skinToHijack"] != null) - skinToHijack = data["skinToHijack"].Value; + if (data[PROPERTY_SKIN_TO_HIJACK] != null) + skinToHijack = data[PROPERTY_SKIN_TO_HIJACK].Value; } public static void SaveConfig() { JSONNode node = new JSONClass { - { "enabled", enabled ? "true" : "false" }, - { "currentSkin", currentSkin }, - { "skinToHijack", skinToHijack } + { PROPERTY_ENABLED, enabled ? "true" : "false" }, + { PROPERTY_CURRENT_SKIN, currentSkin }, + { PROPERTY_SKIN_TO_HIJACK, skinToHijack } }; File.WriteAllText(GetConfigPath(), node.ToString());