public static void NullSafeSettings() { if (settingFile.KeyExists("Server")) { FileAccountSave.ChoosenGameServer = settingFile.Read("Server"); settingFile.DeleteKey("Server"); FileAccountSave.SaveAccount(); } if (settingFile.KeyExists("AccountEmail")) { FileAccountSave.UserRawEmail = settingFile.Read("AccountEmail"); settingFile.DeleteKey("AccountEmail"); FileAccountSave.SaveAccount(); } if (settingFile.KeyExists("Password")) { FileAccountSave.UserHashedPassword = settingFile.Read("Password"); settingFile.DeleteKey("Password"); FileAccountSave.SaveAccount(); } if (DetectLinux.LinuxDetected() && !settingFile.KeyExists("InstallationDirectory")) { settingFile.Write("InstallationDirectory", "GameFiles"); } else if (!settingFile.KeyExists("InstallationDirectory")) { settingFile.Write("InstallationDirectory", ""); } else if (!File.Exists(settingFile.Read("InstallationDirectory")) && !string.IsNullOrEmpty(settingFile.Read("InstallationDirectory"))) { Directory.CreateDirectory(settingFile.Read("InstallationDirectory")); } if (!settingFile.KeyExists("CDN") || string.IsNullOrEmpty(settingFile.Read("CDN"))) { settingFile.Write("CDN", "http://localhost"); } else if (settingFile.KeyExists("CDN")) { string SavedCDN = settingFile.Read("CDN"); if (SavedCDN.EndsWith("/")) { char[] charsToTrim = { '/' }; string FinalCDNURL = SavedCDN.TrimEnd(charsToTrim); settingFile.Write("CDN", FinalCDNURL); } } if (!settingFile.KeyExists("Language") || string.IsNullOrEmpty(settingFile.Read("Language"))) { settingFile.Write("Language", "en"); } if (!settingFile.KeyExists("DisableProxy") || string.IsNullOrEmpty(settingFile.Read("DisableProxy"))) { settingFile.Write("DisableProxy", "0"); } if (!settingFile.KeyExists("DisableRPC") || string.IsNullOrEmpty(settingFile.Read("DisableRPC"))) { settingFile.Write("DisableRPC", "0"); } if (!settingFile.KeyExists("IgnoreUpdateVersion")) { settingFile.Write("IgnoreUpdateVersion", string.Empty); } if (!DetectLinux.LinuxDetected()) { if (!settingFile.KeyExists("PatchesApplied") && WindowsProductVersion.GetWindowsNumber() == 6.1) { settingFile.Write("PatchesApplied", "0"); } if (!settingFile.KeyExists("Firewall") || string.IsNullOrEmpty(settingFile.Read("Firewall"))) { settingFile.Write("Firewall", "Not Excluded"); } if (WindowsProductVersion.GetWindowsNumber() >= 10.0) { if (!settingFile.KeyExists("WindowsDefender") || string.IsNullOrEmpty(settingFile.Read("WindowsDefender"))) { settingFile.Write("WindowsDefender", "Not Excluded"); } } } settingFile = new IniFile("Settings.ini"); }