From 69da3662dcc2040f84afd127d2ebe4233428891b Mon Sep 17 00:00:00 2001 From: Thomas G <62822072+Thomasluigi07@users.noreply.github.com> Date: Sat, 23 Jul 2022 01:57:53 +1000 Subject: [PATCH] i heard you guys liked comments --- .vs/ARCHBLOXLauncherGUI/v17/.suo | Bin 58880 -> 59904 bytes Form1.cs | 10 ++++++++++ Form2.cs | 10 +++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.vs/ARCHBLOXLauncherGUI/v17/.suo b/.vs/ARCHBLOXLauncherGUI/v17/.suo index c71b3ba091e70fe91f22826782b2e6d685d6eeeb..00bb77900c96e6af6c97249dd17d7d344a0f1f9a 100644 GIT binary patch delta 1768 zcmdUvUu;uV9LMiDyDPWdEo^oxh5hSBHvzZUuB`PB=*S9oi2XAc1rmgjt|(}tcu`}b zHa=+7#o+z{>=Phy?`d%(kBFL(r`KpJE~7EFRejxS<{ukFi2 zbQC-Zo&v`Jd$Yd^Gn&Cg@C)-g2YUL-8&K6m=}YQ|h7UTcBM-!Nih&JkbGj9CTs z`D1x?td_qn*wymq+{bpD`>H+9j$3nI8~{e!^d7xC_Cu0TL*s=#U5C5=Z=7?9vQu}=15ZGJ&%wpuX3gMu z<=hBn^i9rL?Z#3t?XA4n{yHo15S{Ex(_%R6nuhoVY2S>xr1gMm_Ak<+4BMstDWP@O zS&$K`ct-Ots`eitO_+fsEd_?i2tdxx1*Wut27?Wi0~f!T?TYgUNT6ITa4N;F=Q7S!tRpYAO%J;rZC4ioKp|Kw=!e0qi<5B6)`2(svF6ri7DUH8_HMub~)!4|T zq3^gWnx~-EPJcdnY1MYH4ye|?R_h6A9h25!?M&f0m9FPMp`VVc_PLiP-ISOP)31i# zPQLs_Q}GR<+Tzu6b2x+Qad@F4)4AAaG_q}YTP}x3JU26ZB%hBD&&2b&SadWNkBp9Z zl(V$_5(>0X6_%^*ecY>as+hq5i{n>AwmlU}$ zKp(%g(|+*sjwbueHwRtR_w_EjXFe|I?zuzs{lx(~^X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CHBLOXLauncherGUI { private void CreateShortcut() { + // create shortcut on user's desktop object shDesktop = (object)"Desktop"; WshShell shell = new WshShell(); string shortcutAddress = (string)shell.SpecialFolders.Item(ref shDesktop) + @"\ARCHBLOX Launcher.lnk"; @@ -22,6 +23,7 @@ namespace ARCHBLOXLauncherGUI shortcut.TargetPath = ARCHBLOXLauncherGUI.Extensions.GetExecutablePath(); shortcut.Save(); } + // variables bool exitafterarg = false; bool lockanims = true; bool rbxl = false; @@ -35,6 +37,7 @@ namespace ARCHBLOXLauncherGUI static string folderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"Archblx\", @"Versions\"); static string clientPath = Path.Combine(folderPath, version_string + @"\"); static string filePath = Path.Combine(clientPath, "ArchbloxPlayerBeta.exe"); + // animations void slideOutJoinBox(object sender, EventArgs e) { lockanims = true; @@ -154,6 +157,7 @@ namespace ARCHBLOXLauncherGUI var info1 = ""; var info2 = ""; string[] args = ARCHBLOXProtocol.SharedVariables.Arguments.Split('/'); + // check to see if uri/arguments were used foreach (var word in args) { if (lastword == "host") { @@ -228,9 +232,11 @@ namespace ARCHBLOXLauncherGUI if (exitafterarg == true) { + // close program Environment.Exit(0); } + // setup animations AnimationHandler_SlideOutHostBox.Tick += new EventHandler(slideOutHostBox); AnimationHandler_SlideInHostBox.Tick += new EventHandler(slideInHostBox); @@ -266,6 +272,7 @@ namespace ARCHBLOXLauncherGUI private void button1_Click(object sender, EventArgs e) { + // hosting string phrase = textBox2.Text; string[] words = phrase.Split('.'); @@ -353,6 +360,7 @@ namespace ARCHBLOXLauncherGUI private void button2_Click(object sender, EventArgs e) { + // joining if (!System.IO.File.Exists(filePath)) { DialogResult res = MessageBox.Show("You need to install the latest version of ARCHBLOX to join " + serverip.Text + ":" + serverport.Text + ". Would you like to install it?", "ARCHBLOX", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); @@ -428,6 +436,7 @@ namespace ARCHBLOXLauncherGUI private void button3_Click(object sender, EventArgs e) { + // ask user to open dialog OpenFileDialog dialog = new OpenFileDialog(); dialog.Title = "Choose a RBXL..."; dialog.AddExtension = true; @@ -451,6 +460,7 @@ namespace ARCHBLOXLauncherGUI } private void Form1_HelpButtonClicked(Object sender, CancelEventArgs e) { + // this no longer exists ARCHBLOXLauncherGUI.Form2 form2 = new ARCHBLOXLauncherGUI.Form2(); form2.Show(); } diff --git a/Form2.cs b/Form2.cs index 87fceef..32506b5 100644 --- a/Form2.cs +++ b/Form2.cs @@ -11,6 +11,7 @@ namespace ARCHBLOXLauncherGUI { public partial class Form2 : Form { + // setup variables public bool Uri_Installed = false; public bool IsCompleted = false; public bool DontEvenBother = false; @@ -19,6 +20,7 @@ namespace ARCHBLOXLauncherGUI private static long GetDirectorySize(string folderPath) { + // get size of a directory DirectoryInfo di = new DirectoryInfo(folderPath); return di.EnumerateFiles("*", SearchOption.AllDirectories).Sum(fi => fi.Length) / 1000000; } @@ -26,6 +28,7 @@ namespace ARCHBLOXLauncherGUI public Form2() { InitializeComponent(); + // setup file paths etc byte[] raw = wc.DownloadData("https://archblox.com/client/version.txt"); string webData = Encoding.UTF8.GetString(raw); string version_string = webData; @@ -35,6 +38,7 @@ namespace ARCHBLOXLauncherGUI { if (Directory.Exists(folderPath)) { + // since the folder already exists, show size of folder and ask user if they want to delete older versions DialogResult res = MessageBox.Show("Do you want to delete previous installs of ARCHBLOX? Current size of ARCHBLOX folder: " + GetDirectorySize(folderPath) + "MB.", "ARCHBLOX", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (res == DialogResult.Yes) { @@ -45,6 +49,7 @@ namespace ARCHBLOXLauncherGUI } } } + // setup variables wc.DownloadProgressChanged += Client_DownloadProgressChanged; wc.DownloadFileCompleted += Client_DownloadFileCompleted; progressBar1.Style = ProgressBarStyle.Marquee; @@ -53,6 +58,7 @@ namespace ARCHBLOXLauncherGUI wc.DownloadFileCompleted += Client_DownloadFileCompleted; if (Directory.Exists(clientPath)) { + // ask user if they want to re-install DialogResult res = MessageBox.Show("The latest version of ARCHBLOX is already installed. Do you want to re-install it?", "ARCHBLOX", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (res == DialogResult.Yes) { @@ -68,6 +74,7 @@ namespace ARCHBLOXLauncherGUI } if (DontEvenBother == false) { + // continue with install Directory.CreateDirectory(clientPath); wc.DownloadFileAsync(new Uri(@"https://archblox.com/client/" + version_string + ".zip"), filePath); progressBar1.Style = ProgressBarStyle.Blocks; @@ -83,7 +90,7 @@ namespace ARCHBLOXLauncherGUI { if (IsCompleted == false) { - + // the download has completed, extract zip, setup URI. IsCompleted = true; byte[] raw = wc.DownloadData("https://archblox.com/client/version.txt"); string webData = Encoding.UTF8.GetString(raw); @@ -114,6 +121,7 @@ namespace ARCHBLOXLauncherGUI private void Client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e) { + // update the progress bar progressBar1.Minimum = 0; double receive = double.Parse(e.BytesReceived.ToString()); double total = double.Parse(e.TotalBytesToReceive.ToString());