Compare commits

..

No commits in common. "master" and "v1.0" have entirely different histories.
master ... v1.0

22 changed files with 4328 additions and 3445 deletions

View File

@ -8,15 +8,7 @@
</PropertyGroup>
<ItemGroup>
<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>
<Content Include="Resources\archblox.ico" />
</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("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ARCHBLOXBootstrapper", "ARCHBLOXBootstrapper.csproj", "{F7BD33B8-77AC-42BC-BEAE-DDA874DEA9FC}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ARCHBLOXBootstrapper", "ARCHBLOXBootstrapper.csproj", "{F7BD33B8-77AC-42BC-BEAE-DDA874DEA9FC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@ -1,24 +0,0 @@
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

@ -75,49 +75,47 @@
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(18, 17);
this.pictureBox2.Location = new System.Drawing.Point(3, 6);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(35, 42);
this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBox2.Size = new System.Drawing.Size(46, 46);
this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox2.TabIndex = 0;
this.pictureBox2.TabStop = false;
//
// label2
//
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.AutoSize = true;
this.label2.Location = new System.Drawing.Point(55, 6);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(237, 21);
this.label2.Size = new System.Drawing.Size(144, 15);
this.label2.TabIndex = 1;
this.label2.Text = "Checking for updates...";
this.label2.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
this.label2.Text = "Configuring ARCHBLOX...";
//
// progressBar2
//
this.progressBar2.Location = new System.Drawing.Point(58, 51);
this.progressBar2.Location = new System.Drawing.Point(55, 29);
this.progressBar2.MarqueeAnimationSpeed = 10;
this.progressBar2.Name = "progressBar2";
this.progressBar2.Size = new System.Drawing.Size(287, 26);
this.progressBar2.Size = new System.Drawing.Size(217, 23);
this.progressBar2.Style = System.Windows.Forms.ProgressBarStyle.Marquee;
this.progressBar2.TabIndex = 2;
//
// ARCHBLOX
//
this.ClientSize = new System.Drawing.Size(352, 136);
this.ClientSize = new System.Drawing.Size(286, 59);
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 Studio";
this.Text = "ARCHBLOX Installer";
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}

78
Form1.cs Normal file
View File

@ -0,0 +1,78 @@
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 Normal file

File diff suppressed because it is too large Load Diff

155
Form2.cs
View File

@ -1,155 +0,0 @@
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

File diff suppressed because it is too large Load Diff

View File

@ -1,22 +0,0 @@
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,18 +12,11 @@ namespace ARCHBLOXBootstrapper
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
static void Main()
{
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,5 +69,25 @@ 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: 182 KiB

After

Width:  |  Height:  |  Size: 183 KiB

View File

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

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 182 KiB

After

Width:  |  Height:  |  Size: 183 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 197 KiB

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 197 KiB

BIN
Resources/zune.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
Resources/zunethemebar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 B

View File

@ -1,43 +0,0 @@
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();
}
}
}