private void DownloadableModsList_SelectedIndexChanged(object sender, EventArgs e) { InstallButton.Show(); CheckButton.Show(); UpdateButton.Hide(); ModVer.Hide(); Delete.Hide(); DisEnaButton.Hide(); try { trycatchtext(SelectedModText, "Selected Mod: " + DownloadableModsList.SelectedItems[0].Text); trycatchtext(ModInfo, DownloadableModsList.SelectedItems[0].SubItems[3].Text); impModID = new string[DownloadableModsList.SelectedItems.Count]; for (int i = 0; i < DownloadableModsList.SelectedItems.Count; i++) { impModID[i] = DownloadableModsList.SelectedItems[i].SubItems[4].Text; } } catch { // ignored } }
void ReleaseDesignerOutlets() { if (InstallButton != null) { InstallButton.Dispose(); InstallButton = null; } if (UninstallButton != null) { UninstallButton.Dispose(); UninstallButton = null; } if (ChooseFolderButton != null) { ChooseFolderButton.Dispose(); ChooseFolderButton = null; } if (FolderPathTextField != null) { FolderPathTextField.Dispose(); FolderPathTextField = null; } }
private void InstallButton_Click(object sender, EventArgs e) { var random = new Random(); int CurrentProgressVal = 3; InstallButton.Hide(); label1.Text = "Installing..."; label2.Text = "Sit back and relax.........."; PercentComplete.Text = "0% Complete"; InstallProgressBar.Show(); PercentComplete.Show(); WarningMessage(); PercentComplete.Text = "3% complete"; InstallProgressBar.Value = 3; WarningMessage(); while (!(InstallProgressBar.Value >= 100)) { CurrentProgressVal = random.Next(CurrentProgressVal, CurrentProgressVal + 20); if (CurrentProgressVal < 100) { InstallProgressBar.Value = CurrentProgressVal; PercentComplete.Text = CurrentProgressVal + "% complete"; } WarningMessage(); Task.Delay(2000); } }
private void LoadGUI(object sender, EventArgs e) { InitTimer(); //progress timer AllocConsole(); //enables console JsonCommon.OverrideModInstallerVariables(); //overrides vars if possible //check if in vs string dir = Directory.GetCurrentDirectory(); for (int i = 0; i < 3; i++) { dir = Directory.GetParent(dir).ToString(); //move up 3 dirs } dir += @"\bin\"; //add bin Console.WriteLine(ModInstallerCommon.Files.MainFiledir); Console.WriteLine("Detecting for" + ModInstallerCommon.Files.execdir); if (!File.Exists(ModInstallerCommon.Files.execdir) && !ModInstallerCommon.BypassExec && !Directory.Exists(dir)) { MessageBox.Show("ModInstaller cannot find the executable! Make sure my location is in a folder inside the h3vr directory! Just in case, I'll pull up a tutorial for you.", "Exectuable not found!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); var psi = new ProcessStartInfo { FileName = "https://youtu.be/LBcxS_mYLFE?t=21", UseShellExecute = true }; Process.Start(psi); Application.Exit(); } var onlineversion = new Version(JsonModList.GetDeserializedModListFormatOnline(JsonCommon.DatabaseInfo).Modlist[0].Version); if (ModInstallerCommon.ModInstallerVersion.CompareTo(onlineversion) < 0) { MessageBox.Show("H3VRModInstaller is out of date! (" + ModInstallerCommon.ModInstallerVersion + " vs " + onlineversion + ")", "Wrong version detected!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); var psi = new ProcessStartInfo { FileName = JsonModList.GetDeserializedModListFormatOnline(JsonCommon.DatabaseInfo).Modlist[0].Website, UseShellExecute = true }; Process.Start(psi); } InstallButton.Hide(); UpdateButton.Hide(); ModVer.Hide(); Delete.Hide(); CheckButton.Hide(); InstalledModsList.Hide(); ModsEnabled.Checked = true; UpdateModList(); UpdateCatagories(); }
private void LoadGUI(object sender, EventArgs e) { AllocConsole(); InstallButton.Hide(); UpdateButton.Hide(); ModVer.Hide(); Delete.Hide(); CheckButton.Hide(); InstalledModsList.Hide(); ModsEnabled.Checked = true; UpdateModList(); UpdateCatagories(); }
public Form1() { InitializeComponent(); NameBox.Hide(); NameInput.Hide(); CompanyBox.Hide(); CompanyInput.Hide(); PurposeBox.Hide(); PurposeInput.Hide(); EmailBox.Hide(); EmailInput.Hide(); SubmitDetails.Hide(); InstallButton.Hide(); PercentComplete.Hide(); InstallProgressBar.Hide(); }
// End of functions by Windows Forms private void SubmitDetails_Click(object sender, EventArgs e) { NameBox.Hide(); NameInput.Hide(); CompanyBox.Hide(); CompanyInput.Hide(); PurposeBox.Hide(); PurposeInput.Hide(); EmailBox.Hide(); EmailInput.Hide(); SubmitDetails.Hide(); label1.Text = "Installation"; label2.Text = "Click \"Install\" To install..."; InstallButton.Show(); string DetailsEncoded = EncodeUserDetails(); System.IO.File.WriteAllText(@".\UserDetails.txt", DetailsEncoded); }
private void endInstallation(string reason, bool failed) { InstallProgress.Value = 100; BetaRadio.Hide(); InstallButton.Hide(); UninstallButton.Hide(); UpdateButton.Hide(); ReinjectButton.Hide(); StatusText.Hide(); StatusLabel.Show(); StatusLabel.Text = operation == "UPDATE" ? "Update " + (failed ? "failed" : "complete") : (operation == "UNINSTALL" ? "Unin" : "In") + "stallation " + (failed ? " failed." : "completed!"); StatusLabel.ForeColor = failed ? Color.Red : Color.Lime; StatusLabel2.Show(); StatusLabel2.Text = reason; StatusCloseButton.Show(); if (platform != "Linux") { OpenFolderButton.Show(); } }
private void DownloadableModsList_SelectedIndexChanged(object sender, EventArgs e) { InstallButton.Show(); CheckButton.Show(); UpdateButton.Hide(); ModVer.Hide(); Delete.Hide(); try { trycatchtext(SelectedModText, "Selected Mod: " + DownloadableModsList.SelectedItems[0].Text); trycatchtext(ModInfo, DownloadableModsList.SelectedItems[0].SubItems[3].Text); impModID = DownloadableModsList.SelectedItems[0].SubItems[4].Text; } catch (Exception exception) { //sike lmao } }
private void Reinstall_Click(object sender, EventArgs e) { if (UserPreferences.Current.ShouldUseBetaPath) { UserPreferences.Current.ResetBetaSourceDirectory(); } StatusLabel.Hide(); installedModsView.Hide(); installedModsTitle.Hide(); InstallButton.Hide(); CloseButton.Hide(); Reinstall.Hide(); modBotSettingsButton.Hide(); LocalVersionLabel.Hide(); LatestVersionLabel.Hide(); ProgressBar.Show(); installingModBotLabel.Show(); ModBotInstallerManager.ProgressBar = ProgressBar; ModBotInstallerManager.Install(UserPreferences.Current.GameInstallationDirectory, OnInstallFinished); }
private void LoadGUI(object sender, EventArgs e) { KeyDown += Form_KeyDown; if (!File.Exists(Utilities.ModCache)) { MessageBox.Show("Thank you for downloading H3VRModInstaller!\nIf there are any issues, or if you want a mod added, please hit us up on the Homebrew discord (@Frityet and @Potatoes)", "Thank you!", MessageBoxButtons.OK, MessageBoxIcon.Information); } InitTimer(); //progress timer //AllocConsole(); //enables console JsonCommon.OverrideModInstallerVariables(); //overrides vars if possible var onlineversion = new Version(JsonModList.GetDeserializedModListFormatOnline(JsonCommon.DatabaseInfo) .Modlist[0].Version); if (ModInstallerCommon.ModInstallerVersion.CompareTo(onlineversion) < 0) { MessageBox.Show("H3VRModInstaller is out of date! (" + ModInstallerCommon.ModInstallerVersion + " vs " + onlineversion + ")", "Out of date version detected!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); var psi = new ProcessStartInfo { FileName = JsonModList.GetDeserializedModListFormatOnline(JsonCommon.DatabaseInfo) .Modlist[0] .Website, UseShellExecute = true }; Process.Start(psi); } InstallButton.Hide(); UpdateButton.Hide(); ModVer.Hide(); Delete.Hide(); CheckButton.Hide(); UpdateModList(); UpdateCatagories(); CatagoriesComboBox.SelectedIndex = 0; }
private void LoadGUI(object sender, EventArgs e) { KeyDown += Form_KeyDown; if (!File.Exists(Utilities.ModCache)) { MessageBox.Show("Thank you for downloading H3VRModInstaller!\nIf there are any issues, or if you want a mod added, please hit us up on the Homebrew discord (@Frityet and @Potatoes)", "Thank you!", MessageBoxButtons.OK, MessageBoxIcon.Information); } InitTimer(); //progress timer //AllocConsole(); //enables console InstallButton.Hide(); UpdateButton.Hide(); ModVer.Hide(); Delete.Hide(); CheckButton.Hide(); UpdateModList(); UpdateCatagories(); DisEnaButton.Hide(); CatagoriesComboBox.SelectedIndex = 0; }
private void InstallButton_Click(object sender, EventArgs e) { if ((_installationState != ModBotInstallationState.UpToDate && _installationState != ModBotInstallationState.BetaVersion) || UserPreferences.Current.ShouldUseBetaPath) { StatusLabel.Hide(); installedModsView.Hide(); installedModsTitle.Hide(); InstallButton.Hide(); CloseButton.Hide(); Reinstall.Hide(); modBotSettingsButton.Hide(); LocalVersionLabel.Hide(); LatestVersionLabel.Hide(); ProgressBar.Show(); installingModBotLabel.Show(); ModBotInstallerManager.ProgressBar = ProgressBar; ModBotInstallerManager.Install(UserPreferences.Current.GameInstallationDirectory, OnInstallFinished); } else { StartGameAndExit(); } }
private void ItemListView_ItemActivate(object sender, EventArgs e) { InstallButton.PerformClick(); }
public InstallerMainWindow(Installer installer) { Opacity = 0; Installer = installer; InitializeComponent(); CloseOption.IsChecked = (CoApp.Toolkit.Configuration.RegistryView.CoAppUser["Preferences", "Autoclose"].BoolValue); OrganizationName.SetBinding(TextBlock.TextProperty, new Binding("Organization") { Source = Installer }); ProductName.SetBinding(TextBlock.TextProperty, new Binding("Product") { Source = Installer }); // package icon disabled until after RC // PackageIcon.SetBinding(Image.SourceProperty, new Binding("PackageIcon") { Source = Installer }); DescriptionText.SetBinding(TextBlock.TextProperty, new Binding("Description") { Source = Installer }); WhichVersionToInstall.SetBinding(ItemsControl.ItemsSourceProperty, new Binding("InstallChoices") { Source = Installer }); WhichVersionToInstall.DisplayMemberPath = "Value"; WhichVersionToInstall.SelectedValuePath = "Package"; WhichVersionToInstall.SetBinding(Selector.SelectedValueProperty, new Binding("SelectedPackage") { Source = Installer }); WhichVersionToInstall.SelectedIndex = 0; ProductVersion.SetBinding(TextBlock.TextProperty, new Binding("ProductVersion") { Source = Installer }); InstallButton.SetBinding(IsEnabledProperty, new Binding("ReadyToInstall") { Source = Installer }); InstallButton.SetBinding(ToolTipProperty, new Binding("InstallButtonText") { Source = Installer }); InstallText.SetBinding(TextBlock.TextProperty, new Binding("InstallButtonText") { Source = Installer }); RemoveButton.SetBinding(VisibilityProperty, new Binding("RemoveButtonVisibility") { Source = Installer }); RemoveAdvanced.SetBinding(VisibilityProperty, new Binding("RemoveButtonVisibility") { Source = Installer }); InstallationProgress.SetBinding(RangeBase.ValueProperty, new Binding("Progress") { Source = Installer }); CancelButton.SetBinding(VisibilityProperty, new Binding("CancelButtonVisibility") { Source = Installer }); CancelText.SetBinding(TextBlock.TextProperty, new Binding("CancelButtonText") { Source = Installer }); StatusText.SetBinding(TextBlock.TextProperty, new Binding("StatusText") { Source = Installer }); RemoveContextMenu.SetBinding(ItemsControl.ItemsSourceProperty, new Binding("RemoveChoices") { Source = Installer }); try { VisibilityAnimation.SetAnimationType(RemoveButton, VisibilityAnimation.AnimationType.Fade); VisibilityAnimation.SetAnimationType(InstallButton, VisibilityAnimation.AnimationType.Fade); VisibilityAnimation.SetAnimationType(InstallationProgress, VisibilityAnimation.AnimationType.Fade); VisibilityAnimation.SetAnimationType(StatusText, VisibilityAnimation.AnimationType.Fade); VisibilityAnimation.SetAnimationType(CloseOption, VisibilityAnimation.AnimationType.Fade); VisibilityAnimation.SetAnimationType(WhichVersionToInstall, VisibilityAnimation.AnimationType.Fade); VisibilityAnimation.SetAnimationType(CancelButton, VisibilityAnimation.AnimationType.Fade); } catch { } Loaded += (x, y) => { Installer.Ping = true; ShowInTaskbar = true; Topmost = false; ((Storyboard)FindResource("showWindow")).Begin(); if (WhichVersionToInstall.Items.Count == 0) { WhichVersionToInstall.Visibility = Visibility.Hidden; } else { if (WhichVersionToInstall.SelectedIndex == -1) { WhichVersionToInstall.SelectedIndex = 0; } } }; Installer.Finished += (src, evnt) => Invoke(() => { if (Installer.Passive || (CoApp.Toolkit.Configuration.RegistryView.CoAppUser["Preferences", "Autoclose"].BoolValue)) { ActuallyClose(); } else { WaitForClose(); } }); }
private void InstallButton_Click(object sender, EventArgs e) { if (BetaRadio.Checked) { branch = "beta"; } BetaRadio.Hide(); InstallButton.Hide(); UninstallButton.Hide(); UpdateButton.Hide(); ReinjectButton.Hide(); StatusText.Show(); InstallProgress.Show(); StatusText.Text = "Finding Discord processes..."; Process[] stable = Process.GetProcessesByName("Discord"); Process[] canary = Process.GetProcessesByName("DiscordCanary"); Process[] ptb = Process.GetProcessesByName("DiscordPtb"); Process[] dev = Process.GetProcessesByName("DiscordDevelopment"); List <Process> discordProcesses = new List <Process>(); discordProcesses.AddRange(stable); discordProcesses.AddRange(canary); discordProcesses.AddRange(ptb); discordProcesses.AddRange(dev); if (discordProcesses.Count == 0) { endInstallation("No Discord processes found. Please open Discord and try again.", true); return; } List <Process> uniqueProcesses = new List <Process>(); // First look for processes with unique filenames that have a title for (int i = 0; i < discordProcesses.Count; i++) { bool isUnique = true; for (int j = 0; j < uniqueProcesses.Count; j++) { if (uniqueProcesses[j].MainModule.FileName.Equals(discordProcesses[i].MainModule.FileName)) { isUnique = false; break; } } if (!isUnique || discordProcesses[i].MainWindowTitle == "" || discordProcesses[i].MainWindowTitle.StartsWith("Developer Tools")) { continue; } uniqueProcesses.Add(discordProcesses[i]); } // Then look for all processes with unique filenames for (int i = 0; i < discordProcesses.Count; i++) { bool isUnique = true; for (int j = 0; j < uniqueProcesses.Count; j++) { if (uniqueProcesses[j].MainModule.FileName.Equals(discordProcesses[i].MainModule.FileName)) { isUnique = false; break; } } if (!isUnique) { continue; } uniqueProcesses.Add(discordProcesses[i]); } StatusText.Text = "Found " + uniqueProcesses.Count + " Discord process" + (uniqueProcesses.Count == 1 ? "" : "es") + "."; InstallProgress.Value = 10; Process finalProcess = uniqueProcesses[0]; if (uniqueProcesses.Count > 1) { // Enable selection buttons List <Button> clients = new List <Button>(); for (int i = 0; i < uniqueProcesses.Count; i++) { if (canary.Contains(uniqueProcesses[i])) { CanaryButton.Show(); clients.Add(CanaryButton); canaryProcess = uniqueProcesses[i]; } else if (ptb.Contains(uniqueProcesses[i])) { PTBButton.Show(); clients.Add(PTBButton); ptbProcess = uniqueProcesses[i]; } else if (dev.Contains(uniqueProcesses[i])) { DevButton.Show(); clients.Add(DevButton); devProcess = uniqueProcesses[i]; } else if (stable.Contains(uniqueProcesses[i])) { StableButton.Show(); clients.Add(StableButton); stableProcess = uniqueProcesses[i]; } } // position buttons correctly if (clients.Count == 3) { clients[0].Left = 55; clients[1].Left = 131; clients[2].Left = 207; } else if (clients.Count == 2) { clients[0].Left = 88; clients[1].Left = 164; } return; // stuff continues w/ button events } if (operation == "UPDATE") { continueUpdate(finalProcess); } else { continueInstall(finalProcess); } }
/// <summary> /// Click the Install button /// </summary> public void ClickInstallButton() { InstallButton.WaitRetry(_driver).WaitAndClick(_driver); }
async private void continueUpdate(Process proc) { string path = proc.MainModule.FileName; operation = "UPDATE"; BetaRadio.Hide(); InstallButton.Hide(); UninstallButton.Hide(); UpdateButton.Hide(); ReinjectButton.Hide(); StatusText.Show(); InstallProgress.Show(); InstallProgress.Value = 0; string tempPath = Path.Combine(Path.GetTempPath(), "EnhancedDiscord"); if (Directory.Exists(tempPath)) { try { Directory.Delete(tempPath, true); } catch (Exception e) { StatusText.Text = "Error deleting temp folders."; Logger.Log(StatusText.Text + " " + e.Message); } } Directory.CreateDirectory(tempPath); StatusText.Text = "Downloading package..."; Logger.Log(StatusText.Text); string zipPath = Path.Combine(tempPath, "EnhancedDiscord.zip"); string zipLink = Properties.Resources.zipLink + branch; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3; WebClient wc = new WebClient(); try { await wc.DownloadFileTaskAsync(new Uri(zipLink), zipPath); } catch (Exception e) { Logger.Error("Failed to download ED files. " + e.Message); endInstallation("Failed to download ED files.", true); return; } InstallProgress.Value = 40; StatusText.Text = "Successfully downloaded. Extracting..."; Logger.Log(StatusText.Text); try { ZipFile.ExtractToDirectory(zipPath, tempPath); } catch (Exception e) { Logger.Error("Failed to extract zip file. " + e.Message); endInstallation("Failed to extract zip file.", true); return; } InstallProgress.Value = 50; StatusText.Text = "Finished extracting zip. Checking core..."; Logger.Log(StatusText.Text); string extractedPath = Path.Combine(tempPath, "EnhancedDiscord-" + branch); string enhancedPath = "./EnhancedDiscord"; if (!File.Exists(Path.Combine(enhancedPath, "config.json"))) { try { File.WriteAllText(Path.Combine(enhancedPath, "config.json"), "{}"); } catch (Exception e) { Logger.Error("Failed to write config.json. " + e.Message); } } string[] garbage = new string[] { "README.md", "plugins.md", ".gitignore", "advanced_installation.md" }; foreach (string file in Directory.GetFiles(extractedPath)) { string filename = Path.GetFileName(file); if (Array.Exists(garbage, f => f == filename)) { continue; } string equiv = Path.Combine(enhancedPath, filename); bool filesEqual = false; bool fileExists = File.Exists(equiv); if (fileExists) { filesEqual = FilesEqual(file, equiv); } try { if (fileExists && !filesEqual) { File.Delete(equiv); } if (!fileExists || !filesEqual) { File.Copy(file, equiv); } } catch (Exception e) { StatusText.Text = "Could not update plugin: " + filename; Logger.Log(StatusText.Text + " " + e.Message); } } InstallProgress.Value = 70; StatusText.Text = "Core finished. Checking plugins..."; Logger.Log(StatusText.Text); string pluginPath = Path.Combine(enhancedPath, "plugins"); if (!Directory.Exists(pluginPath)) { Directory.CreateDirectory(pluginPath); } foreach (string file in Directory.GetFiles(Path.Combine(extractedPath, "plugins"))) { string filename = Path.GetFileName(file); if (filename == "style.css") { continue; } string equiv = Path.Combine(pluginPath, filename); bool filesEqual = false; bool fileExists = File.Exists(equiv); if (fileExists) { filesEqual = FilesEqual(file, equiv); } try { if (fileExists && !filesEqual) { File.Delete(equiv); } if (!fileExists || !filesEqual) { File.Copy(file, equiv); } } catch (Exception e) { StatusText.Text = "Could not update plugin: " + filename; Logger.Log(StatusText.Text + " " + e.Message); } } StatusText.Text = "Cleaning up..."; Logger.Log(StatusText.Text); if (Directory.Exists(tempPath)) { try { Directory.Delete(tempPath, true); } catch (Exception e) { StatusText.Text = "Error deleting temp folders."; Logger.Log(StatusText.Text + " " + e.Message); } } InstallProgress.Value = 90; endInstallation("ED files updated.", false); return; }
void refreshItemsBasedOnCurrentState() { switch (_installationState) { case ModBotInstallationState.NotInstalled: StatusLabel.Text = "Mod-Bot not installed"; StatusLabel.ForeColor = Color.FromArgb(252, 124, 0); InstallButton.Show(); InstallButton.Text = "Install Mod-Bot"; Reinstall.Hide(); break; case ModBotInstallationState.OutOfDate: StatusLabel.Text = "Mod-Bot out of date"; StatusLabel.ForeColor = Color.FromArgb(255, 255, 0); InstallButton.Show(); InstallButton.Text = "Update Mod-Bot"; Reinstall.Hide(); break; case ModBotInstallationState.UpToDate: InstallButton.Show(); InstallButton.Text = "Start Game"; Reinstall.Show(); Reinstall.Text = "Reinstall"; StatusLabel.Text = "Mod-Bot up to date!"; StatusLabel.ForeColor = Color.FromArgb(124, 252, 0); break; case ModBotInstallationState.BetaVersion: InstallButton.Show(); InstallButton.Text = "Start Game (beta)"; Reinstall.Text = "Reinstall stable"; StatusLabel.Text = "Mod-Bot beta installed"; StatusLabel.ForeColor = Color.FromArgb(255, 0, 255); break; case ModBotInstallationState.UnableToVerify: StatusLabel.Text = "Unable to check latest Mod-Bot version"; StatusLabel.ForeColor = Color.FromArgb(125, 0, 125); InstallButton.Show(); InstallButton.Text = "Start Game"; Reinstall.Hide(); break; } if (UserPreferences.Current.ShouldUseBetaPath) { InstallButton.Text = "Start (beta)"; Reinstall.Text = "Start (non beta)"; } InstallButton.Visible = _numCurrentlyLoadingModItems == 0 && _numCurrentlyUpdatingModItems == 0 && (_missingModDependencies == null || _missingModDependencies.Count == 0); Reinstall.Visible = _numCurrentlyLoadingModItems == 0 && _numCurrentlyUpdatingModItems == 0 && (_missingModDependencies == null || _missingModDependencies.Count == 0); installedModsLoading.Visible = _numCurrentlyLoadingModItems > 0; if (!_hasInitializedInstalledModsView && _installationState != ModBotInstallationState.Failed && _installationState != ModBotInstallationState.NotInstalled) { initializeInstalledModsView(); } }