Compare commits

...

24 Commits
v1.0 ... master

Author SHA1 Message Date
Thomas G 908cf218e4
add license information 2023-03-13 00:17:19 +11:00
Thomas G 7684fb32a2 1.6 2023-03-06 19:10:51 +11:00
Thomas G b735781bec 1.5 2022-10-22 09:10:55 +11:00
Thomas G f31b300cdf
Update README.md 2022-08-08 05:07:40 +10:00
Thomas G 2365c4b63c
Update README.md 2022-08-08 05:07:10 +10:00
Thomas G 06b297f8a7 1.4 (whoops accidently mislapbled stuff) 2022-08-05 10:33:23 +10:00
Thomas G 5f2e2abdc6 2.7 2022-08-05 10:31:34 +10:00
Thomas G 97448ac5fb comments!! 2022-07-23 01:53:12 +10:00
Thomas G 67afa9cee9 test 2022-07-23 01:51:58 +10:00
Thomas G a196880413 1.3 2022-07-20 21:56:14 +10:00
Thomas G 015193c0dd fix issue with executatble paths 2022-07-20 21:49:15 +10:00
Thomas G 7374877a1b Revert "Revert "2.5""
This reverts commit 1521e58701.
2022-07-20 21:46:58 +10:00
Thomas G e311f6bdd7 1.3 2022-07-20 21:44:10 +10:00
Thomas G 8010e2b000 Merge branch 'master' of https://github.com/Thomasluigi07/ARCHBLOXBootstrapper 2022-07-20 21:43:46 +10:00
Thomas G 1521e58701 Revert "2.5"
This reverts commit a031e710aa.
2022-07-20 21:42:59 +10:00
Thomas G a031e710aa 2.5 2022-07-20 21:42:41 +10:00
Thomas G 67b581e5be
Update README.md 2022-07-20 21:41:19 +10:00
Thomas G b3f0e07fb1 its now a studio launcher wtf! 2022-07-15 20:45:02 +10:00
Thomas G e43155802c
Update README.md 2022-07-12 01:08:02 +10:00
Thomas G f8935615bd Merge branch 'master' of https://github.com/Thomasluigi07/ARCHBLOXBootstrapper 2022-07-10 14:01:25 +10:00
Thomas G c53ef735d6 bootstrapper now uses appdata and asks if you want to delete old installs 2022-07-10 14:01:03 +10:00
Thomas G b787b8a144
Update README.md 2022-07-10 01:10:25 +10:00
Thomas G 5fc311dcb0
Merge pull request #1 from Thomasluigi07/main
merge
2022-07-09 23:36:24 +10:00
Thomas G 2858980152
d 2022-07-09 23:35:41 +10:00
22 changed files with 3445 additions and 4328 deletions

View File

@ -8,7 +8,15 @@
</PropertyGroup>
<ItemGroup>
<Content Include="Resources\archblox.ico" />
<COMReference Include="IWshRuntimeLibrary">
<WrapperTool>tlbimp</WrapperTool>
<VersionMinor>0</VersionMinor>
<VersionMajor>1</VersionMajor>
<Guid>f935dc20-1cf0-11d0-adb9-00c04fd58a0b</Guid>
<Lcid>0</Lcid>
<Isolated>false</Isolated>
<EmbedInteropTypes>true</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<ItemGroup>

View File

@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.2.32516.85
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ARCHBLOXBootstrapper", "ARCHBLOXBootstrapper.csproj", "{F7BD33B8-77AC-42BC-BEAE-DDA874DEA9FC}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ARCHBLOXBootstrapper", "ARCHBLOXBootstrapper.csproj", "{F7BD33B8-77AC-42BC-BEAE-DDA874DEA9FC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

24
Extensions.cs Normal file
View File

@ -0,0 +1,24 @@
using System;
namespace ARCHBLOXBootstrapper
{
public static class Extensions
{
[System.Runtime.InteropServices.DllImport("kernel32.dll")]
static extern uint GetModuleFileName(IntPtr hModule, System.Text.StringBuilder lpFilename, int nSize);
static readonly int MAX_PATH = 255;
public static string GetExecutablePath()
{
if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows))
{
var sb = new System.Text.StringBuilder(MAX_PATH);
GetModuleFileName(IntPtr.Zero, sb, MAX_PATH);
return sb.ToString();
}
else
{
return System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
}
}
}
}

