public static void SaveConfig() => BannerlordConfig.Save();
public static void Initialize() { string str1 = Utilities.LoadConfigFile(nameof(BannerlordConfig)); if (string.IsNullOrEmpty(str1)) { BannerlordConfig.Save(); } else { bool flag = false; string str2 = str1; char[] chArray1 = new char[1] { '\n' }; foreach (string str3 in str2.Split(chArray1)) { char[] chArray2 = new char[1] { '=' }; string[] strArray = str3.Split(chArray2); PropertyInfo property = typeof(BannerlordConfig).GetProperty(strArray[0]); if (property == (PropertyInfo)null) { flag = true; } else { string s = strArray[1]; try { if (property.PropertyType == typeof(string)) { property.SetValue((object)null, (object)s); } else if (property.PropertyType == typeof(float)) { float result; if (float.TryParse(s, out result)) { property.SetValue((object)null, (object)result); } else { flag = true; } } else if (property.PropertyType == typeof(int)) { int result; if (int.TryParse(s, out result)) { BannerlordConfig.ConfigPropertyInt customAttribute = property.GetCustomAttribute <BannerlordConfig.ConfigPropertyInt>(); if (customAttribute == null || customAttribute.IsValidValue(result)) { property.SetValue((object)null, (object)result); } else { flag = true; } } else { flag = true; } } else if (property.PropertyType == typeof(bool)) { bool result; if (bool.TryParse(s, out result)) { property.SetValue((object)null, (object)result); } else { flag = true; } } else { flag = true; } } catch { flag = true; } } } if (flag) { BannerlordConfig.Save(); } MBAPI.IMBBannerlordConfig.ValidateOptions(); } MBTextManager.ChangeLanguage(BannerlordConfig.Language); }