Skip to content

Commit

Permalink
Update Program.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
JusterZhu committed Oct 1, 2023
1 parent 653b856 commit 7b8fd97
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions src/c#/GeneralUpdate.Upgrad/Program.cs
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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);
Expand All @@ -34,26 +36,26 @@ private static void Main(string[] args)
GeneralUpdateOSS.AddListenerException(OnException);
await GeneralUpdateOSS.Start<OSSStrategy>(@params,Encoding.Default);

//Part 2
//var bootStrap = new GeneralUpdateBootstrap()
////单个或多个更新包下载通知事件
//.AddListenerMultiDownloadProgress(OnMultiDownloadProgressChanged)
////单个或多个更新包下载速度、剩余下载事件、当前下载版本信息通知事件
//.AddListenerMultiDownloadStatistics(OnMultiDownloadStatistics)
////单个或多个更新包下载完成
//.AddListenerMultiDownloadCompleted(OnMultiDownloadCompleted)
////完成所有的下载任务通知
//.AddListenerMultiAllDownloadCompleted(OnMultiAllDownloadCompleted)
////下载过程出现的异常通知
//.AddListenerMultiDownloadError(OnMultiDownloadError)
////整个更新过程出现的任何问题都会通过这个事件通知
//.AddListenerException(OnException)
//.Strategy<WindowsStrategy>().
//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<WindowsStrategy>().
Option(UpdateOption.Encoding, Encoding.Default).
Option(UpdateOption.DownloadTimeOut, 60).
Option(UpdateOption.Format, Format.ZIP).
Remote(args[0]).
LaunchTaskAsync();
});
Console.Read();
}
Expand Down

0 comments on commit 7b8fd97

Please sign in to comment.