From 7b8fd97d57838cd1ab1e3c774496dcb45aa2c33e Mon Sep 17 00:00:00 2001 From: "Juster.zhu" Date: Sun, 1 Oct 2023 15:36:56 +0800 Subject: [PATCH] Update Program.cs --- src/c#/GeneralUpdate.Upgrad/Program.cs | 44 ++++++++++++++------------ 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/src/c#/GeneralUpdate.Upgrad/Program.cs b/src/c#/GeneralUpdate.Upgrad/Program.cs index 8f823a4f..b38cb2e5 100644 --- a/src/c#/GeneralUpdate.Upgrad/Program.cs +++ b/src/c#/GeneralUpdate.Upgrad/Program.cs @@ -1,9 +1,11 @@ using GeneralUpdate.Core; +using GeneralUpdate.Core.Bootstrap; using GeneralUpdate.Core.Domain.Entity; using GeneralUpdate.Core.Domain.Enum; using GeneralUpdate.Core.Events.CommonArgs; using GeneralUpdate.Core.Events.MultiEventArgs; using GeneralUpdate.Core.Strategys; +using GeneralUpdate.Core.Strategys.PlatformWindows; using System.Text; namespace GeneralUpdate.Upgrad @@ -18,7 +20,7 @@ private static void Main(string[] args) var appName = "GeneralUpdate.Client"; var version = "1.0.0.0"; - //Part1 + //Part1 OSS服务示例 var versionFileName = "version.json"; ParamsOSS @params = new ParamsOSS(url, appName, version, versionFileName); GeneralUpdateOSS.AddListenerMultiDownloadProgress(OnMultiDownloadProgressChanged); @@ -34,26 +36,26 @@ private static void Main(string[] args) GeneralUpdateOSS.AddListenerException(OnException); await GeneralUpdateOSS.Start(@params,Encoding.Default); - //Part 2 - //var bootStrap = new GeneralUpdateBootstrap() - ////单个或多个更新包下载通知事件 - //.AddListenerMultiDownloadProgress(OnMultiDownloadProgressChanged) - ////单个或多个更新包下载速度、剩余下载事件、当前下载版本信息通知事件 - //.AddListenerMultiDownloadStatistics(OnMultiDownloadStatistics) - ////单个或多个更新包下载完成 - //.AddListenerMultiDownloadCompleted(OnMultiDownloadCompleted) - ////完成所有的下载任务通知 - //.AddListenerMultiAllDownloadCompleted(OnMultiAllDownloadCompleted) - ////下载过程出现的异常通知 - //.AddListenerMultiDownloadError(OnMultiDownloadError) - ////整个更新过程出现的任何问题都会通过这个事件通知 - //.AddListenerException(OnException) - //.Strategy(). - //Option(UpdateOption.Encoding, Encoding.Default). - //Option(UpdateOption.DownloadTimeOut, 60). - //Option(UpdateOption.Format, Format.ZIP). - //Remote(args[0]); - //await bootStrap.LaunchTaskAsync(); + //Part 2 常规更新示例 + var bootStrap = await new GeneralUpdateBootstrap() + //单个或多个更新包下载通知事件 + .AddListenerMultiDownloadProgress(OnMultiDownloadProgressChanged) + //单个或多个更新包下载速度、剩余下载事件、当前下载版本信息通知事件 + .AddListenerMultiDownloadStatistics(OnMultiDownloadStatistics) + //单个或多个更新包下载完成 + .AddListenerMultiDownloadCompleted(OnMultiDownloadCompleted) + //完成所有的下载任务通知 + .AddListenerMultiAllDownloadCompleted(OnMultiAllDownloadCompleted) + //下载过程出现的异常通知 + .AddListenerMultiDownloadError(OnMultiDownloadError) + //整个更新过程出现的任何问题都会通过这个事件通知 + .AddListenerException(OnException) + .Strategy(). + Option(UpdateOption.Encoding, Encoding.Default). + Option(UpdateOption.DownloadTimeOut, 60). + Option(UpdateOption.Format, Format.ZIP). + Remote(args[0]). + LaunchTaskAsync(); }); Console.Read(); }