1.1
This commit is contained in:
parent
82b7984a63
commit
2fbbdd390e
|
|
@ -59,6 +59,7 @@
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="URI_Maker.cs" />
|
||||||
<EmbeddedResource Include="Form2.resx">
|
<EmbeddedResource Include="Form2.resx">
|
||||||
<DependentUpon>Form2.cs</DependentUpon>
|
<DependentUpon>Form2.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,12 @@ using System.Threading;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
namespace ARCHBLOXBootstrapper_XP
|
namespace ARCHBLOXBootstrapper_XP
|
||||||
{
|
{
|
||||||
public partial class ARCHBLOX : Form
|
public partial class ARCHBLOX : Form
|
||||||
{
|
{
|
||||||
// set up variables
|
// set up variables
|
||||||
public bool IsCompleted = false;
|
public bool IsCompleted = false;
|
||||||
|
public bool exitafterarg = false;
|
||||||
public bool DontEvenBother = false;
|
public bool DontEvenBother = false;
|
||||||
private static WebClient wc = new WebClient();
|
private static WebClient wc = new WebClient();
|
||||||
private static ManualResetEvent handle = new ManualResetEvent(true);
|
private static ManualResetEvent handle = new ManualResetEvent(true);
|
||||||
|
|
@ -33,20 +34,33 @@ namespace ARCHBLOXBootstrapper_XP
|
||||||
public ARCHBLOX()
|
public ARCHBLOX()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
// check for an internet connection first
|
||||||
|
try
|
||||||
|
{
|
||||||
|
wc.DownloadData("http://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
|
// setup paths
|
||||||
byte[] raw = wc.DownloadData("http://archblox.com/studio/version.txt");
|
byte[] raw = wc.DownloadData("http://archblox.com/studio/version.txt");
|
||||||
CreateShortcut();
|
|
||||||
string webData = Encoding.UTF8.GetString(raw);
|
string webData = Encoding.UTF8.GetString(raw);
|
||||||
string version_string = webData;
|
string version_string = webData;
|
||||||
string folderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"Archblx\", @"Studio\", @"Versions\");
|
string folderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"Archblx\", @"Studio\", @"Versions\");
|
||||||
string clientPath = Path.Combine(folderPath, version_string + @"\");
|
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/client/" + version_string + ".zip"));
|
||||||
string studioPath = Path.Combine(clientPath, "ArchbloxStudio.exe");
|
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))
|
if (Directory.Exists(clientPath) & System.IO.File.Exists(studioPath))
|
||||||
{
|
{
|
||||||
// studio exists, create shortcut and launch studio
|
// studio exists, create shortcut and launch studio
|
||||||
label1.Text = "Launching Studio...";
|
label1.Text = "Launching Studio...";
|
||||||
DontEvenBother = true;
|
DontEvenBother = true;
|
||||||
|
CreateShortcut();
|
||||||
var pProcess = new Process();
|
var pProcess = new Process();
|
||||||
pProcess.StartInfo.FileName = studioPath;
|
pProcess.StartInfo.FileName = studioPath;
|
||||||
pProcess.StartInfo.UseShellExecute = false;
|
pProcess.StartInfo.UseShellExecute = false;
|
||||||
|
|
@ -69,8 +83,6 @@ namespace ARCHBLOXBootstrapper_XP
|
||||||
wc.DownloadProgressChanged += Client_DownloadProgressChanged;
|
wc.DownloadProgressChanged += Client_DownloadProgressChanged;
|
||||||
wc.DownloadFileCompleted += Client_DownloadFileCompleted;
|
wc.DownloadFileCompleted += Client_DownloadFileCompleted;
|
||||||
progressBar2.Style = ProgressBarStyle.Marquee;
|
progressBar2.Style = ProgressBarStyle.Marquee;
|
||||||
wc.DownloadProgressChanged += Client_DownloadProgressChanged;
|
|
||||||
wc.DownloadFileCompleted += Client_DownloadFileCompleted;
|
|
||||||
if (DontEvenBother == false)
|
if (DontEvenBother == false)
|
||||||
{
|
{
|
||||||
// install studio
|
// install studio
|
||||||
|
|
@ -79,7 +91,8 @@ namespace ARCHBLOXBootstrapper_XP
|
||||||
wc.DownloadFileAsync(new Uri(@"http://archblox.com/studio/" + version_string + ".zip"), filePath);
|
wc.DownloadFileAsync(new Uri(@"http://archblox.com/studio/" + version_string + ".zip"), filePath);
|
||||||
progressBar2.Style = ProgressBarStyle.Blocks;
|
progressBar2.Style = ProgressBarStyle.Blocks;
|
||||||
handle.WaitOne();
|
handle.WaitOne();
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// close program
|
// close program
|
||||||
Thread.Sleep(3000);
|
Thread.Sleep(3000);
|
||||||
|
|
@ -89,7 +102,7 @@ namespace ARCHBLOXBootstrapper_XP
|
||||||
|
|
||||||
private void ARCHBLOX_Load(object sender, EventArgs e)
|
private void ARCHBLOX_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// nothing
|
// nothing
|
||||||
}
|
}
|
||||||
private void Client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
|
private void Client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
@ -107,6 +120,7 @@ namespace ARCHBLOXBootstrapper_XP
|
||||||
Extensions.UnZip(filePath, clientPath);
|
Extensions.UnZip(filePath, clientPath);
|
||||||
System.IO.File.Delete(filePath);
|
System.IO.File.Delete(filePath);
|
||||||
label2.Text = "ARCHBLOX Studio has been installed!";
|
label2.Text = "ARCHBLOX Studio has been installed!";
|
||||||
|
CreateShortcut();
|
||||||
var pProcess = new Process();
|
var pProcess = new Process();
|
||||||
pProcess.StartInfo.FileName = studioPath;
|
pProcess.StartInfo.FileName = studioPath;
|
||||||
pProcess.StartInfo.UseShellExecute = false;
|
pProcess.StartInfo.UseShellExecute = false;
|
||||||
|
|
|
||||||
|
|
@ -69,35 +69,35 @@
|
||||||
// pictureBox2
|
// pictureBox2
|
||||||
//
|
//
|
||||||
this.pictureBox2.BackgroundImage = global::ARCHBLOXBootstrapper_XP.Properties.Resources.archblox1;
|
this.pictureBox2.BackgroundImage = global::ARCHBLOXBootstrapper_XP.Properties.Resources.archblox1;
|
||||||
this.pictureBox2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
this.pictureBox2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||||
this.pictureBox2.Location = new System.Drawing.Point(3, 6);
|
this.pictureBox2.Location = new System.Drawing.Point(18, 17);
|
||||||
this.pictureBox2.Name = "pictureBox2";
|
this.pictureBox2.Name = "pictureBox2";
|
||||||
this.pictureBox2.Size = new System.Drawing.Size(46, 46);
|
this.pictureBox2.Size = new System.Drawing.Size(35, 42);
|
||||||
this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
||||||
this.pictureBox2.TabIndex = 0;
|
this.pictureBox2.TabIndex = 0;
|
||||||
this.pictureBox2.TabStop = false;
|
this.pictureBox2.TabStop = false;
|
||||||
//
|
//
|
||||||
// label2
|
// label2
|
||||||
//
|
//
|
||||||
this.label2.AutoSize = true;
|
this.label2.Location = new System.Drawing.Point(58, 18);
|
||||||
this.label2.Location = new System.Drawing.Point(55, 6);
|
|
||||||
this.label2.Name = "label2";
|
this.label2.Name = "label2";
|
||||||
this.label2.Size = new System.Drawing.Size(117, 13);
|
this.label2.Size = new System.Drawing.Size(237, 21);
|
||||||
this.label2.TabIndex = 1;
|
this.label2.TabIndex = 1;
|
||||||
this.label2.Text = "Checking for updates...";
|
this.label2.Text = "Checking for updates...";
|
||||||
|
this.label2.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
|
||||||
//
|
//
|
||||||
// progressBar2
|
// 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.MarqueeAnimationSpeed = 10;
|
||||||
this.progressBar2.Name = "progressBar2";
|
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.Style = System.Windows.Forms.ProgressBarStyle.Marquee;
|
||||||
this.progressBar2.TabIndex = 2;
|
this.progressBar2.TabIndex = 2;
|
||||||
//
|
//
|
||||||
// ARCHBLOX
|
// ARCHBLOX
|
||||||
//
|
//
|
||||||
this.ClientSize = new System.Drawing.Size(286, 59);
|
this.ClientSize = new System.Drawing.Size(362, 146);
|
||||||
this.Controls.Add(this.progressBar2);
|
this.Controls.Add(this.progressBar2);
|
||||||
this.Controls.Add(this.label2);
|
this.Controls.Add(this.label2);
|
||||||
this.Controls.Add(this.pictureBox2);
|
this.Controls.Add(this.pictureBox2);
|
||||||
|
|
@ -106,11 +106,10 @@
|
||||||
this.MaximizeBox = false;
|
this.MaximizeBox = false;
|
||||||
this.MinimizeBox = false;
|
this.MinimizeBox = false;
|
||||||
this.Name = "ARCHBLOX";
|
this.Name = "ARCHBLOX";
|
||||||
this.Text = "ARCHBLOX Installer";
|
this.Text = "ARCHBLOX Studio";
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,17 @@ namespace ARCHBLOXBootstrapper_XP
|
||||||
/// The main entry point for the application.
|
/// The main entry point for the application.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main()
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
|
if (args.Length > 0)
|
||||||
|
{
|
||||||
|
foreach (string s in args)
|
||||||
|
{
|
||||||
|
ARCHBLOXProtocol.SharedVariables.Arguments = s;
|
||||||
|
}
|
||||||
|
}
|
||||||
Application.Run(new ARCHBLOX());
|
Application.Run(new ARCHBLOX());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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");
|
||||||
|
key.SetValue("", "URL: archbloxstudio Protocol");
|
||||||
|
key.SetValue("URL Protocol", "");
|
||||||
|
|
||||||
|
RegistryKey key1 = key.CreateSubKey("DefaultIcon");
|
||||||
|
key1.SetValue("", ARCHBLOXBootstrapper_XP.Extensions.GetExecutablePath());
|
||||||
|
|
||||||
|
RegistryKey key2 = key.CreateSubKey("shell");
|
||||||
|
RegistryKey key3 = key2.CreateSubKey("open");
|
||||||
|
|
||||||
|
RegistryKey key4 = key3.CreateSubKey("command");
|
||||||
|
key4.SetValue("", "\"" + ARCHBLOXBootstrapper_XP.Extensions.GetExecutablePath() + "\" %1");
|
||||||
|
|
||||||
|
key.Close();
|
||||||
|
key1.Close();
|
||||||
|
key2.Close();
|
||||||
|
key3.Close();
|
||||||
|
key4.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue