public static void SaveConfig() { try { Debug.Log("[BDTeamIcons] == Saving settings.cfg == "); SettingsDataField.Save(); } catch (NullReferenceException) { Debug.Log("[BDTeamIcons]: === Failed to save settings.cfg ===="); } }
public static void LoadConfig() { try { Debug.Log("[BDTeamIcons]=== Loading settings.cfg ==="); SettingsDataField.Load(); } catch (NullReferenceException) { Debug.Log("[BDTeamIcons]=== Failed to load settings config ==="); } }
public static void Load() { ConfigNode fileNode = ConfigNode.Load(TeamIconSettings.settingsConfigURL); if (!fileNode.HasNode("Windows")) { return; } ConfigNode settings = fileNode.GetNode("Windows"); IEnumerator <FieldInfo> field = typeof(BDATISetup).GetFields().AsEnumerable().GetEnumerator(); while (field.MoveNext()) { if (field.Current == null) { continue; } if (!field.Current.IsDefined(typeof(WindowDataField), false)) { continue; } if (!settings.HasValue(field.Current.Name)) { continue; } object parsedValue = SettingsDataField.ParseValue(field.Current.FieldType, settings.GetValue(field.Current.Name)); if (parsedValue != null) { field.Current.SetValue(null, parsedValue); } } field.Dispose(); }