Added ExceptionHandler and NoUpdateAvalibleHandler

This commit is contained in:
Stone-Red-Code
2021-06-26 17:11:10 +02:00
parent 4a567db427
commit f06d505f6c
82 changed files with 11901 additions and 181 deletions
+12 -3
View File
@@ -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");
}
}
}