bootstrapper now uses appdata and asks if you want to delete old installs
This commit is contained in:
parent
83230fe5ab
commit
c53ef735d6
|
|
@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.2.32516.85
|
VisualStudioVersion = 17.2.32516.85
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
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
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
|
|
||||||
64
Form1.cs
64
Form1.cs
|
|
@ -8,6 +8,8 @@ using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Security.Permissions;
|
||||||
|
using Microsoft.Win32;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
@ -15,35 +17,64 @@ using System.DirectoryServices;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
namespace ARCHBLOXBootstrapper
|
namespace ARCHBLOXBootstrapper
|
||||||
{
|
{
|
||||||
|
|
||||||
public partial class ARCHBLOX : Form
|
public partial class ARCHBLOX : Form
|
||||||
{
|
{
|
||||||
public bool IsCompleted = false;
|
public bool IsCompleted = 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);
|
||||||
|
|
||||||
public ARCHBLOX()
|
public ARCHBLOX()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
byte[] raw = wc.DownloadData("https://archblox.com/client/version.txt");
|
||||||
|
string webData = Encoding.UTF8.GetString(raw);
|
||||||
|
string version_string = webData;
|
||||||
|
string folderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"Archblx\", @"Versions\");
|
||||||
|
string clientPath = Path.Combine(folderPath, version_string + @"\");
|
||||||
|
string filePath = Path.Combine(clientPath, Path.GetFileName(@"https://archblox.com/client/" + version_string + ".zip"));
|
||||||
|
{
|
||||||
|
if (Directory.Exists(folderPath))
|
||||||
|
{
|
||||||
|
DialogResult res = MessageBox.Show("Do you want to delete previous installs of ARCHBLOX?", "ARCHBLOX", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
|
||||||
|
if (res == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
label2.Text = "Removing previous installs...";
|
||||||
|
Directory.Delete(folderPath, true);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
wc.DownloadProgressChanged += Client_DownloadProgressChanged;
|
wc.DownloadProgressChanged += Client_DownloadProgressChanged;
|
||||||
wc.DownloadFileCompleted += Client_DownloadFileCompleted;
|
wc.DownloadFileCompleted += Client_DownloadFileCompleted;
|
||||||
progressBar2.Style = ProgressBarStyle.Marquee;
|
progressBar2.Style = ProgressBarStyle.Marquee;
|
||||||
label2.Text = "Configuring ARCHBLOX...";
|
label2.Text = "Configuring ARCHBLOX...";
|
||||||
wc.DownloadProgressChanged += Client_DownloadProgressChanged;
|
wc.DownloadProgressChanged += Client_DownloadProgressChanged;
|
||||||
wc.DownloadFileCompleted += Client_DownloadFileCompleted;
|
wc.DownloadFileCompleted += Client_DownloadFileCompleted;
|
||||||
byte[] raw = wc.DownloadData("https://archblox.com/client/version.txt");
|
if (Directory.Exists(clientPath))
|
||||||
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...";
|
DialogResult res = MessageBox.Show("The latest version of ARCHBLOX is already installed. Do you want to re-install it?", "ARCHBLOX", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
|
||||||
Directory.Delete(folderPath, true);
|
if (res == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
label2.Text = "Removing previous install...";
|
||||||
|
Directory.Delete(clientPath, true);
|
||||||
|
|
||||||
|
}
|
||||||
|
if (res == DialogResult.No)
|
||||||
|
{
|
||||||
|
label2.Text = "Cancelled install.";
|
||||||
|
DontEvenBother = true;
|
||||||
|
Application.Exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (DontEvenBother == false)
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(clientPath);
|
||||||
|
wc.DownloadFileAsync(new Uri(@"https://archblox.com/client/" + version_string + ".zip"), filePath);
|
||||||
|
progressBar2.Style = ProgressBarStyle.Blocks;
|
||||||
|
handle.WaitOne();
|
||||||
}
|
}
|
||||||
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)
|
private void ARCHBLOX_Load(object sender, EventArgs e)
|
||||||
|
|
@ -58,10 +89,13 @@ namespace ARCHBLOXBootstrapper
|
||||||
byte[] raw = wc.DownloadData("https://archblox.com/client/version.txt");
|
byte[] raw = wc.DownloadData("https://archblox.com/client/version.txt");
|
||||||
string webData = Encoding.UTF8.GetString(raw);
|
string webData = Encoding.UTF8.GetString(raw);
|
||||||
string version_string = webData;
|
string version_string = webData;
|
||||||
string folderPath = Path.Combine(@"C:\ARCHBLOX\", version_string + @"\");
|
string folderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"Archblx\", @"Versions\");
|
||||||
string filePath = Path.Combine(folderPath, Path.GetFileName(@"https://archblox.com/client/" + version_string + ".zip"));
|
string clientPath = Path.Combine(folderPath, version_string + @"\");
|
||||||
ZipFile.ExtractToDirectory(filePath, folderPath);
|
string filePath = Path.Combine(clientPath, Path.GetFileName(@"https://archblox.com/client/" + version_string + ".zip"));
|
||||||
|
ZipFile.ExtractToDirectory(filePath, clientPath);
|
||||||
|
File.Delete(filePath);
|
||||||
label2.Text = "ARCHBLOX has been installed!";
|
label2.Text = "ARCHBLOX has been installed!";
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue