diff --git a/.vs/ARCHBLOXLauncherGUI/v17/.suo b/.vs/ARCHBLOXLauncherGUI/v17/.suo index c71b3ba..00bb779 100644 Binary files a/.vs/ARCHBLOXLauncherGUI/v17/.suo and b/.vs/ARCHBLOXLauncherGUI/v17/.suo differ diff --git a/Form1.cs b/Form1.cs index 6d8b3f2..3fd18b2 100644 --- a/Form1.cs +++ b/Form1.cs @@ -14,6 +14,7 @@ namespace ARCHBLOXLauncherGUI { 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());