private void UpdateCurrentProfile(GitHubRelease onlineRelease) { switch (MessageBox.Show(string.Format(LocalizationUI.GetString("UpdateAvailable"), CurrentProfile.Version, onlineRelease.Version), LocalizationUI.GetString("UpdateAvailableTitle"), MessageBoxButtons.YesNo)) { case DialogResult.Yes: using (var directUpdater = new ReleaseDownloaderForm(onlineRelease.ReleaseAsset, CurrentProfile.Folder)) directUpdater.ShowDialog(); break; case DialogResult.No: return; /* * case DialogResult.Yes: * //MessageBox.Show(LocalizationUI.GetString("UpdateDisabled"), LocalizationUI.GetString("UpdateDisabledTitle"), MessageBoxButtons.OK); * if (Settings.SelectedDL != null && !string.IsNullOrEmpty(Settings.SelectedDL.AbsolutePath)) * //using (var customUpdater = new PerFileUpdaterForm(onlineRelease.UpdateInfoAsset, CurrentProfile.Folder, new Uri(Settings.SelectedDL, $"{onlineRelease.Version}/"))) * // customUpdater.ShowDialog(); * ; * else * MessageBox.Show(LocalizationUI.GetString("DLNotSelected"), LocalizationUI.GetString("DLNotSelectedTitle"), MessageBoxButtons.OK); * break; * * case DialogResult.No: * //case DialogResult.Cancel: * using (var directUpdater = new ReleaseDownloaderForm(onlineRelease.ReleaseAsset, CurrentProfile.Folder)) * directUpdater.ShowDialog(); * break; * * case DialogResult.Cancel: * //case DialogResult.No: * return; */ } }
private void UpdatedMessage() { MessageBox.Show(LocalizationUI.GetString("Updated"), LocalizationUI.GetString("UpdatedTitle"), MessageBoxButtons.OK); if (Cancelled) { return; } this.SafeInvoke(Close); }
private void FileReplacementErrorMessage() { MessageBox.Show(LocalizationUI.GetString("FileReplacementError"), LocalizationUI.GetString("FileReplacementErrorTitle"), MessageBoxButtons.OK); if (Cancelled) { return; } this.SafeInvoke(Close); }
private void FormPreInitialize() { Logger?.Clear(); foreach (Control control in Controls) { control.Dispose(); } Controls.Clear(); Thread.CurrentThread.CurrentCulture = Settings.LocalizationInfo.CultureInfo; Thread.CurrentThread.CurrentUICulture = Settings.LocalizationInfo.CultureInfo; CultureInfo.DefaultThreadCurrentCulture = Settings.LocalizationInfo.CultureInfo; LocalizationUI.Load(Settings.LocalizationInfo); }
private void CheckBox_SaveCredentials_CheckedChanged(object sender, EventArgs e) { if (CheckBox_SaveCredentials.Checked) { CheckBox_AutoLogIn.ForeColor = DefaultForeColor; CheckBox_AutoLogIn.AutoCheck = true; ToolTip_SaveCredentials.RemoveAll(); } else { CheckBox_AutoLogIn.Checked = false; CheckBox_AutoLogIn.ForeColor = Color.DimGray; CheckBox_AutoLogIn.AutoCheck = false; ToolTip_SaveCredentials.SetToolTip(CheckBox_AutoLogIn, LocalizationUI.GetString("ToolTipSaveCredentials")); } }
private async Task <bool> DownloadCurrentProfileAsync() { var gameReleases = await CurrentProfile.GetAvailableReleasesAsync(); if (gameReleases.Any()) { var onlineRelease = gameReleases.First(release => release.Version == CurrentProfile.Version); switch (MessageBox.Show(string.Format(LocalizationUI.GetString("NotDownloaded"), CurrentProfile.Name), LocalizationUI.GetString("NotDownloadedTitle"), MessageBoxButtons.YesNo)) { case DialogResult.Yes: using (var directUpdater = new ReleaseDownloaderForm(onlineRelease.ReleaseAsset, CurrentProfile.Folder)) { var state = directUpdater.ShowDialog(); return(state != DialogResult.Abort && state != DialogResult.Cancel); } } } return(false); }
private async Task CheckLauncherForUpdateAsync() { var launcherVersion = Assembly.GetExecutingAssembly().GetName().Version; Log($"Launcher version: [{launcherVersion}]."); Log("Checking Launcher for updates..."); var launcherReleases = await GitHub.GetAllLauncherReleasesAsync(); if (launcherReleases.Any()) { var latestRelease = launcherReleases.First(); if (launcherVersion < latestRelease.Version) { Log($"Found a new Launcher version [{latestRelease.Version}]!"); switch (MessageBox.Show(LocalizationUI.GetString("LauncherUpdateAvailable"), LocalizationUI.GetString("LauncherUpdateAvailableTitle"), MessageBoxButtons.YesNo)) { case DialogResult.Yes: using (var directUpdater = new ReleaseDownloaderForm(latestRelease.ReleaseAsset, new UpdateFolder())) directUpdater.ShowDialog(); Program.ActionsBeforeExit.Add(() => new UpdaterFile().Start(createNoWindow: true)); Close(); break; default: return; } } else { Log("Launcher is up to date."); } } else { Log("Error while checking Launcher for updates. Is Internet available?"); MessageBox.Show(LocalizationUI.GetString("NoInternet"), LocalizationUI.GetString("NoInternetTitle"), MessageBoxButtons.OK); } }
private async Task CheckProfileForUpdateAsync(bool onStartup = false) // -- onStartup - function is called on Launcher startup. { Log($"Checking Profile '{CurrentProfile.Name}' for updates..."); if (!onStartup && CurrentProfile.ExecutionFile == null) { Log($"Profile '{CurrentProfile.Name}' - execution file not found! It was not downloaded?"); await DownloadCurrentProfileAsync(); } if (CurrentProfile.ExecutionFile == null) { Log($"Something went wrong while checking the Profile '{CurrentProfile.Name}' - execution file not found!"); return; } var gameReleases = await CurrentProfile.GetAvailableReleasesAsync(); if (gameReleases.Any() && (!onStartup || CurrentProfile.IsDefault)) { var latestRelease = gameReleases.First(); if (CurrentProfile.IsDefault) { if (CurrentProfile.Version < latestRelease.Version) { Log($"Found a new Profile '{CurrentProfile.Name}' version [{latestRelease.Version}]!"); UpdateCurrentProfile(latestRelease); return; } } if (CurrentProfile.Version < latestRelease.Version || CurrentProfile.VersionExe < latestRelease.Version) { Log($"Found a new Profile '{CurrentProfile.Name}' version [{latestRelease.Version}]!"); UpdateCurrentProfile(latestRelease); } else if (CurrentProfile.VersionExe != new Version("0.0") && CurrentProfile.VersionExe != new Version("1.0.0.0") && CurrentProfile.VersionExe < CurrentProfile.Version) { Log($"The version of the execution file [{CurrentProfile.VersionExe}] of Profile '{CurrentProfile.Name}' does not correspond to the Profile version [{CurrentProfile.Version}]! An update is needed."); UpdateCurrentProfile(latestRelease); } else { if (!onStartup) { Log($"Profile '{CurrentProfile.Name}' is up to date."); MessageBox.Show(string.Format(LocalizationUI.GetString("ProfileUpToDate"), CurrentProfile.Name), LocalizationUI.GetString("ProfileUpToDateTitle"), MessageBoxButtons.OK); } } } else { if (!onStartup) { Log($"Error while checking Profile '{CurrentProfile.Name}'. Is Internet available?"); MessageBox.Show(LocalizationUI.GetString("NoInternet"), LocalizationUI.GetString("NoInternetTitle"), MessageBoxButtons.OK); } } }
private async void Button_Start_Click(object sender, EventArgs e) { bool IsOpenALInstalled() { if (OSInfo.OperatingSystemType == OperatingSystemType.Windows) { return(Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall").GetSubKeyNames() .Select(item => (string)Registry.LocalMachine.OpenSubKey($@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{item}").GetValue("DisplayName")) .Any(programName => programName == "OpenAL")); } if (OSInfo.OperatingSystemType == OperatingSystemType.Unix) { return(true); } if (OSInfo.OperatingSystemType == OperatingSystemType.MacOSX) { return(true); } return(false); } const string OpenALLink = "https://www.openal.org/downloads/"; const string DotNetLink = "https://www.microsoft.com/ru-RU/download/details.aspx?id=42643"; if (OSInfo.FrameworkVersion >= new Version(4, 0, 30319, 34000)) // 4.5.2 { if (!IsOpenALInstalled()) { if (MessageBox.Show(LocalizationUI.GetString("SomethingNotFoundError", "OpenAL 1.1", OpenALLink), LocalizationUI.GetString("SomethingNotFoundErrorTitle"), MessageBoxButtons.YesNo) == DialogResult.Yes) { Process.Start(OpenALLink); this.SafeInvoke(Close); return; } } } else { if (MessageBox.Show(LocalizationUI.GetString("SomethingNotFoundError", "Microsoft .NET Framework 4.5.2", DotNetLink), LocalizationUI.GetString("SomethingNotFoundErrorTitle"), MessageBoxButtons.YesNo) == DialogResult.Yes) { Process.Start(DotNetLink); this.SafeInvoke(Close); return; } } if (CurrentProfile.IsSupportingGameJolt && !(await GameJolt.IsSessionActiveAsync()).Success) { using (var gameJoltMessageBox = new GameJoltForm(Settings)) { switch (gameJoltMessageBox.ShowDialog()) { case DialogResult.Yes: ReloadSettings(); if (!await OpenGameJoltSessionAsync()) { return; } break; case DialogResult.Cancel: return; } } } if (Settings.GameCheckServer && CurrentProfile.ProfileType == ProfileType.Game) { new ProfileGameServerListFile(new ProfileGameSaveFolder(CurrentProfile.Folder)).CheckServers(); } if (CurrentProfile.ExecutionFile != null) { var gameJoltArgs = CurrentProfile.IsSupportingGameJolt ? LaunchArgsHandler.CreateArgs(GameJolt.GameJoltYaml, false) : ""; CurrentProfile.ExecutionFile.Start($"{gameJoltArgs} {CurrentProfile.LaunchArgs}"); this.SafeInvoke(Close); return; } else { Button_StartGame.Enabled = false; if (await DownloadCurrentProfileAsync()) { Button_Start_Click(sender, e); } else { Button_StartGame.Enabled = true; } } }
private void Label_QuestionToken_Click(object sender, EventArgs e) => ToolTip_WatermarkTextBox_Token.Show(LocalizationUI.GetString("mf_label_token_hint"), Label_QuestionToken);
private void Start() { _localizationUI = GetComponent <LocalizationUI>(); }