it can actually download clients now wtf
This commit is contained in:
parent
7e3c45d9ba
commit
83230fe5ab
29
Form1.cs
29
Form1.cs
|
|
@ -17,6 +17,7 @@ namespace ARCHBLOXBootstrapper
|
||||||
{
|
{
|
||||||
public partial class ARCHBLOX : Form
|
public partial class ARCHBLOX : Form
|
||||||
{
|
{
|
||||||
|
public bool IsCompleted = 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);
|
||||||
|
|
||||||
|
|
@ -29,11 +30,18 @@ namespace ARCHBLOXBootstrapper
|
||||||
label2.Text = "Configuring ARCHBLOX...";
|
label2.Text = "Configuring ARCHBLOX...";
|
||||||
wc.DownloadProgressChanged += Client_DownloadProgressChanged;
|
wc.DownloadProgressChanged += Client_DownloadProgressChanged;
|
||||||
wc.DownloadFileCompleted += Client_DownloadFileCompleted;
|
wc.DownloadFileCompleted += Client_DownloadFileCompleted;
|
||||||
string fileName = System.IO.Path.GetFileName(@"https://archblox.com/img/ARCHBLOXarched.png");
|
byte[] raw = wc.DownloadData("https://archblox.com/client/version.txt");
|
||||||
string folderPath = Path.Combine(@"%LocalAppData%", @"\ARCHBLOX\");
|
string webData = Encoding.UTF8.GetString(raw);
|
||||||
string filePath = Path.Combine(folderPath, "test.png");
|
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);
|
Directory.CreateDirectory(folderPath);
|
||||||
wc.DownloadFileAsync(new Uri(@"https://archblox.com/img/ARCHBLOXarched.png"), filePath);
|
wc.DownloadFileAsync(new Uri(@"https://archblox.com/client/" + version_string + ".zip"), filePath);
|
||||||
progressBar2.Style = ProgressBarStyle.Blocks;
|
progressBar2.Style = ProgressBarStyle.Blocks;
|
||||||
handle.WaitOne();
|
handle.WaitOne();
|
||||||
}
|
}
|
||||||
|
|
@ -44,8 +52,17 @@ namespace ARCHBLOXBootstrapper
|
||||||
}
|
}
|
||||||
private void Client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
|
private void Client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
|
||||||
{
|
{
|
||||||
label2.Text = "ARCHBLOX has been installed!";
|
if (IsCompleted == false)
|
||||||
handle.WaitOne();
|
{
|
||||||
|
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)
|
private void Client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue