mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 19:57:07 +02:00
Misc
This commit is contained in:
@@ -17,35 +17,29 @@ namespace Wox.Core
|
|||||||
public static async Task UpdateApp()
|
public static async Task UpdateApp()
|
||||||
{
|
{
|
||||||
|
|
||||||
var client = new WebClient { Proxy = Http.WebProxy() };
|
var c = new WebClient { Proxy = Http.WebProxy() };
|
||||||
var downloader = new FileDownloader(client);
|
var d = new FileDownloader(c);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
const string url = Infrastructure.Constant.Github;
|
||||||
// todo 5/9 the return value of UpdateApp() is NULL, fucking useless!
|
// todo 5/9 the return value of UpdateApp() is NULL, fucking useless!
|
||||||
using (var updater = await UpdateManager.GitHubUpdateManager(Infrastructure.Constant.Github, urlDownloader: downloader))
|
using (var m = await UpdateManager.GitHubUpdateManager(url, urlDownloader: d))
|
||||||
{
|
{
|
||||||
await updater.UpdateApp();
|
await m.UpdateApp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (HttpRequestException he)
|
catch (Exception e) when (e is HttpRequestException || e is WebException || e is SocketException)
|
||||||
{
|
{
|
||||||
Log.Exception("|Updater.UpdateApp|network error", he);
|
Log.Exception("|Updater.UpdateApp|Network error", e);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (WebException we)
|
catch (Exception e)
|
||||||
{
|
|
||||||
Log.Exception("|Updater.UpdateApp|network error", we);
|
|
||||||
}
|
|
||||||
catch (SocketException sc)
|
|
||||||
{
|
|
||||||
Log.Exception("|Updater.UpdateApp|Socket exception happened, which method cause this exception??", sc);
|
|
||||||
}
|
|
||||||
catch (Exception exception)
|
|
||||||
{
|
{
|
||||||
const string info = "Update.exe not found, not a Squirrel-installed app?";
|
const string info = "Update.exe not found, not a Squirrel-installed app?";
|
||||||
if (exception.Message == info)
|
if (e.Message == info)
|
||||||
{
|
{
|
||||||
Log.Warn($"|Updater.UpdateApp|{info}");
|
Log.Error($"|Updater.UpdateApp|{info}");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user