From 08378b30a193c61cc95aed4f8ce03a2d3933a5cc Mon Sep 17 00:00:00 2001 From: Cosma Cosmin Date: Wed, 5 May 2021 00:12:46 +0300 Subject: [PATCH] added QuickSearch that searches for game path in local registry --- .../QuickSearch.cs | 107 +++++++++ .../SystemFunctions.cs | 10 + .../AmongUsModUpdater/MainWindow.Designer.cs | 216 +++++++++++------- .../AmongUsModUpdater/MainWindow.cs | 15 ++ 4 files changed, 263 insertions(+), 85 deletions(-) create mode 100644 source/GuiVersion/AmongUsModUpdater.ModFunctions/QuickSearch.cs diff --git a/source/GuiVersion/AmongUsModUpdater.ModFunctions/QuickSearch.cs b/source/GuiVersion/AmongUsModUpdater.ModFunctions/QuickSearch.cs new file mode 100644 index 0000000..0b63285 --- /dev/null +++ b/source/GuiVersion/AmongUsModUpdater.ModFunctions/QuickSearch.cs @@ -0,0 +1,107 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using System.ComponentModel; +using System.IO; +using WinForms.Logger; +using Microsoft.Win32; + +namespace AmongUsModUpdater.UpdaterFunctions +{ + public class QuickSearch + { + private dynamic mainWindow; + private BackgroundWorker worker; + + public QuickSearch(dynamic mainWindow) + { + this.mainWindow = mainWindow; + this.mainWindow.ProgressBarSearch.Visible = true; + this.mainWindow.LabelProcessedDrives.Visible = true; + this.mainWindow.ButtonWorkerCancel.Visible = true; + this.mainWindow.ButtonWorkerCancel.Enabled = true; + this.mainWindow.SettingsButtonQuickSearch.Enabled = false; + this.worker = new BackgroundWorker(); + worker.DoWork += new DoWorkEventHandler(this.backgroundWorker1_DoWork); + worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(this.backgroundWorker1_RunComplete); + worker.ProgressChanged += new ProgressChangedEventHandler(this.backgroundWorker1_ProgressChanged); + worker.WorkerReportsProgress = true; + worker.WorkerSupportsCancellation = true; + } + public void startAsyncWorker() + { + worker.RunWorkerAsync(); + } + public void cancelAsyncWorker() + { + // Cancel the asynchronous operation. + worker.CancelAsync(); + } + private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e) + { + ProgressArgument progressArgument = (ProgressArgument)e.UserState; + this.mainWindow.LabelProcessedDrives.Text = "Searching in registry " + progressArgument.count + " of " + progressArgument.allDrivesLength; + } + private void backgroundWorker1_RunComplete(object sender, RunWorkerCompletedEventArgs ex) + { + if (ex.Cancelled) + { + this.mainWindow.LabelProcessedDrives.Visible = false; + this.mainWindow.ProgressBarSearch.Visible = false; + this.mainWindow.ButtonWorkerCancel.Visible = false; + this.mainWindow.SettingsButtonQuickSearch.Enabled = true; + this.mainWindow.LabelProcessedDrives.Text = "Searching in registry ..."; + worker = new BackgroundWorker(); + return; + } + if (ex.Result != null) + { + this.mainWindow.SettingsGamePathTextBox.Text = ex.Result.ToString(); + worker = new BackgroundWorker(); + } + else + { + string message = "The Among Us.exe could not be found. Please search for it manually or install the game."; + string caption = "Error"; + MessageBoxButtons buttons = MessageBoxButtons.OK; + DialogResult response = MessageBox.Show(message, caption, buttons); + this.mainWindow.SettingsGamePathTextBox.Text = ""; + worker = new BackgroundWorker(); + } + this.mainWindow.LabelProcessedDrives.Visible = false; + this.mainWindow.ProgressBarSearch.Visible = false; + this.mainWindow.ButtonWorkerCancel.Visible = false; + this.mainWindow.SettingsButtonQuickSearch.Enabled = true; + worker = new BackgroundWorker(); + } + private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs ex) + { + string path = ""; + try + { + var options = new EnumerationOptions() + { + IgnoreInaccessible = true, + RecurseSubdirectories = false + }; + var installPath = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Wow6432Node\\Valve\\Steam", false).GetValue("InstallPath"); + if (installPath != null && !installPath.Equals(string.Empty)) + { + path = installPath + @"\steamapps\common\Among Us"; + if(Directory.Exists(path)) + if (Directory.GetFiles(path, @"Among Us.exe", options).Any()) + ex.Result = path; + } + ex.Result = path; + } + catch (Exception e) + { + Logger.Log(null, e); + } + + } + } +} diff --git a/source/GuiVersion/AmongUsModUpdater.ModFunctions/SystemFunctions.cs b/source/GuiVersion/AmongUsModUpdater.ModFunctions/SystemFunctions.cs index 9135280..88f3eaa 100644 --- a/source/GuiVersion/AmongUsModUpdater.ModFunctions/SystemFunctions.cs +++ b/source/GuiVersion/AmongUsModUpdater.ModFunctions/SystemFunctions.cs @@ -12,6 +12,7 @@ namespace AmongUsModUpdater.UpdaterFunctions public class SystemFunctions { private static AutomatedSearch automatedSearch; + private static QuickSearch quickSearch; public static void switchPanelVisibility(int y, Panel[] menuPanels, Button[] menuButtons, Panel panelMenuActive) { @@ -47,6 +48,15 @@ public static void cancelAutomatedSearch() { automatedSearch.cancelAsyncWorker(); } + public static void startQuickSearch(dynamic mainWindow) + { + quickSearch = new QuickSearch(mainWindow); + quickSearch.startAsyncWorker(); + } + public static void cancelQuickSearch() + { + quickSearch.cancelAsyncWorker(); + } public static async Task copyFolder(string sourceFolder, string destFolder) { if (!Directory.Exists(destFolder)) diff --git a/source/GuiVersion/AmongUsModUpdater/MainWindow.Designer.cs b/source/GuiVersion/AmongUsModUpdater/MainWindow.Designer.cs index 5c17aac..6bf458f 100644 --- a/source/GuiVersion/AmongUsModUpdater/MainWindow.Designer.cs +++ b/source/GuiVersion/AmongUsModUpdater/MainWindow.Designer.cs @@ -41,6 +41,7 @@ private void InitializeComponent() this.downloadProgress = new System.Windows.Forms.ProgressBar(); this.buttonHomeStart = new CustomButton.CustomButton(); this.panelSettings = new System.Windows.Forms.Panel(); + this.settingsButtonQuickSearch = new CustomButton.CustomButton(); this.settingsOpenFolder = new CustomButton.CustomButton(); this.buttonWorkerCancel = new System.Windows.Forms.Button(); this.labelProcessedDrives = new System.Windows.Forms.Label(); @@ -83,10 +84,10 @@ private void InitializeComponent() this.homeButton.FlatAppearance.BorderSize = 0; this.homeButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.homeButton.ForeColor = System.Drawing.Color.White; - this.homeButton.Location = new System.Drawing.Point(0, 100); - this.homeButton.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.homeButton.Location = new System.Drawing.Point(0, 60); + this.homeButton.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0); this.homeButton.Name = "homeButton"; - this.homeButton.Size = new System.Drawing.Size(226, 125); + this.homeButton.Size = new System.Drawing.Size(158, 75); this.homeButton.TabIndex = 5; this.homeButton.Text = "Home"; this.homeButton.UseVisualStyleBackColor = true; @@ -97,10 +98,10 @@ private void InitializeComponent() this.settingsButton.FlatAppearance.BorderSize = 0; this.settingsButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.settingsButton.ForeColor = System.Drawing.Color.White; - this.settingsButton.Location = new System.Drawing.Point(0, 225); - this.settingsButton.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.settingsButton.Location = new System.Drawing.Point(0, 135); + this.settingsButton.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0); this.settingsButton.Name = "settingsButton"; - this.settingsButton.Size = new System.Drawing.Size(226, 125); + this.settingsButton.Size = new System.Drawing.Size(158, 75); this.settingsButton.TabIndex = 6; this.settingsButton.Text = "Settings"; this.settingsButton.UseVisualStyleBackColor = true; @@ -111,10 +112,10 @@ private void InitializeComponent() this.helpButton.FlatAppearance.BorderSize = 0; this.helpButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.helpButton.ForeColor = System.Drawing.Color.White; - this.helpButton.Location = new System.Drawing.Point(0, 350); - this.helpButton.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.helpButton.Location = new System.Drawing.Point(0, 210); + this.helpButton.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0); this.helpButton.Name = "helpButton"; - this.helpButton.Size = new System.Drawing.Size(226, 125); + this.helpButton.Size = new System.Drawing.Size(158, 75); this.helpButton.TabIndex = 7; this.helpButton.Text = "Help"; this.helpButton.UseVisualStyleBackColor = true; @@ -128,10 +129,9 @@ private void InitializeComponent() this.panelHome.Controls.Add(this.otherRolesBanner); this.panelHome.Controls.Add(this.downloadProgress); this.panelHome.Controls.Add(this.buttonHomeStart); - this.panelHome.Location = new System.Drawing.Point(246, 100); - this.panelHome.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.panelHome.Location = new System.Drawing.Point(172, 60); this.panelHome.Name = "panelHome"; - this.panelHome.Size = new System.Drawing.Size(754, 620); + this.panelHome.Size = new System.Drawing.Size(528, 372); this.panelHome.TabIndex = 8; this.panelHome.Visible = false; this.panelHome.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelMenu_MouseDown); @@ -147,10 +147,11 @@ private void InitializeComponent() this.buttonHomeInstall.ForeColor = System.Drawing.Color.White; this.buttonHomeInstall.Inactive1 = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(72)))), ((int)(((byte)(33))))); this.buttonHomeInstall.Inactive2 = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(72)))), ((int)(((byte)(33))))); - this.buttonHomeInstall.Location = new System.Drawing.Point(251, 170); + this.buttonHomeInstall.Location = new System.Drawing.Point(176, 102); + this.buttonHomeInstall.Margin = new System.Windows.Forms.Padding(2); this.buttonHomeInstall.Name = "buttonHomeInstall"; this.buttonHomeInstall.Radius = 10; - this.buttonHomeInstall.Size = new System.Drawing.Size(251, 120); + this.buttonHomeInstall.Size = new System.Drawing.Size(176, 72); this.buttonHomeInstall.Stroke = false; this.buttonHomeInstall.StrokeColor = System.Drawing.Color.Gray; this.buttonHomeInstall.TabIndex = 9; @@ -162,9 +163,10 @@ private void InitializeComponent() // waitingInfoForStart // this.waitingInfoForStart.AutoSize = true; - this.waitingInfoForStart.Location = new System.Drawing.Point(173, 377); + this.waitingInfoForStart.Location = new System.Drawing.Point(121, 226); + this.waitingInfoForStart.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.waitingInfoForStart.Name = "waitingInfoForStart"; - this.waitingInfoForStart.Size = new System.Drawing.Size(417, 25); + this.waitingInfoForStart.Size = new System.Drawing.Size(276, 15); this.waitingInfoForStart.TabIndex = 8; this.waitingInfoForStart.Text = "It takes a little while to start Among Us. Please wait."; this.waitingInfoForStart.Visible = false; @@ -179,10 +181,11 @@ private void InitializeComponent() this.buttonHomeUpdate.ForeColor = System.Drawing.Color.White; this.buttonHomeUpdate.Inactive1 = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(72)))), ((int)(((byte)(33))))); this.buttonHomeUpdate.Inactive2 = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(72)))), ((int)(((byte)(33))))); - this.buttonHomeUpdate.Location = new System.Drawing.Point(251, 170); + this.buttonHomeUpdate.Location = new System.Drawing.Point(176, 102); + this.buttonHomeUpdate.Margin = new System.Windows.Forms.Padding(2); this.buttonHomeUpdate.Name = "buttonHomeUpdate"; this.buttonHomeUpdate.Radius = 10; - this.buttonHomeUpdate.Size = new System.Drawing.Size(251, 120); + this.buttonHomeUpdate.Size = new System.Drawing.Size(176, 72); this.buttonHomeUpdate.Stroke = false; this.buttonHomeUpdate.StrokeColor = System.Drawing.Color.Gray; this.buttonHomeUpdate.TabIndex = 5; @@ -194,9 +197,10 @@ private void InitializeComponent() // otherRolesBanner // this.otherRolesBanner.Image = ((System.Drawing.Image)(resources.GetObject("otherRolesBanner.Image"))); - this.otherRolesBanner.Location = new System.Drawing.Point(46, 0); + this.otherRolesBanner.Location = new System.Drawing.Point(32, 0); + this.otherRolesBanner.Margin = new System.Windows.Forms.Padding(2); this.otherRolesBanner.Name = "otherRolesBanner"; - this.otherRolesBanner.Size = new System.Drawing.Size(671, 128); + this.otherRolesBanner.Size = new System.Drawing.Size(470, 77); this.otherRolesBanner.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.otherRolesBanner.TabIndex = 7; this.otherRolesBanner.TabStop = false; @@ -206,10 +210,10 @@ private void InitializeComponent() // // downloadProgress // - this.downloadProgress.Location = new System.Drawing.Point(99, 317); - this.downloadProgress.Margin = new System.Windows.Forms.Padding(14, 17, 14, 17); + this.downloadProgress.Location = new System.Drawing.Point(69, 190); + this.downloadProgress.Margin = new System.Windows.Forms.Padding(10); this.downloadProgress.Name = "downloadProgress"; - this.downloadProgress.Size = new System.Drawing.Size(569, 38); + this.downloadProgress.Size = new System.Drawing.Size(398, 23); this.downloadProgress.TabIndex = 4; this.downloadProgress.Visible = false; // @@ -223,10 +227,11 @@ private void InitializeComponent() this.buttonHomeStart.ForeColor = System.Drawing.Color.White; this.buttonHomeStart.Inactive1 = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(72)))), ((int)(((byte)(33))))); this.buttonHomeStart.Inactive2 = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(72)))), ((int)(((byte)(33))))); - this.buttonHomeStart.Location = new System.Drawing.Point(251, 172); + this.buttonHomeStart.Location = new System.Drawing.Point(176, 103); + this.buttonHomeStart.Margin = new System.Windows.Forms.Padding(2); this.buttonHomeStart.Name = "buttonHomeStart"; this.buttonHomeStart.Radius = 10; - this.buttonHomeStart.Size = new System.Drawing.Size(251, 118); + this.buttonHomeStart.Size = new System.Drawing.Size(176, 71); this.buttonHomeStart.Stroke = false; this.buttonHomeStart.StrokeColor = System.Drawing.Color.Gray; this.buttonHomeStart.TabIndex = 6; @@ -237,6 +242,7 @@ private void InitializeComponent() // // panelSettings // + this.panelSettings.Controls.Add(this.settingsButtonQuickSearch); this.panelSettings.Controls.Add(this.settingsOpenFolder); this.panelSettings.Controls.Add(this.buttonWorkerCancel); this.panelSettings.Controls.Add(this.labelProcessedDrives); @@ -248,15 +254,36 @@ private void InitializeComponent() this.panelSettings.Controls.Add(this.settingsToggleBackup); this.panelSettings.Controls.Add(this.settingsGamePathTextBox); this.panelSettings.Controls.Add(this.labelSettingsPath); - this.panelSettings.Location = new System.Drawing.Point(246, 100); - this.panelSettings.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.panelSettings.Location = new System.Drawing.Point(172, 60); this.panelSettings.Name = "panelSettings"; - this.panelSettings.Size = new System.Drawing.Size(754, 620); + this.panelSettings.Size = new System.Drawing.Size(528, 372); this.panelSettings.TabIndex = 9; this.panelSettings.Visible = false; this.panelSettings.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelMenu_MouseDown); this.panelSettings.MouseMove += new System.Windows.Forms.MouseEventHandler(this.panelMenu_MouseMove); // + // settingsButtonQuickSearch + // + this.settingsButtonQuickSearch.Active1 = System.Drawing.Color.FromArgb(((int)(((byte)(53)))), ((int)(((byte)(151)))), ((int)(((byte)(68))))); + this.settingsButtonQuickSearch.Active2 = System.Drawing.Color.FromArgb(((int)(((byte)(53)))), ((int)(((byte)(151)))), ((int)(((byte)(68))))); + this.settingsButtonQuickSearch.BackColor = System.Drawing.Color.Transparent; + this.settingsButtonQuickSearch.DialogResult = System.Windows.Forms.DialogResult.OK; + this.settingsButtonQuickSearch.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.settingsButtonQuickSearch.ForeColor = System.Drawing.Color.White; + this.settingsButtonQuickSearch.Inactive1 = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(72)))), ((int)(((byte)(33))))); + this.settingsButtonQuickSearch.Inactive2 = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(72)))), ((int)(((byte)(33))))); + this.settingsButtonQuickSearch.Location = new System.Drawing.Point(156, 109); + this.settingsButtonQuickSearch.Margin = new System.Windows.Forms.Padding(2); + this.settingsButtonQuickSearch.Name = "settingsButtonQuickSearch"; + this.settingsButtonQuickSearch.Radius = 10; + this.settingsButtonQuickSearch.Size = new System.Drawing.Size(108, 29); + this.settingsButtonQuickSearch.Stroke = false; + this.settingsButtonQuickSearch.StrokeColor = System.Drawing.Color.Gray; + this.settingsButtonQuickSearch.TabIndex = 13; + this.settingsButtonQuickSearch.Text = "Quick search"; + this.settingsButtonQuickSearch.Transparency = false; + this.settingsButtonQuickSearch.Click += new System.EventHandler(this.settingsButtonQuickSearch_Click); + // // settingsOpenFolder // this.settingsOpenFolder.Active1 = System.Drawing.Color.FromArgb(((int)(((byte)(53)))), ((int)(((byte)(151)))), ((int)(((byte)(68))))); @@ -267,10 +294,11 @@ private void InitializeComponent() this.settingsOpenFolder.ForeColor = System.Drawing.Color.White; this.settingsOpenFolder.Inactive1 = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(72)))), ((int)(((byte)(33))))); this.settingsOpenFolder.Inactive2 = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(72)))), ((int)(((byte)(33))))); - this.settingsOpenFolder.Location = new System.Drawing.Point(543, 182); + this.settingsOpenFolder.Location = new System.Drawing.Point(397, 109); + this.settingsOpenFolder.Margin = new System.Windows.Forms.Padding(2); this.settingsOpenFolder.Name = "settingsOpenFolder"; this.settingsOpenFolder.Radius = 10; - this.settingsOpenFolder.Size = new System.Drawing.Size(199, 48); + this.settingsOpenFolder.Size = new System.Drawing.Size(122, 29); this.settingsOpenFolder.Stroke = false; this.settingsOpenFolder.StrokeColor = System.Drawing.Color.Gray; this.settingsOpenFolder.TabIndex = 12; @@ -283,9 +311,10 @@ private void InitializeComponent() this.buttonWorkerCancel.FlatAppearance.BorderSize = 0; this.buttonWorkerCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.buttonWorkerCancel.ForeColor = System.Drawing.Color.Silver; - this.buttonWorkerCancel.Location = new System.Drawing.Point(551, 377); + this.buttonWorkerCancel.Location = new System.Drawing.Point(386, 226); + this.buttonWorkerCancel.Margin = new System.Windows.Forms.Padding(2); this.buttonWorkerCancel.Name = "buttonWorkerCancel"; - this.buttonWorkerCancel.Size = new System.Drawing.Size(39, 38); + this.buttonWorkerCancel.Size = new System.Drawing.Size(27, 23); this.buttonWorkerCancel.TabIndex = 11; this.buttonWorkerCancel.Text = "X"; this.buttonWorkerCancel.UseVisualStyleBackColor = true; @@ -295,20 +324,18 @@ private void InitializeComponent() // labelProcessedDrives // this.labelProcessedDrives.AutoSize = true; - this.labelProcessedDrives.Location = new System.Drawing.Point(46, 420); - this.labelProcessedDrives.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.labelProcessedDrives.Location = new System.Drawing.Point(32, 252); this.labelProcessedDrives.Name = "labelProcessedDrives"; - this.labelProcessedDrives.Size = new System.Drawing.Size(146, 25); + this.labelProcessedDrives.Size = new System.Drawing.Size(95, 15); this.labelProcessedDrives.TabIndex = 9; this.labelProcessedDrives.Text = "Processed Drives"; this.labelProcessedDrives.Visible = false; // // progressBarSearch // - this.progressBarSearch.Location = new System.Drawing.Point(46, 377); - this.progressBarSearch.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.progressBarSearch.Location = new System.Drawing.Point(32, 226); this.progressBarSearch.Name = "progressBarSearch"; - this.progressBarSearch.Size = new System.Drawing.Size(499, 38); + this.progressBarSearch.Size = new System.Drawing.Size(349, 23); this.progressBarSearch.Style = System.Windows.Forms.ProgressBarStyle.Marquee; this.progressBarSearch.TabIndex = 8; this.progressBarSearch.Visible = false; @@ -323,10 +350,11 @@ private void InitializeComponent() this.settingsButtonAutomated.ForeColor = System.Drawing.Color.White; this.settingsButtonAutomated.Inactive1 = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(72)))), ((int)(((byte)(33))))); this.settingsButtonAutomated.Inactive2 = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(72)))), ((int)(((byte)(33))))); - this.settingsButtonAutomated.Location = new System.Drawing.Point(303, 182); + this.settingsButtonAutomated.Location = new System.Drawing.Point(276, 109); + this.settingsButtonAutomated.Margin = new System.Windows.Forms.Padding(2); this.settingsButtonAutomated.Name = "settingsButtonAutomated"; this.settingsButtonAutomated.Radius = 10; - this.settingsButtonAutomated.Size = new System.Drawing.Size(199, 48); + this.settingsButtonAutomated.Size = new System.Drawing.Size(108, 29); this.settingsButtonAutomated.Stroke = false; this.settingsButtonAutomated.StrokeColor = System.Drawing.Color.Gray; this.settingsButtonAutomated.TabIndex = 7; @@ -344,10 +372,11 @@ private void InitializeComponent() this.settingButtonManual.ForeColor = System.Drawing.Color.White; this.settingButtonManual.Inactive1 = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(72)))), ((int)(((byte)(33))))); this.settingButtonManual.Inactive2 = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(72)))), ((int)(((byte)(33))))); - this.settingButtonManual.Location = new System.Drawing.Point(49, 182); + this.settingButtonManual.Location = new System.Drawing.Point(35, 109); + this.settingButtonManual.Margin = new System.Windows.Forms.Padding(2); this.settingButtonManual.Name = "settingButtonManual"; this.settingButtonManual.Radius = 10; - this.settingButtonManual.Size = new System.Drawing.Size(199, 48); + this.settingButtonManual.Size = new System.Drawing.Size(108, 29); this.settingButtonManual.Stroke = false; this.settingButtonManual.StrokeColor = System.Drawing.Color.Gray; this.settingButtonManual.TabIndex = 6; @@ -359,18 +388,20 @@ private void InitializeComponent() // this.labelSettingsHeader.AutoSize = true; this.labelSettingsHeader.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); - this.labelSettingsHeader.Location = new System.Drawing.Point(46, 47); + this.labelSettingsHeader.Location = new System.Drawing.Point(32, 28); + this.labelSettingsHeader.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.labelSettingsHeader.Name = "labelSettingsHeader"; - this.labelSettingsHeader.Size = new System.Drawing.Size(252, 28); + this.labelSettingsHeader.Size = new System.Drawing.Size(178, 19); this.labelSettingsHeader.TabIndex = 5; this.labelSettingsHeader.Text = "Among Us Game Settings"; // // labelSettingsBackup // this.labelSettingsBackup.AutoSize = true; - this.labelSettingsBackup.Location = new System.Drawing.Point(46, 275); + this.labelSettingsBackup.Location = new System.Drawing.Point(32, 165); + this.labelSettingsBackup.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.labelSettingsBackup.Name = "labelSettingsBackup"; - this.labelSettingsBackup.Size = new System.Drawing.Size(324, 25); + this.labelSettingsBackup.Size = new System.Drawing.Size(212, 15); this.labelSettingsBackup.TabIndex = 4; this.labelSettingsBackup.Text = "Should a copy of the game be created?"; // @@ -380,13 +411,14 @@ private void InitializeComponent() this.settingsToggleBackup.Cursor = System.Windows.Forms.Cursors.Hand; this.settingsToggleBackup.ForeColor = System.Drawing.Color.White; this.settingsToggleBackup.IsOn = false; - this.settingsToggleBackup.Location = new System.Drawing.Point(46, 317); + this.settingsToggleBackup.Location = new System.Drawing.Point(32, 190); + this.settingsToggleBackup.Margin = new System.Windows.Forms.Padding(2); this.settingsToggleBackup.Name = "settingsToggleBackup"; this.settingsToggleBackup.OffColor = System.Drawing.Color.DarkGray; this.settingsToggleBackup.OffText = ""; this.settingsToggleBackup.OnColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(72)))), ((int)(((byte)(33))))); this.settingsToggleBackup.OnText = ""; - this.settingsToggleBackup.Size = new System.Drawing.Size(60, 32); + this.settingsToggleBackup.Size = new System.Drawing.Size(34, 19); this.settingsToggleBackup.TabIndex = 3; this.settingsToggleBackup.Text = "customToggle1"; this.settingsToggleBackup.TextEnabled = true; @@ -399,18 +431,20 @@ private void InitializeComponent() this.settingsGamePathTextBox.Enabled = false; this.settingsGamePathTextBox.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.settingsGamePathTextBox.ForeColor = System.Drawing.Color.DimGray; - this.settingsGamePathTextBox.Location = new System.Drawing.Point(46, 115); + this.settingsGamePathTextBox.Location = new System.Drawing.Point(32, 69); + this.settingsGamePathTextBox.Margin = new System.Windows.Forms.Padding(2); this.settingsGamePathTextBox.Name = "settingsGamePathTextBox"; - this.settingsGamePathTextBox.Size = new System.Drawing.Size(696, 50); + this.settingsGamePathTextBox.Size = new System.Drawing.Size(487, 30); this.settingsGamePathTextBox.TabIndex = 2; this.settingsGamePathTextBox.TextChanged += new System.EventHandler(this.settingsGamePathTextBox_TextChanged); // // labelSettingsPath // this.labelSettingsPath.AutoSize = true; - this.labelSettingsPath.Location = new System.Drawing.Point(46, 87); + this.labelSettingsPath.Location = new System.Drawing.Point(32, 52); + this.labelSettingsPath.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.labelSettingsPath.Name = "labelSettingsPath"; - this.labelSettingsPath.Size = new System.Drawing.Size(459, 25); + this.labelSettingsPath.Size = new System.Drawing.Size(305, 15); this.labelSettingsPath.TabIndex = 1; this.labelSettingsPath.Text = "Please specify the folder where Among Us.exe is located."; // @@ -423,10 +457,9 @@ private void InitializeComponent() this.panelHelp.Controls.Add(this.labelResourcesHeader); this.panelHelp.Controls.Add(this.labelVersionHeader); this.panelHelp.Controls.Add(this.labelVersion); - this.panelHelp.Location = new System.Drawing.Point(246, 100); - this.panelHelp.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.panelHelp.Location = new System.Drawing.Point(172, 60); this.panelHelp.Name = "panelHelp"; - this.panelHelp.Size = new System.Drawing.Size(754, 620); + this.panelHelp.Size = new System.Drawing.Size(528, 372); this.panelHelp.TabIndex = 10; this.panelHelp.Visible = false; this.panelHelp.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelMenu_MouseDown); @@ -436,9 +469,10 @@ private void InitializeComponent() // this.labelCopyright.AutoSize = true; this.labelCopyright.ForeColor = System.Drawing.Color.Silver; - this.labelCopyright.Location = new System.Drawing.Point(46, 250); + this.labelCopyright.Location = new System.Drawing.Point(32, 150); + this.labelCopyright.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.labelCopyright.Name = "labelCopyright"; - this.labelCopyright.Size = new System.Drawing.Size(117, 25); + this.labelCopyright.Size = new System.Drawing.Size(78, 15); this.labelCopyright.TabIndex = 6; this.labelCopyright.Text = "Jolle && Narua"; // @@ -446,9 +480,10 @@ private void InitializeComponent() // this.labelCopyrightHeader.AutoSize = true; this.labelCopyrightHeader.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); - this.labelCopyrightHeader.Location = new System.Drawing.Point(46, 222); + this.labelCopyrightHeader.Location = new System.Drawing.Point(32, 133); + this.labelCopyrightHeader.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.labelCopyrightHeader.Name = "labelCopyrightHeader"; - this.labelCopyrightHeader.Size = new System.Drawing.Size(105, 28); + this.labelCopyrightHeader.Size = new System.Drawing.Size(76, 19); this.labelCopyrightHeader.TabIndex = 5; this.labelCopyrightHeader.Text = "Copyright"; // @@ -458,9 +493,10 @@ private void InitializeComponent() this.linkLabelResourcesGit.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.linkLabelResourcesGit.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline; this.linkLabelResourcesGit.LinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(90)))), ((int)(((byte)(255))))); - this.linkLabelResourcesGit.Location = new System.Drawing.Point(120, 153); + this.linkLabelResourcesGit.Location = new System.Drawing.Point(84, 92); + this.linkLabelResourcesGit.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.linkLabelResourcesGit.Name = "linkLabelResourcesGit"; - this.linkLabelResourcesGit.Size = new System.Drawing.Size(445, 25); + this.linkLabelResourcesGit.Size = new System.Drawing.Size(295, 15); this.linkLabelResourcesGit.TabIndex = 4; this.linkLabelResourcesGit.TabStop = true; this.linkLabelResourcesGit.Text = "https://github.com/Narua2010/AmongUsModUpdater"; @@ -472,9 +508,10 @@ private void InitializeComponent() // this.labelResourcesGit.AutoSize = true; this.labelResourcesGit.ForeColor = System.Drawing.Color.Silver; - this.labelResourcesGit.Location = new System.Drawing.Point(46, 153); + this.labelResourcesGit.Location = new System.Drawing.Point(32, 92); + this.labelResourcesGit.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.labelResourcesGit.Name = "labelResourcesGit"; - this.labelResourcesGit.Size = new System.Drawing.Size(69, 25); + this.labelResourcesGit.Size = new System.Drawing.Size(46, 15); this.labelResourcesGit.TabIndex = 3; this.labelResourcesGit.Text = "Github:"; // @@ -482,9 +519,10 @@ private void InitializeComponent() // this.labelResourcesHeader.AutoSize = true; this.labelResourcesHeader.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); - this.labelResourcesHeader.Location = new System.Drawing.Point(46, 125); + this.labelResourcesHeader.Location = new System.Drawing.Point(32, 75); + this.labelResourcesHeader.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.labelResourcesHeader.Name = "labelResourcesHeader"; - this.labelResourcesHeader.Size = new System.Drawing.Size(107, 28); + this.labelResourcesHeader.Size = new System.Drawing.Size(76, 19); this.labelResourcesHeader.TabIndex = 2; this.labelResourcesHeader.Text = "Resources"; // @@ -492,9 +530,10 @@ private void InitializeComponent() // this.labelVersionHeader.AutoSize = true; this.labelVersionHeader.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); - this.labelVersionHeader.Location = new System.Drawing.Point(46, 33); + this.labelVersionHeader.Location = new System.Drawing.Point(32, 20); + this.labelVersionHeader.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.labelVersionHeader.Name = "labelVersionHeader"; - this.labelVersionHeader.Size = new System.Drawing.Size(201, 28); + this.labelVersionHeader.Size = new System.Drawing.Size(141, 19); this.labelVersionHeader.TabIndex = 1; this.labelVersionHeader.Text = "Version Information"; // @@ -502,9 +541,10 @@ private void InitializeComponent() // this.labelVersion.AutoSize = true; this.labelVersion.ForeColor = System.Drawing.Color.Silver; - this.labelVersion.Location = new System.Drawing.Point(46, 62); + this.labelVersion.Location = new System.Drawing.Point(32, 37); + this.labelVersion.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.labelVersion.Name = "labelVersion"; - this.labelVersion.Size = new System.Drawing.Size(333, 25); + this.labelVersion.Size = new System.Drawing.Size(216, 15); this.labelVersion.TabIndex = 0; this.labelVersion.Text = "Among Us Mod Updater Version: 0.0.0.0"; // @@ -516,8 +556,9 @@ private void InitializeComponent() this.panelMenu.Controls.Add(this.helpButton); this.panelMenu.Dock = System.Windows.Forms.DockStyle.Left; this.panelMenu.Location = new System.Drawing.Point(0, 0); + this.panelMenu.Margin = new System.Windows.Forms.Padding(2); this.panelMenu.Name = "panelMenu"; - this.panelMenu.Size = new System.Drawing.Size(226, 553); + this.panelMenu.Size = new System.Drawing.Size(158, 332); this.panelMenu.TabIndex = 9; this.panelMenu.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelMenu_MouseDown); this.panelMenu.MouseMove += new System.Windows.Forms.MouseEventHandler(this.panelMenu_MouseMove); @@ -527,9 +568,9 @@ private void InitializeComponent() this.panelLogo.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(72)))), ((int)(((byte)(33))))); this.panelLogo.Controls.Add(this.Logo); this.panelLogo.Location = new System.Drawing.Point(0, 0); - this.panelLogo.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3); + this.panelLogo.Margin = new System.Windows.Forms.Padding(2, 2, 0, 2); this.panelLogo.Name = "panelLogo"; - this.panelLogo.Size = new System.Drawing.Size(226, 100); + this.panelLogo.Size = new System.Drawing.Size(158, 60); this.panelLogo.TabIndex = 0; this.panelLogo.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelMenu_MouseDown); this.panelLogo.MouseMove += new System.Windows.Forms.MouseEventHandler(this.panelMenu_MouseMove); @@ -537,9 +578,10 @@ private void InitializeComponent() // Logo // this.Logo.Image = ((System.Drawing.Image)(resources.GetObject("Logo.Image"))); - this.Logo.Location = new System.Drawing.Point(67, 0); + this.Logo.Location = new System.Drawing.Point(47, 0); + this.Logo.Margin = new System.Windows.Forms.Padding(2); this.Logo.Name = "Logo"; - this.Logo.Size = new System.Drawing.Size(97, 100); + this.Logo.Size = new System.Drawing.Size(68, 60); this.Logo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.Logo.TabIndex = 0; this.Logo.TabStop = false; @@ -552,9 +594,10 @@ private void InitializeComponent() this.panelTop.Controls.Add(this.newVersionButton); this.panelTop.Controls.Add(this.buttonExit); this.panelTop.Dock = System.Windows.Forms.DockStyle.Top; - this.panelTop.Location = new System.Drawing.Point(226, 0); + this.panelTop.Location = new System.Drawing.Point(158, 0); + this.panelTop.Margin = new System.Windows.Forms.Padding(2); this.panelTop.Name = "panelTop"; - this.panelTop.Size = new System.Drawing.Size(774, 100); + this.panelTop.Size = new System.Drawing.Size(542, 60); this.panelTop.TabIndex = 10; this.panelTop.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelMenu_MouseDown); this.panelTop.MouseMove += new System.Windows.Forms.MouseEventHandler(this.panelMenu_MouseMove); @@ -569,11 +612,10 @@ private void InitializeComponent() this.newVersionButton.ForeColor = System.Drawing.Color.White; this.newVersionButton.Inactive1 = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(72)))), ((int)(((byte)(33))))); this.newVersionButton.Inactive2 = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(72)))), ((int)(((byte)(33))))); - this.newVersionButton.Location = new System.Drawing.Point(516, 12); - this.newVersionButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.newVersionButton.Location = new System.Drawing.Point(361, 7); this.newVersionButton.Name = "newVersionButton"; this.newVersionButton.Radius = 10; - this.newVersionButton.Size = new System.Drawing.Size(206, 38); + this.newVersionButton.Size = new System.Drawing.Size(144, 23); this.newVersionButton.Stroke = false; this.newVersionButton.StrokeColor = System.Drawing.Color.Gray; this.newVersionButton.TabIndex = 11; @@ -588,9 +630,10 @@ private void InitializeComponent() this.buttonExit.FlatAppearance.BorderSize = 0; this.buttonExit.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.buttonExit.ForeColor = System.Drawing.Color.Silver; - this.buttonExit.Location = new System.Drawing.Point(724, 12); + this.buttonExit.Location = new System.Drawing.Point(507, 7); + this.buttonExit.Margin = new System.Windows.Forms.Padding(2); this.buttonExit.Name = "buttonExit"; - this.buttonExit.Size = new System.Drawing.Size(40, 40); + this.buttonExit.Size = new System.Drawing.Size(28, 24); this.buttonExit.TabIndex = 10; this.buttonExit.Text = "X"; this.buttonExit.UseVisualStyleBackColor = true; @@ -599,18 +642,19 @@ private void InitializeComponent() // panelMenuActive // this.panelMenuActive.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(72)))), ((int)(((byte)(33))))); - this.panelMenuActive.Location = new System.Drawing.Point(226, 100); + this.panelMenuActive.Location = new System.Drawing.Point(158, 60); + this.panelMenuActive.Margin = new System.Windows.Forms.Padding(2); this.panelMenuActive.Name = "panelMenuActive"; - this.panelMenuActive.Size = new System.Drawing.Size(10, 125); + this.panelMenuActive.Size = new System.Drawing.Size(7, 75); this.panelMenuActive.TabIndex = 11; // // MainWindow // - this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F); + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(41)))), ((int)(((byte)(44)))), ((int)(((byte)(51))))); this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; - this.ClientSize = new System.Drawing.Size(1000, 553); + this.ClientSize = new System.Drawing.Size(700, 332); this.Controls.Add(this.panelMenuActive); this.Controls.Add(this.panelTop); this.Controls.Add(this.panelMenu); @@ -621,6 +665,7 @@ private void InitializeComponent() this.ForeColor = System.Drawing.Color.Silver; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Margin = new System.Windows.Forms.Padding(2); this.Name = "MainWindow"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Among Us Mod Updater"; @@ -681,6 +726,7 @@ private void InitializeComponent() public CustomButton.CustomButton buttonHomeInstall; public CustomButton.CustomButton newVersionButton; public CustomButton.CustomButton settingsOpenFolder; + public CustomButton.CustomButton settingsButtonQuickSearch; } } diff --git a/source/GuiVersion/AmongUsModUpdater/MainWindow.cs b/source/GuiVersion/AmongUsModUpdater/MainWindow.cs index 66a2260..46ee367 100644 --- a/source/GuiVersion/AmongUsModUpdater/MainWindow.cs +++ b/source/GuiVersion/AmongUsModUpdater/MainWindow.cs @@ -46,6 +46,10 @@ public CustomButton.CustomButton SettingsButtonAutomated { get { return settingsButtonAutomated; } } + public CustomButton.CustomButton SettingsButtonQuickSearch + { + get { return settingsButtonQuickSearch; } + } public CustomTextBox.CustomTextBox SettingsGamePathTextBox { get { return settingsGamePathTextBox; } @@ -256,6 +260,7 @@ private void settingsButtonAutomated_Click(object sender, EventArgs e) private void cancelAsyncButton_Click(System.Object sender, System.EventArgs e) { SystemFunctions.cancelAutomatedSearch(); + SystemFunctions.cancelQuickSearch(); this.buttonWorkerCancel.Enabled = false; } @@ -305,5 +310,15 @@ private void settingsOpenFolder_Click(object sender, EventArgs e) MessageBoxFunctions.openMessageBox("No game path was specified. Please add it in the settings.", "Error"); } } + + private void settingsButtonQuickSearch_Click(object sender, EventArgs e) + { + DialogResult response = MessageBoxFunctions.openMessageBoxWithResponse("This automatic search only works if you've installed Among Us using Steam. If you didn't install the game using Steam, try using the Automated search", "Attention"); + + if (response == DialogResult.Yes) + { + SystemFunctions.startQuickSearch(this); + } + } } } \ No newline at end of file