private void UpdaterToolStripMenuItem_Click(object sender, EventArgs e) { var pname = Process.GetProcessesByName("spartan"); if (pname.Length > 0) { MsgBox.ShowMessage(@"Game is running, you need to close it first!"); return; } using (var form = new UpdaterForm()) { form.ShowDialog(); } }
private async void MainForm_Load(object sender, EventArgs e) { //CleanUpFiles try { Misc.CleanUpFiles(Directory.GetCurrentDirectory(), "*.old"); } catch (Exception ex) { MsgBox.ShowMessage( $"Warning: Error during files clean-up. Error message: {ex.Message}", @"Celeste Fan Project", MessageBoxButtons.OK, MessageBoxIcon.Warning); } if (!InternetUtils.IsConnectedToInternet()) { return; } //Update Check try { if (await Updater.GetGitHubVersion() > Assembly.GetExecutingAssembly().GetName().Version) { using (var form = new MsgBoxYesNo( @"An update is avalaible. Click ""Yes"" to install it, or ""No"" to ignore it (not recommended).") ) { var dr = form.ShowDialog(); if (dr == DialogResult.OK) { using (var form2 = new UpdaterForm()) { form2.ShowDialog(); } } } } } catch (Exception ex) { MsgBox.ShowMessage( $"Warning: Error during update check. Error message: {ex.Message}", @"Celeste Fan Project", MessageBoxButtons.OK, MessageBoxIcon.Warning); } //Auto Login if (Program.UserConfig?.LoginInfo == null) { return; } if (!Program.UserConfig.LoginInfo.AutoLogin) { return; } panelManager1.Enabled = false; try { var response = await Program.WebSocketApi.DoLogin(Program.UserConfig.LoginInfo.Email, Program.UserConfig.LoginInfo.Password); if (response.Result) { Program.CurrentUser = response.User; gamerCard1.UserName = Program.CurrentUser.ProfileName; gamerCard1.Rank = $@"{Program.CurrentUser.Rank}"; panelManager1.SelectedPanel = managedPanel1; } } catch (Exception) { // } panelManager1.Enabled = true; }