View File

@ -1,78 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Data;
using System.IO.Compression;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.IO;
using System.DirectoryServices;
using System.Windows.Forms;
namespace ARCHBLOXBootstrapper
{
public partial class ARCHBLOX : Form
{
public bool IsCompleted = false;
private static WebClient wc = new WebClient();
private static ManualResetEvent handle = new ManualResetEvent(true);
public ARCHBLOX()
{
InitializeComponent();
wc.DownloadProgressChanged += Client_DownloadProgressChanged;
wc.DownloadFileCompleted += Client_DownloadFileCompleted;
progressBar2.Style = ProgressBarStyle.Marquee;
label2.Text = "Configuring ARCHBLOX...";
wc.DownloadProgressChanged += Client_DownloadProgressChanged;
wc.DownloadFileCompleted += Client_DownloadFileCompleted;
byte[] raw = wc.DownloadData("https://archblox.com/client/version.txt");
string webData = Encoding.UTF8.GetString(raw);
string version_string = webData;
string folderPath = Path.Combine(@"C:\ARCHBLOX\", version_string + @"\");
string filePath = Path.Combine(folderPath, Path.GetFileName(@"https://archblox.com/client/" + version_string + ".zip"));
if (Directory.Exists(folderPath))
{
label2.Text = "Removing previous install...";
Directory.Delete(folderPath, true);
}
Directory.CreateDirectory(folderPath);
wc.DownloadFileAsync(new Uri(@"https://archblox.com/client/" + version_string + ".zip"), filePath);
progressBar2.Style = ProgressBarStyle.Blocks;
handle.WaitOne();
}
private void ARCHBLOX_Load(object sender, EventArgs e)
{
// nothing
}
private void Client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
{
if (IsCompleted == false)
{
IsCompleted = true;
byte[] raw = wc.DownloadData("https://archblox.com/client/version.txt");
string webData = Encoding.UTF8.GetString(raw);
string version_string = webData;
string folderPath = Path.Combine(@"C:\ARCHBLOX\", version_string + @"\");
string filePath = Path.Combine(folderPath, Path.GetFileName(@"https://archblox.com/client/" + version_string + ".zip"));
ZipFile.ExtractToDirectory(filePath, folderPath);
label2.Text = "ARCHBLOX has been installed!";
}
}
private void Client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
progressBar2.Minimum = 0;
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)";
progressBar2.Value = int.Parse(Math.Truncate(percentage).ToString());
}
}
}

3182
Form1.resx

File diff suppressed because it is too large Load Diff

View File

@ -75,47 +75,49 @@
this.pictureBox2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.pictureBox2.Image = global::ARCHBLOXBootstrapper.Properties.Resources.archblox;
this.pictureBox2.InitialImage = global::ARCHBLOXBootstrapper.Properties.Resources.archblox;
this.pictureBox2.Location = new System.Drawing.Point(3, 6);
this.pictureBox2.Location = new System.Drawing.Point(18, 17);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(46, 46);
this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox2.Size = new System.Drawing.Size(35, 42);
this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBox2.TabIndex = 0;
this.pictureBox2.TabStop = false;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(55, 6);
this.label2.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.label2.ImageAlign = System.Drawing.ContentAlignment.BottomLeft;
this.label2.Location = new System.Drawing.Point(58, 18);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(144, 15);
this.label2.Size = new System.Drawing.Size(237, 21);
this.label2.TabIndex = 1;
this.label2.Text = "Configuring ARCHBLOX...";
this.label2.Text = "Checking for updates...";
this.label2.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
//
// progressBar2
//
this.progressBar2.Location = new System.Drawing.Point(55, 29);
this.progressBar2.Location = new System.Drawing.Point(58, 51);
this.progressBar2.MarqueeAnimationSpeed = 10;
this.progressBar2.Name = "progressBar2";
this.progressBar2.Size = new System.Drawing.Size(217, 23);
this.progressBar2.Size = new System.Drawing.Size(287, 26);
this.progressBar2.Style = System.Windows.Forms.ProgressBarStyle.Marquee;
this.progressBar2.TabIndex = 2;
//
// ARCHBLOX
//
this.ClientSize = new System.Drawing.Size(286, 59);
this.ClientSize = new System.Drawing.Size(352, 136);
this.Controls.Add(this.progressBar2);
this.Controls.Add(this.label2);
this.Controls.Add(this.pictureBox2);
this.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "ARCHBLOX";
this.Text = "ARCHBLOX Installer";
this.Text = "ARCHBLOX Studio";
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}

