private async Task UpdateArcAndPluginsAsync() { var processes = GetGW2Instances(); if (processes.Count == 0) { SetStatus($"{DateTime.Now.ToString(System.Globalization.CultureInfo.CurrentCulture)}: Updates for installed plugins found, updating..."); foreach (var component in componentsToUpdate) { await component.DownloadComponent(httpController); } if (checkBoxEnableNotifications.Checked && !updateManual) { mainLink.ShowBalloon("arcdps plugin manager", "An update for an installed plugin has been found and has been updated.", 7500); } SetStatus($"{DateTime.Now.ToString(System.Globalization.CultureInfo.CurrentCulture)}: Updates successfully installed."); SetCheckNowButton(true); updateRunning = false; } else { SetStatus($"{DateTime.Now.ToString(System.Globalization.CultureInfo.CurrentCulture)}: Updates for installed plugins found, waiting for GW2 to close..."); if (checkBoxEnableNotifications.Checked && !updateManual) { mainLink.ShowBalloon("arcdps plugin manager", "An updates for installed plugins has been found.\nPlease close GW2 to enable the update.", 7500); } Interlocked.Exchange(ref gw2Instances, processes.Count); foreach (var process in processes) { process.EnableRaisingEvents = true; process.Exited += ProcessExited; } } }
public async Task CheckNewVersionAsync(bool manual = false) { string availableVersionResponse = await mainLink.HttpClientController.DownloadFileToStringAsync("https://deltaconnected.com/arcdps/x64/d3d9.dll.md5sum"); string availableVersion = availableVersionResponse.Split(' ')[0]; if ((availableVersion != "") && (File.Exists($@"{GW2Location}\bin64\d3d9.dll"))) { using (System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create()) { try { if (File.Exists($@"{GW2Location}\bin64\d3d9.dll")) { byte[] hash = null; using (FileStream stream = File.OpenRead($@"{GW2Location}\bin64\d3d9.dll")) { hash = md5.ComputeHash(stream); } if (!BitConverter.ToString(hash).Replace("-", "").ToLower().Equals(availableVersion)) { buttonCheckNow.Enabled = false; groupBoxUpdating.Enabled = true; if (manual) { DialogResult result = MessageBox.Show("New arcdps version available.\nDo you want to download the new version?", "arcdps version checker", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (result.Equals(DialogResult.Yes)) { await UpdateArcAsync(); } } else { if (Properties.Settings.Default.ArcAutoUpdate) { await UpdateArcAsync(); } else { mainLink.ShowBalloon("arcdps version checking", "New version of arcdps available.\nGo to arcdps version checking settings to use the auto-update.", 8500); } } } else { if (manual) { MessageBox.Show("arcdps is up to date.", "arcdps version checker", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } else { buttonCheckNow.Enabled = false; groupBoxUpdating.Enabled = true; if (manual) { DialogResult result = MessageBox.Show("New arcdps version available.\nDo you want to download the new version?", "arcdps version checker", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (result.Equals(DialogResult.Yes)) { await UpdateArcAsync(); } } else { mainLink.ShowBalloon("arcdps version checking", "New version of arcdps available.\nGo to arcdps version checking settings to use the auto-update.", 8500); } } } catch { if (manual) { MessageBox.Show("There has been an error trying to check if arcdps is up to date.", "arcdps version checker", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } else { buttonCheckNow.Enabled = false; groupBoxUpdating.Enabled = true; if (manual) { DialogResult result = MessageBox.Show("New arcdps version available\nDo you want to download the new version?", "arcdps version checker", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (result.Equals(DialogResult.Yes)) { await UpdateArcAsync(); } } } }