Show Download progress on updates (needs to be tested)
This commit is contained in:
parent
df04a2002f
commit
c000acf098
3
ToDo.txt
3
ToDo.txt
@ -1,5 +1,6 @@
|
|||||||
More Icons for Apps
|
More Icons for Apps
|
||||||
More apps: Laptop Sim (when done)
|
More apps: Laptop Sim (when done)
|
||||||
Use local info when building GUI (Except name/description)
|
Use local info when building GUI (Except name/description)
|
||||||
Decent updater
|
Decent updater and Installer (Do not open CMD)
|
||||||
Save Images on disk to allow offline usage
|
Save Images on disk to allow offline usage
|
||||||
|
Test Updates
|
@ -36,11 +36,12 @@ namespace UpTool2
|
|||||||
Directory.CreateDirectory(app);
|
Directory.CreateDirectory(app);
|
||||||
if (new DownloadDialog(appI.file, app + @"\package.zip").ShowDialog() != DialogResult.OK)
|
if (new DownloadDialog(appI.file, app + @"\package.zip").ShowDialog() != DialogResult.OK)
|
||||||
throw new Exception("Download failed");
|
throw new Exception("Download failed");
|
||||||
SHA256CryptoServiceProvider sha256 = new SHA256CryptoServiceProvider();
|
using (SHA256CryptoServiceProvider sha256 = new SHA256CryptoServiceProvider())
|
||||||
|
{
|
||||||
string pkghash = BitConverter.ToString(sha256.ComputeHash(File.ReadAllBytes(app + @"\package.zip"))).Replace("-", string.Empty).ToUpper();
|
string pkghash = BitConverter.ToString(sha256.ComputeHash(File.ReadAllBytes(app + @"\package.zip"))).Replace("-", string.Empty).ToUpper();
|
||||||
if (pkghash != appI.hash.ToUpper())
|
if (pkghash != appI.hash.ToUpper())
|
||||||
throw new Exception("The hash is not equal to the one stored in the repo:\r\nPackage: " + pkghash + "\r\nOnline: " + appI.hash.ToUpper());
|
throw new Exception("The hash is not equal to the one stored in the repo:\r\nPackage: " + pkghash + "\r\nOnline: " + appI.hash.ToUpper());
|
||||||
sha256.Dispose();
|
}
|
||||||
completeInstall(app, appI);
|
completeInstall(app, appI);
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
}
|
}
|
||||||
|
@ -85,14 +85,14 @@ namespace UpTool2
|
|||||||
int version = int.Parse(meta.Element("Version").Value);
|
int version = int.Parse(meta.Element("Version").Value);
|
||||||
if (int.Parse(XDocument.Load(xml).Element("meta").Element("Version").Value) < version)
|
if (int.Parse(XDocument.Load(xml).Element("meta").Element("Version").Value) < version)
|
||||||
{
|
{
|
||||||
using (var client = new WebClient())
|
if (new DownloadDialog(meta.Element("File").Value, dir + @"\update.exe").ShowDialog() != DialogResult.OK)
|
||||||
|
throw new Exception("Failed to update");
|
||||||
|
using (SHA256CryptoServiceProvider sha256 = new SHA256CryptoServiceProvider())
|
||||||
{
|
{
|
||||||
client.DownloadFile(meta.Element("File").Value, dir + @"\update.exe");
|
string pkghash = BitConverter.ToString(sha256.ComputeHash(File.ReadAllBytes(dir + @"\update.exe"))).Replace("-", string.Empty).ToUpper();
|
||||||
|
if (pkghash != meta.Element("Hash").Value.ToUpper())
|
||||||
|
throw new Exception("The hash is not equal to the one stored in the repo:\r\nPackage: " + pkghash + "\r\nOnline: " + meta.Element("Hash").Value.ToUpper());
|
||||||
}
|
}
|
||||||
SHA256CryptoServiceProvider sha256 = new SHA256CryptoServiceProvider();
|
|
||||||
if (BitConverter.ToString(sha256.ComputeHash(File.ReadAllBytes(dir + @"\update.exe"))).Replace("-", string.Empty).ToUpper() != meta.Element("Hash").Value)
|
|
||||||
throw new Exception("The hash is not equal to the one stored in the repo");
|
|
||||||
sha256.Dispose();
|
|
||||||
new XElement("meta", new XElement("Version", version)).Save(xml);
|
new XElement("meta", new XElement("Version", version)).Save(xml);
|
||||||
splash.Hide();
|
splash.Hide();
|
||||||
Process.Start(new ProcessStartInfo { FileName = "cmd.exe", Arguments = "/C echo Running Update & timeout /t 4 & copy /b/v/y \"" + dir + @"\update.exe" + "\" \"" + Application.ExecutablePath + "\" & echo Done Updating, please restart & pause" });
|
Process.Start(new ProcessStartInfo { FileName = "cmd.exe", Arguments = "/C echo Running Update & timeout /t 4 & copy /b/v/y \"" + dir + @"\update.exe" + "\" \"" + Application.ExecutablePath + "\" & echo Done Updating, please restart & pause" });
|
||||||
|
Reference in New Issue
Block a user