155
Form2.cs Normal file
View File

@ -0,0 +1,155 @@
using IWshRuntimeLibrary;
using System;
using System.ComponentModel;
using System.IO.Compression;
using System.Net;
using System.Diagnostics;
using System.Text;
using System.Threading;
using System.IO;
using System.Windows.Forms;
using System.Linq;
namespace ARCHBLOXBootstrapper
{
public partial class ARCHBLOX : Form
{
// set up variables
public bool IsCompleted = false;
public bool exitafterarg = false;
public bool DontEvenBother = false;
private static WebClient wc = new WebClient();
private static ManualResetEvent handle = new ManualResetEvent(true);
private void CreateShortcut()
{
// create a shorcut on the user's desktop
object shDesktop = (object)"Desktop";
WshShell shell = new WshShell();
string shortcutAddress = (string)shell.SpecialFolders.Item(ref shDesktop) + @"\ARCHBLOX Studio.lnk";
IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(shortcutAddress);
shortcut.Description = "ARCHBLOX Studio";
shortcut.TargetPath = Extensions.GetExecutablePath();
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();
// check for an internet connection first
try
{
wc.DownloadData("https://archblox.com/studio/version.txt");
}
catch
{
MessageBox.Show("An error occoured while starting ARCHBLOX Studio\n\nDetails: HttpOpenRequest failed for GET http://archblox.com/studio/version.txt, Error ID: 6", "ARCHBLOX", MessageBoxButtons.OK, MessageBoxIcon.Error);
Environment.Exit(0);
}
// setup paths
byte[] raw = wc.DownloadData("https://archblox.com/studio/version.txt");
string webData = Encoding.UTF8.GetString(raw);
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/studio/" + version_string + ".zip"));
string studioPath = Path.Combine(clientPath, "ArchbloxStudio.exe");
ARCHBLOXProtocol.ARCHBLOXURIProtocol.Register();
CreateShortcut();
// TODO: Make studio place launching URI.
if (Directory.Exists(clientPath) & System.IO.File.Exists(studioPath))
{
// studio exists, create shortcut and launch studio
label1.Text = "Launching Studio...";
DontEvenBother = true;
CreateShortcut();
var pProcess = new Process();
pProcess.StartInfo.FileName = studioPath;
pProcess.StartInfo.UseShellExecute = false;
pProcess.StartInfo.RedirectStandardOutput = true;
pProcess.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
pProcess.StartInfo.CreateNoWindow = false;
pProcess.Start();
}
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? Current size of ARCHBLOX Studio folder: " + GetDirectorySize(folderPath) + "MB.", "ARCHBLOX Studio", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
if (res == DialogResult.Yes)
{
label1.Text = "Removing previous installs...";
Directory.Delete(folderPath, true);
}
}
// setup events
wc.DownloadProgressChanged += Client_DownloadProgressChanged;
wc.DownloadFileCompleted += Client_DownloadFileCompleted;
progressBar2.Style = ProgressBarStyle.Marquee;
if (DontEvenBother == false)
{
// install studio
label2.Text = "Configuring ARCHBLOX...";
Directory.CreateDirectory(clientPath);
wc.DownloadFileAsync(new Uri(@"http://archblox.com/studio/" + version_string + ".zip"), filePath);
progressBar2.Style = ProgressBarStyle.Blocks;
handle.WaitOne();
} else
{
// close program
Thread.Sleep(3000);
Environment.Exit(0);
}
}
private void ARCHBLOX_Load(object sender, EventArgs e)
{
// nothing
}
private void Client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
{
if (IsCompleted == false)
{
// the download has completed, extract.zip, create shortcut and launch! yay!!!
IsCompleted = true;
byte[] raw = wc.DownloadData("http://archblox.com/studio/version.txt");
string webData = Encoding.UTF8.GetString(raw);
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/studio/" + version_string + ".zip"));
string studioPath = Path.Combine(clientPath, "ArchbloxStudio.exe");
ZipFile.ExtractToDirectory(filePath, clientPath);
System.IO.File.Delete(filePath);
label2.Text = "ARCHBLOX Studio has been installed!";
CreateShortcut();
var pProcess = new Process();
pProcess.StartInfo.FileName = studioPath;
pProcess.StartInfo.UseShellExecute = false;
pProcess.StartInfo.RedirectStandardOutput = true;
pProcess.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
pProcess.StartInfo.CreateNoWindow = false;
pProcess.Start();
Environment.Exit(0);
}
}
private void Client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
// update progress bar and text
progressBar2.Minimum = 0;
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() + "%)";
progressBar2.Value = int.Parse(Math.Truncate(percentage).ToString());
}
}
}

