mirror of
https://github.com/Stone-Red-Code/AlwaysUpToDate.git
synced 2026-09-04 08:56:04 +02:00
Added ExceptionHandler and NoUpdateAvalibleHandler
This commit is contained in:
@@ -1,23 +1,27 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AlwaysUpToDate;
|
||||
|
||||
namespace AlwaysUpToDate_Test
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static private Updater updater = new Updater(new TimeSpan(0, 0, 1), "https://raw.githubusercontent.com/Stone-Red-Code/Test/main/test.json", "./", false);
|
||||
static private Updater updater = new Updater(new TimeSpan(0, 0, 1), "https://raw.githubusercontent.com/Stone-Red-Code/Test/main/test.json", "./", true);
|
||||
|
||||
private static void Main(string[] args)
|
||||
private async static Task Main(string[] args)
|
||||
{
|
||||
updater.Start();
|
||||
updater.ProgressChanged += Updater_ProgressChanged;
|
||||
updater.UpdateAvailible += Updater_UpdateAvailible;
|
||||
updater.NoUpdateAvailible += Updater_NoUpdateAvailible;
|
||||
|
||||
Console.ReadLine();
|
||||
await Task.Delay(-1);
|
||||
}
|
||||
|
||||
private static void Updater_UpdateAvailible(string version, string additionalInformation)
|
||||
{
|
||||
updater.Stop();
|
||||
Console.WriteLine("New Update avalible: " + version);
|
||||
Console.WriteLine("Do you want to install the new update? (y/n)");
|
||||
|
||||
@@ -31,5 +35,10 @@ namespace AlwaysUpToDate_Test
|
||||
{
|
||||
Console.WriteLine($"{totalBytesDownloaded}/{totalFileSize} {progressPercentage}%");
|
||||
}
|
||||
|
||||
private static void Updater_NoUpdateAvailible()
|
||||
{
|
||||
Console.WriteLine("You are up to date");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user