Property name refactor
This commit is contained in:
parent
d848346421
commit
4514dc5f90
1 changed files with 13 additions and 9 deletions
22
Config.cs
22
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());
|
||||
|
|
Loading…
Add table
Reference in a new issue