@@ -15,27 +15,27 @@ static async Task Main(string[] args)
1515 try
1616 {
1717 Console . WriteLine ( $ "主程序初始化,{ DateTime . Now } !") ;
18- await Task . Delay ( 3000 ) ;
18+ Console . WriteLine ( "当前运行目录:" + Thread . GetDomain ( ) . BaseDirectory ) ;
19+ await Task . Delay ( 2000 ) ;
1920 var configinfo = new Configinfo
2021 {
2122 //configinfo.UpdateLogUrl = "https://www.baidu.com";
2223 ReportUrl = "http://127.0.0.1:5000/Upgrade/Report" ,
2324 UpdateUrl = "http://127.0.0.1:5000/Upgrade/Verification" ,
2425 AppName = "GeneralUpdate.Upgrad.exe" ,
2526 MainAppName = "GeneralUpdate.Client.exe" ,
26- InstallPath = @"D:\packet\installtest" ,
27+ InstallPath = Thread . GetDomain ( ) . BaseDirectory , // @"D:\packet\installtest",
2728 //configinfo.Bowl = "Generalupdate.CatBowl.exe";
2829 //当前客户端的版本号
2930 ClientVersion = "1.0.0.0" ,
3031 //当前升级端的版本号
3132 UpgradeClientVersion = "1.0.0.0" ,
3233 //产品id
33- ProductId = "a77c9df5-45f8-4ee9-b3ad-b9431ce0b51c " ,
34+ ProductId = "2d974e2a-31e6-4887-9bb1-b4689e98c77a " ,
3435 //应用密钥
35- AppSecretKey = "ABCDEFGHIJKLMNOPQRSTUVWXYZ "
36+ AppSecretKey = "dfeb5833-975e-4afb-88f1-6278ee9aeff6 "
3637 } ;
37- _ = new GeneralClientBootstrap ( ) //单个或多个更新包下载通知事件
38- . AddListenerMultiDownloadProgress ( OnMultiDownloadProgressChanged )
38+ _ = await new GeneralClientBootstrap ( ) //单个或多个更新包下载通知事件
3939 //单个或多个更新包下载速度、剩余下载事件、当前下载版本信息通知事件
4040 . AddListenerMultiDownloadStatistics ( OnMultiDownloadStatistics )
4141 //单个或多个更新包下载完成
@@ -49,7 +49,6 @@ static async Task Main(string[] args)
4949 . SetConfig ( configinfo )
5050 . Option ( UpdateOption . DownloadTimeOut , 60 )
5151 . Option ( UpdateOption . Encoding , Encoding . UTF8 )
52- . Option ( UpdateOption . Format , Format . ZIP )
5352 . LaunchAsync ( ) ;
5453 Console . WriteLine ( $ "主程序已启动,{ DateTime . Now } !") ;
5554 }
@@ -99,22 +98,19 @@ private static void OnMultiDownloadError(object arg1, MultiDownloadErrorEventArg
9998
10099 private static void OnMultiAllDownloadCompleted ( object arg1 , MultiAllDownloadCompletedEventArgs arg2 )
101100 {
102- Console . WriteLine ( arg2 . IsAllDownloadCompleted ) ;
101+ Console . WriteLine ( arg2 . IsAllDownloadCompleted ? "所有的下载任务已完成!" : $ "下载任务已失败! { arg2 . FailedVersions . Count } " ) ;
103102 }
104103
105104 private static void OnMultiDownloadCompleted ( object arg1 , MultiDownloadCompletedEventArgs arg2 )
106105 {
107- Console . WriteLine ( arg2 . Error . ToString ( ) ) ;
106+ var version = arg2 . Version as VersionInfo ;
107+ Console . WriteLine ( arg2 . IsComplated ? $ "当前下载版本:{ version . Version } , 下载完成!" : $ "当前下载版本:{ version . Version } , 下载失败!") ;
108108 }
109109
110110 private static void OnMultiDownloadStatistics ( object arg1 , MultiDownloadStatisticsEventArgs arg2 )
111111 {
112- Console . WriteLine ( $ "{ arg2 . Speed } , { arg2 . Remaining } ") ;
113- }
114-
115- private static void OnMultiDownloadProgressChanged ( object arg1 , MultiDownloadProgressChangedEventArgs arg2 )
116- {
117- Console . WriteLine ( $ "{ arg2 . TotalBytesToReceive } , { arg2 . ProgressValue } ") ;
112+ var version = arg2 . Version as VersionInfo ;
113+ Console . WriteLine ( $ "当前下载版本:{ version . Version } ,下载速度:{ arg2 . Speed } ,剩余下载时间:{ arg2 . Remaining } ,已下载大小:{ arg2 . BytesReceived } ,总大小:{ arg2 . TotalBytesToReceive } , 进度百分比:{ arg2 . ProgressPercentage } %") ;
118114 }
119115
120116 private static void OnException ( object arg1 , ExceptionEventArgs arg2 )
0 commit comments