From 62b4056745dc273d139fd7338effe4b89298bbd4 Mon Sep 17 00:00:00 2001 From: Thomas G <62822072+Thomasluigi07@users.noreply.github.com> Date: Sat, 22 Oct 2022 09:10:21 +1100 Subject: [PATCH] 1.2 --- ARCHBLOXBootstrapper_XP/Form2.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ARCHBLOXBootstrapper_XP/Form2.cs b/ARCHBLOXBootstrapper_XP/Form2.cs index cb157c1..2a4f4dd 100644 --- a/ARCHBLOXBootstrapper_XP/Form2.cs +++ b/ARCHBLOXBootstrapper_XP/Form2.cs @@ -8,6 +8,7 @@ using System.Text; using System.Threading; using System.IO; using System.Windows.Forms; +using System.Linq; namespace ARCHBLOXBootstrapper_XP { public partial class ARCHBLOX : Form @@ -31,6 +32,13 @@ namespace ARCHBLOXBootstrapper_XP shortcut.Save(); } + private static long GetDirectorySize(string folderPath) + { + // get size of a directory, important for showing the user how much space ARCHBLOX takes + DirectoryInfo di = new DirectoryInfo(folderPath); + return di.EnumerateFiles("*", SearchOption.AllDirectories).Sum(fi => fi.Length) / 1000000; + } + public ARCHBLOX() { InitializeComponent(); @@ -50,7 +58,7 @@ namespace ARCHBLOXBootstrapper_XP string version_string = webData; string folderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"Archblx\", @"Studio\", @"Versions\"); string clientPath = Path.Combine(folderPath, version_string + @"\"); - string filePath = Path.Combine(clientPath, Path.GetFileName(@"http://archblox.com/client/" + version_string + ".zip")); + string filePath = Path.Combine(clientPath, Path.GetFileName(@"http://archblox.com/studio/" + version_string + ".zip")); string studioPath = Path.Combine(clientPath, "ArchbloxStudio.exe"); ARCHBLOXProtocol.ARCHBLOXURIProtocol.Register(); CreateShortcut(); @@ -72,7 +80,7 @@ namespace ARCHBLOXBootstrapper_XP if (Directory.Exists(folderPath) & DontEvenBother == false) { // ask user if they want to delete previous installs - DialogResult res = MessageBox.Show("Do you want to delete previous installs of ARCHBLOX Studio?", "ARCHBLOX Studio", MessageBoxButtons.YesNo, MessageBoxIcon.Information); + DialogResult res = MessageBox.Show("Do you want to delete previous installs of ARCHBLOX Studio? Current size of ARCHBLOX Studio folder: " + GetDirectorySize(folderPath) + "MB.", "ARCHBLOX Studio", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (res == DialogResult.Yes) { label1.Text = "Removing previous installs..."; @@ -140,7 +148,7 @@ namespace ARCHBLOXBootstrapper_XP double receive = double.Parse(e.BytesReceived.ToString()); double total = double.Parse(e.TotalBytesToReceive.ToString()); double percentage = receive / total * 100; - label2.Text = "Installing ARCHBLOX... (" + Math.Truncate(percentage).ToString() + "% Completed)"; + label2.Text = "Installing ARCHBLOX... (" + Math.Truncate(percentage).ToString() + "%)"; progressBar2.Value = int.Parse(Math.Truncate(percentage).ToString()); } }