3166
Form2.resx Normal file

File diff suppressed because it is too large Load Diff

22
LICENSE.md Normal file
View File

@ -0,0 +1,22 @@
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@ -12,11 +12,18 @@ namespace ARCHBLOXBootstrapper
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
static void Main(string[] args)
{
Application.SetHighDpiMode(HighDpiMode.SystemAware);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
if (args.Length > 0)
{
foreach (string s in args)
{
ARCHBLOXProtocol.SharedVariables.Arguments = s;
}
}
Application.Run(new ARCHBLOX());
}
}

View File

@ -69,25 +69,5 @@ namespace ARCHBLOXBootstrapper.Properties {
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap archblox1 {
get {
object obj = ResourceManager.GetObject("archblox1", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap zunethemebar {
get {
object obj = ResourceManager.GetObject("zunethemebar", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 183 KiB

After

Width:  |  Height:  |  Size: 182 KiB

View File

@ -1,2 +1,2 @@
# ARCHBLOXBootstrapper
A installer for ARCHBLOX and soon-to-be game joiner.
A installer for ARCHBLOX Studio. This is used for studio launching and installing.

BIN
Resources/Thumbs.db Normal file

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 183 KiB

After

Width:  |  Height:  |  Size: 182 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 197 KiB

BIN
Resources/archblox1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 261 B

43
URI_Maker.cs Normal file
View File

@ -0,0 +1,43 @@
using System;
using System.Windows.Forms;
using System.Security.Permissions;
using Microsoft.Win32;
using System.Text;
using System.Net;
using System.IO;
namespace ARCHBLOXProtocol
{
class SharedVariables
{
public static string Arguments = "";
};
internal static class ARCHBLOXURIProtocol
{
private static RegistryKey softwareClasses = Registry.CurrentUser.OpenSubKey("Software").OpenSubKey("Classes", true);
internal static void Register()
{
// credit to p0s0 for helping me with this
if (softwareClasses.OpenSubKey("archbloxstudio") == null) {} else { softwareClasses.DeleteSubKeyTree("archbloxstudio"); }
RegistryKey key = softwareClasses.CreateSubKey("archbloxstudio", true);
key.SetValue("", "URL: archbloxstudio Protocol");
key.SetValue("URL Protocol", "");
RegistryKey key1 = key.CreateSubKey("DefaultIcon", true);
key1.SetValue("", ARCHBLOXBootstrapper.Extensions.GetExecutablePath());
RegistryKey key2 = key.CreateSubKey("shell", true);
RegistryKey key3 = key2.CreateSubKey("open", true);
RegistryKey key4 = key3.CreateSubKey("command", true);
key4.SetValue("", "\"" + ARCHBLOXBootstrapper.Extensions.GetExecutablePath() + "\" %1");
key.Close();
key1.Close();
key2.Close();
key3.Close();
key4.Close();
}
}
}