1- // See https://aka.ms/new-console-template for more information
2-
3- //ClientStrategy该更新策略将完成1.自动升级组件自更新 2.启动更新组件 3.配置好ClientParameter无需再像之前的版本写args数组进程通讯了。
4- //generalClientBootstrap.Config(baseUrl, "B8A7FADD-386C-46B0-B283-C9F963420C7C").
5-
6- using System . Text ;
1+ using System . Text ;
72using GeneralUpdate . ClientCore ;
83using GeneralUpdate . Core . Bootstrap ;
94using GeneralUpdate . Core . Domain . Entity ;
127using GeneralUpdate . Core . Events . MultiEventArgs ;
138using GeneralUpdate . Core . Strategys . PlatformWindows ;
149
10+ //ClientStrategy该更新策略将完成1.自动升级组件自更新 2.启动更新组件 3.配置好ClientParameter无需再像之前的版本写args数组进程通讯了。
11+ //generalClientBootstrap.Config(baseUrl, "B8A7FADD-386C-46B0-B283-C9F963420C7C").
1512
1613var baseUrl = "127.0.0.1" ;
17-
1814var configinfo = GetWindowsConfigInfo ( ) ;
1915var generalClientBootstrap = await new GeneralClientBootstrap ( )
2016//单个或多个更新包下载通知事件
@@ -72,7 +68,7 @@ Configinfo GetWindowsConfigInfo()
7268 //本机的客户端程序应用地址
7369 config . InstallPath = @"D:\packet\source" ;
7470 //更新公告网页
75- config . UpdateLogUrl = "https://www.baidu.com /" ;
71+ config . UpdateLogUrl = "https://www.justerzhu.cn /" ;
7672 //客户端当前版本号
7773 config . ClientVersion = "1.1.1.1" ;
7874 //客户端类型:1.主程序客户端 2.更新组件
@@ -126,6 +122,7 @@ void OnMultiDownloadStatistics(object sender, MultiDownloadStatisticsEventArgs e
126122 //e.Remaining 剩余下载时间
127123 //e.Speed 下载速度
128124 //e.Version 当前下载的版本信息
125+ Console . WriteLine ( $ "{ e . Version } download speed { e . Speed } bytes/s. Remaining { e . Remaining } ") ;
129126}
130127
131128void OnMultiDownloadProgressChanged ( object sender , MultiDownloadProgressChangedEventArgs e )
@@ -136,34 +133,28 @@ void OnMultiDownloadProgressChanged(object sender, MultiDownloadProgressChangedE
136133 //e.Version 当前下载的版本信息
137134 //e.Type 当前正在执行的操作 1.ProgressType.Check 检查版本信息中 2.ProgressType.Donwload 正在下载当前版本 3. ProgressType.Updatefile 更新当前版本 4. ProgressType.Done更新完成 5.ProgressType.Fail 更新失败
138135 //e.BytesReceived 已下载大小
139- DispatchMessage ( $ "{ e . ProgressPercentage } %") ;
140- //MyProgressBar.ProgressTo(e.ProgressValue, 100, Easing.Default);
136+ Console . WriteLine ( $ "{ e . ProgressPercentage } %") ;
141137}
142138
143139void OnException ( object sender , ExceptionEventArgs e )
144140{
145- //DispatchMessage (e.Exception.Message);
141+ Console . WriteLine ( e . Exception . Message ) ;
146142}
147143
148144void OnMultiAllDownloadCompleted ( object sender , MultiAllDownloadCompletedEventArgs e )
149145{
150146 //e.FailedVersions; 如果出现下载失败则会把下载错误的版本、错误原因统计到该集合当中。
151- DispatchMessage ( $ "Is all download completed { e . IsAllDownloadCompleted } .") ;
147+ Console . WriteLine ( $ "Is all download completed { e . IsAllDownloadCompleted } .") ;
152148}
153149
154150void OnMultiDownloadCompleted ( object sender , MultiDownloadCompletedEventArgs e )
155151{
156152 var info = e . Version as VersionInfo ;
157- DispatchMessage ( $ "{ info . Name } download completed.") ;
153+ Console . WriteLine ( $ "{ info . Name } download completed.") ;
158154}
159155
160156void OnMultiDownloadError ( object sender , MultiDownloadErrorEventArgs e )
161157{
162158 var info = e . Version as VersionInfo ;
163- DispatchMessage ( $ "{ info . Name } error!") ;
159+ Console . WriteLine ( $ "{ info . Name } error!") ;
164160}
165-
166- void DispatchMessage ( string message )
167- {
168- //ShowMessage(message);
169- }
0 commit comments