Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
Quick hotfix for AutoUpdater
Browse files Browse the repository at this point in the history
  • Loading branch information
aleab committed Mar 31, 2018
1 parent d87bd4a commit c66be3e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
6 changes: 5 additions & 1 deletion Toastify/src/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,11 @@ private static void AutoUpdater_UpdateReady(object sender, UpdateReadyEventArgs
}
else
{
ProcessStartInfo psi = new ProcessStartInfo(e.InstallerPath) { UseShellExecute = true };
ProcessStartInfo psi = new ProcessStartInfo(e.InstallerPath)
{
UseShellExecute = true,
Verb = "runas"
};
Process.Start(psi);
App.Terminate();
}
Expand Down
16 changes: 11 additions & 5 deletions Toastify/src/Services/AutoUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ public static AutoUpdater Instance
protected AutoUpdater()
{
VersionChecker.Instance.CheckVersionComplete += this.VersionChecker_CheckVersionComplete;

this.VersionChecker_CheckVersionComplete(this, new CheckVersionCompleteEventArgs
{
GitHubReleaseDownloadUrl = "https://github.com/aleab/toastify/releases/download/v1.10.5/ToastifyInstaller.exe",
Version = "v1.10.5",
GitHubReleaseUrl = "https://github.com/aleab/toastify/releases/tag/v1.10.5",
IsNew = true
});
}

private static bool ShouldDownload(UpdateDeliveryMode updateDeliveryMode)
Expand All @@ -60,12 +68,10 @@ private async void VersionChecker_CheckVersionComplete(object sender, CheckVersi
try
{
if (Directory.Exists(UpdateDownloadPath))
{
Directory.Delete(UpdateDownloadPath);
Directory.CreateDirectory(UpdateDownloadPath);
}
Directory.Delete(UpdateDownloadPath, true);
Directory.CreateDirectory(UpdateDownloadPath);
string filePath = Path.Combine(UpdateDownloadPath, "ToastifyInstaller.exe");
await webClient.DownloadFileTaskAsync(UpdateDownloadPath, filePath).ConfigureAwait(false);
await webClient.DownloadFileTaskAsync(e.GitHubReleaseDownloadUrl, filePath).ConfigureAwait(false);

if (File.Exists(filePath))
{
Expand Down

0 comments on commit c66be3e

Please sign in to comment.