From f78d68211cfaeb25c396d3dd43d71aca6ae7f191 Mon Sep 17 00:00:00 2001 From: CreepyCrafter24 <33260128+CreepyCrafter24@users.noreply.github.com> Date: Fri, 20 Mar 2020 13:03:44 +0100 Subject: [PATCH] Fix download-dialog and hide cmd on removal --- UpTool2/MainForm.cs | 7 ++- UpTool2/Program.cs | 5 +-- UpTool2/Tool/AppInstall.cs | 6 ++- UpTool2/Tool/DownloadDialog.Designer.cs | 14 +++--- UpTool2/Tool/DownloadDialog.resx | 59 ------------------------- 5 files changed, 20 insertions(+), 71 deletions(-) diff --git a/UpTool2/MainForm.cs b/UpTool2/MainForm.cs index 78f3601..5532595 100644 --- a/UpTool2/MainForm.cs +++ b/UpTool2/MainForm.cs @@ -72,8 +72,11 @@ namespace UpTool2 ZipFile.ExtractToDirectory(Path.Combine(app, "package.zip"), tmp); Process.Start(new ProcessStartInfo { - FileName = "cmd.exe", Arguments = $"/C \"{Path.Combine(tmp, "Remove.bat")}\"", - WorkingDirectory = Path.Combine(app, "app") + FileName = "cmd.exe", + Arguments = $"/C \"{Path.Combine(tmp, "Remove.bat")}\"", + WorkingDirectory = Path.Combine(app, "app"), + CreateNoWindow = true, + WindowStyle = ProcessWindowStyle.Hidden }).WaitForExit(); Directory.Delete(tmp, true); Directory.Delete(app, true); diff --git a/UpTool2/Program.cs b/UpTool2/Program.cs index e1254de..d205db8 100644 --- a/UpTool2/Program.cs +++ b/UpTool2/Program.cs @@ -65,8 +65,7 @@ namespace UpTool2 string metaXml = XDocument.Load(PathTool.InfoXml).Element("meta").Element("UpdateSource").Value; Online = Ping(metaXml); if (Application.ExecutablePath != PathTool.GetRelative("Install", "UpTool2.dll")) - MessageBox.Show( - $"WARNING!{Environment.NewLine}Running from outside the install directory is not recommended!"); + Splash.Invoke((Action)(() => MessageBox.Show(Splash, $"WARNING!{Environment.NewLine}Running from outside the install directory is not recommended!"))); if (!Directory.Exists(PathTool.GetRelative("Apps"))) Directory.CreateDirectory(PathTool.GetRelative("Apps")); if (!Online) @@ -79,7 +78,7 @@ namespace UpTool2 { try { - Splash.Hide(); + Splash.Invoke((Action)Splash.Hide); } catch { diff --git a/UpTool2/Tool/AppInstall.cs b/UpTool2/Tool/AppInstall.cs index 41e827d..023a6a4 100644 --- a/UpTool2/Tool/AppInstall.cs +++ b/UpTool2/Tool/AppInstall.cs @@ -108,8 +108,10 @@ Online: {appI.Hash.ToUpper()}"); el.Save(Path.Combine(appPath, "info.xml")); Process.Start(new ProcessStartInfo { - FileName = "cmd.exe", Arguments = $"/C \"{Path.Combine(tmp, "Install.bat")}\"", - WorkingDirectory = Path.Combine(appPath, "app"), CreateNoWindow = true, + FileName = "cmd.exe", + Arguments = $"/C \"{Path.Combine(tmp, "Install.bat")}\"", + WorkingDirectory = Path.Combine(appPath, "app"), + CreateNoWindow = true, WindowStyle = ProcessWindowStyle.Hidden }).WaitForExit(); if (GlobalVariables.RelE) diff --git a/UpTool2/Tool/DownloadDialog.Designer.cs b/UpTool2/Tool/DownloadDialog.Designer.cs index 4618625..5c6ce98 100644 --- a/UpTool2/Tool/DownloadDialog.Designer.cs +++ b/UpTool2/Tool/DownloadDialog.Designer.cs @@ -1,4 +1,6 @@ -namespace UpTool2.Tool +using System.Drawing; + +namespace UpTool2.Tool { partial class DownloadDialog { @@ -34,17 +36,18 @@ // // progressBar // - this.progressBar.Location = new System.Drawing.Point(12, 12); + this.progressBar.Dock = System.Windows.Forms.DockStyle.Fill; + this.progressBar.Location = new System.Drawing.Point(0, 0); this.progressBar.Name = "progressBar"; - this.progressBar.Size = new System.Drawing.Size(281, 23); + this.progressBar.Size = new System.Drawing.Size(346, 30); this.progressBar.Step = 1; this.progressBar.TabIndex = 0; // // DownloadDialog // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(305, 46); + this.ClientSize = new System.Drawing.Size(346, 30); this.ControlBox = false; this.Controls.Add(this.progressBar); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; @@ -57,6 +60,7 @@ this.Text = "Downloading..."; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.DownloadDialog_FormClosing); this.ResumeLayout(false); + } #endregion diff --git a/UpTool2/Tool/DownloadDialog.resx b/UpTool2/Tool/DownloadDialog.resx index 1af7de1..e8ae276 100644 --- a/UpTool2/Tool/DownloadDialog.resx +++ b/UpTool2/Tool/DownloadDialog.resx @@ -1,64 +1,5 @@  -