public Main(bool startMinimized) { LocalizationManager.Initialize(); if (Properties.Settings.Default.FirstStart) { if (languagePicker == null) { languagePicker = new LanguagePicker(); } else { languagePicker.Initialize(); languagePicker.WindowState = FormWindowState.Normal; languagePicker.BringToFront(); } languagePicker.ShowDialog(); } StartupHandler.Initialize(); allowFormDisplay = !startMinimized; InitializeComponent(); // Also checks for the RAGEMP folder on the first start LoadSettings(); string currentLanguage = LocalizationManager.GetLanguageFromCode(LocalizationManager.GetLanguage()); for (int i = 0; i < ((LocalizationManager.Language[])Enum.GetValues(typeof(LocalizationManager.Language))).Length; ++i) { LocalizationManager.Language language = (LocalizationManager.Language)i; ToolStripItem newLanguage = languageToolStripMenuItem.DropDownItems.Add(language.ToString()); newLanguage.Click += (s, e) => { if (((ToolStripMenuItem)newLanguage).Checked == true) { return; } CultureInfo cultureInfo = new CultureInfo(LocalizationManager.GetCodeFromLanguage(language)); if (MessageBox.Show(Strings.ResourceManager.GetString("Restart", cultureInfo), Strings.ResourceManager.GetString("RestartTitle", cultureInfo), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { LocalizationManager.SetLanguage(language); Hide(); System.Windows.Forms.Application.Restart(); System.Windows.Forms.Application.Exit(); } }; if (currentLanguage == language.ToString()) { ((ToolStripMenuItem)languageToolStripMenuItem.DropDownItems[i]).Checked = true; } } BackupHandler.Initialize(); if (startMinimized) { TrayIcon.Visible = true; } if (Properties.Settings.Default.CheckForUpdatesAutomatically) { TryCheckingForUpdates(manual: false); } }
public static void SaveLanguage(LocalizationManager.Language language) { PlayerPrefs.SetString(LANGUAGE_PLAYERPREFS_KEY, language.ToString()); }