1- using System . Diagnostics ;
2- using System . Text ;
1+ using System . Text ;
32using GeneralUpdate . ClientCore ;
4- using GeneralUpdate . ClientCore . Hubs ;
53using GeneralUpdate . Common . Download ;
64using GeneralUpdate . Common . Internal ;
75using GeneralUpdate . Common . Internal . Bootstrap ;
@@ -12,90 +10,84 @@ namespace GeneralUpdate.Client
1210{
1311 internal class Program
1412 {
15- private static void Main ( string [ ] args )
13+ static async Task Main ( string [ ] args )
1614 {
17- /*Task.Run(async () =>
18- {
19- var source = @"D:\packet\app";
20- var target = @"D:\packet\release";
21- var patch = @"D:\packet\patch";
22-
23- await DifferentialCore.Instance?.Clean(source, target, patch);
24- await DifferentialCore.Instance?.Dirty(source, patch);
25- });*/
26-
27- Task . Run ( async ( ) =>
15+ try
2816 {
29- try
17+ Console . WriteLine ( $ "主程序初始化,{ DateTime . Now } !") ;
18+ await Task . Delay ( 3000 ) ;
19+ var configinfo = new Configinfo
3020 {
31- Console . WriteLine ( "主程序启动辣!!!!" ) ;
32- await Task . Delay ( 3000 ) ;
33-
34- var configinfo = new Configinfo
35- {
36- //configinfo.UpdateLogUrl = "https://www.baidu.com";
37- ReportUrl = "http://127.0.0.1:5000/Upgrade/Report" ,
38- UpdateUrl = "http://127.0.0.1:5000/Upgrade/Verification" ,
39- AppName = "GeneralUpdate.Upgrad.exe" ,
40- MainAppName = "GeneralUpdate.Client.exe" ,
41- InstallPath = @"D:\迅雷下载\Client" , //Thread.GetDomain().BaseDirectory,
42- //configinfo.Bowl = "Generalupdate.CatBowl.exe";
43- //当前客户端的版本号
44- ClientVersion = "1.0.0.0" ,
45- //当前升级端的版本号
46- UpgradeClientVersion = "1.0.0.0" ,
47- //平台
48- Platform = PlatformType . Windwos ,
49- //产品id
50- ProductId = "a77c9df5-45f8-4ee9-b3ad-b9431ce0b51c" ,
51- //应用密钥
52- AppSecretKey = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
53- } ;
21+ //configinfo.UpdateLogUrl = "https://www.baidu.com";
22+ ReportUrl = "http://127.0.0.1:5000/Upgrade/Report" ,
23+ UpdateUrl = "http://127.0.0.1:5000/Upgrade/Verification" ,
24+ AppName = "GeneralUpdate.Upgrad.exe" ,
25+ MainAppName = "GeneralUpdate.Client.exe" ,
26+ InstallPath = @"D:\packet\installtest" ,
27+ //configinfo.Bowl = "Generalupdate.CatBowl.exe";
28+ //当前客户端的版本号
29+ ClientVersion = "1.0.0.0" ,
30+ //当前升级端的版本号
31+ UpgradeClientVersion = "1.0.0.0" ,
32+ //产品id
33+ ProductId = "a77c9df5-45f8-4ee9-b3ad-b9431ce0b51c" ,
34+ //应用密钥
35+ AppSecretKey = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
36+ } ;
37+ _ = new GeneralClientBootstrap ( ) //单个或多个更新包下载通知事件
38+ . AddListenerMultiDownloadProgress ( OnMultiDownloadProgressChanged )
39+ //单个或多个更新包下载速度、剩余下载事件、当前下载版本信息通知事件
40+ . AddListenerMultiDownloadStatistics ( OnMultiDownloadStatistics )
41+ //单个或多个更新包下载完成
42+ . AddListenerMultiDownloadCompleted ( OnMultiDownloadCompleted )
43+ //完成所有的下载任务通知
44+ . AddListenerMultiAllDownloadCompleted ( OnMultiAllDownloadCompleted )
45+ //下载过程出现的异常通知
46+ . AddListenerMultiDownloadError ( OnMultiDownloadError )
47+ //整个更新过程出现的任何问题都会通过这个事件通知
48+ . AddListenerException ( OnException )
49+ . SetConfig ( configinfo )
50+ . Option ( UpdateOption . DownloadTimeOut , 60 )
51+ . Option ( UpdateOption . Encoding , Encoding . UTF8 )
52+ . Option ( UpdateOption . Format , Format . ZIP )
53+ . LaunchAsync ( ) ;
54+ Console . WriteLine ( $ "主程序已启动,{ DateTime . Now } !") ;
55+ }
56+ catch ( Exception e )
57+ {
58+ Console . WriteLine ( e . Message + "\n " + e . StackTrace ) ;
59+ }
5460
55- _ = new GeneralClientBootstrap ( ) //单个或多个更新包下载通知事件
56- . AddListenerMultiDownloadProgress ( OnMultiDownloadProgressChanged )
57- //单个或多个更新包下载速度、剩余下载事件、当前下载版本信息通知事件
58- . AddListenerMultiDownloadStatistics ( OnMultiDownloadStatistics )
59- //单个或多个更新包下载完成
60- . AddListenerMultiDownloadCompleted ( OnMultiDownloadCompleted )
61- //完成所有的下载任务通知
62- . AddListenerMultiAllDownloadCompleted ( OnMultiAllDownloadCompleted )
63- //下载过程出现的异常通知
64- . AddListenerMultiDownloadError ( OnMultiDownloadError )
65- //整个更新过程出现的任何问题都会通过这个事件通知
66- . AddListenerException ( OnException )
67- . SetConfig ( configinfo )
68- . Option ( UpdateOption . DownloadTimeOut , 60 )
69- . Option ( UpdateOption . Encoding , Encoding . UTF8 )
70- . Option ( UpdateOption . Format , Format . ZIP )
71- . LaunchAsync ( ) ;
72- }
73- catch ( Exception e )
74- {
75- Console . WriteLine ( e . Message + "\n " + e . StackTrace ) ;
76- }
77- } ) ;
78-
7961 /*var paramsOSS = new GlobalConfigInfoOSS();
8062 paramsOSS.Url = "http://192.168.50.203/versions.json";
8163 paramsOSS.CurrentVersion = "1.0.0.0";
8264 paramsOSS.VersionFileName = "versions.json";
8365 paramsOSS.AppName = "GeneralUpdate.Client.exe";
8466 paramsOSS.Encoding = Encoding.UTF8.WebName;
8567 GeneralClientOSS.Start(paramsOSS);*/
86-
8768
88- /*IUpgradeHubService hub = new UpgradeHubService("http://localhost:5008/UpgradeHub", null, "GeneralUpdate");
89- hub.AddListenerReceive(Receive);
90- hub.StartAsync().Wait();*/
69+ /*var hub = new UpgradeHubService("http://localhost:5000/UpgradeHub"
70+ , null,"a84d21d4-3448-48d4-b418-12c5a7a039cd");
71+ hub.AddListenerReceive((message) =>
72+ {
73+ Debug.WriteLine(message);
74+ });
75+ await hub.StartAsync();*/
76+
77+ /*Task.Run(async () =>
78+ {
79+ var source = @"D:\packet\app";
80+ var target = @"D:\packet\release";
81+ var patch = @"D:\packet\patch";
82+
83+ await DifferentialCore.Instance?.Clean(source, target, patch);
84+ await DifferentialCore.Instance?.Dirty(source, patch);
85+ });*/
9186
9287 while ( true )
9388 {
94- var input = Console . ReadLine ( ) ;
95- if ( input == "exit" )
96- {
97- break ;
98- }
89+ var content = Console . ReadLine ( ) ;
90+ if ( content == "exit" ) break ;
9991 }
10092 }
10193
0 commit comments