-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUpdater.cs
More file actions
35 lines (29 loc) · 831 Bytes
/
Copy pathUpdater.cs
File metadata and controls
35 lines (29 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
namespace SystemGameManager.Service;
using Velopack;
using Velopack.Sources;
using System;
using System.Threading.Tasks;
using SystemGameManager.Handler;
public class Updater
{
public async Task AutoUpdate()
{
try
{
var repoUrl = GlobalConfig.Settings.AppConfig.RepositoryUrl;
var source = new GithubSource(repoUrl, null, true);
var mgr = new UpdateManager(source);
if (!mgr.IsInstalled)
return;
var update = await mgr.CheckForUpdatesAsync();
if (update == null)
return;
await mgr.DownloadUpdatesAsync(update);
mgr.ApplyUpdatesAndRestart(update);
}
catch (Exception ex)
{
ErrorHandler.Handle(ex, ErrorSeverity.Warning);
}
}
}