77Console . OutputEncoding = Encoding . UTF8 ;
88Console . CancelKeyPress += ( _ , _ ) => TerminalProgress . Clear ( ) ;
99
10- AppMain . InitConfiguration ( true ) ;
11- await IapManager . Init ( ) ;
12-
13- if ( IapManager . License != IapManager . LicenseStatus . Active )
10+ try
1411{
15- Console . WriteLine ( "命令行工具目前为赞助版功能,请先使用桌面版应用程序解锁" ) ;
16- return 1 ;
12+ SentrySdk . Init ( o =>
13+ {
14+ // Tells which project in Sentry to send events to:
15+ o . Dsn = "https://[email protected] /3" ; 16+ // Set TracesSampleRate to 1.0 to capture 100% of transactions for tracing.
17+ // We recommend adjusting this value in production.
18+ o . TracesSampleRate = 0.5 ;
19+ #if DEBUG
20+ o . Environment = "development" ;
21+ #endif
22+ } ) ;
23+
24+ AppMain . InitConfiguration ( true ) ;
25+ await IapManager . Init ( ) ;
26+
27+ if ( IapManager . License != IapManager . LicenseStatus . Active )
28+ {
29+ Console . WriteLine ( "命令行工具目前为赞助版功能,请先使用桌面版应用程序解锁" ) ;
30+ return 1 ;
31+ }
32+
33+ var app = new CommandApp ( ) ;
34+
35+ app . Configure ( config =>
36+ {
37+ config . SetApplicationName ( "mcm" ) ;
38+
39+ config . AddCommand < MakeUsmCommand > ( "makeusm" )
40+ . WithDescription ( "将视频文件转换为 USM 格式" )
41+ . WithExample ( "makeusm" , "video.mp4" )
42+ . WithExample ( "makeusm" , "video.mp4" , "-O" , "output.dat" )
43+ . WithExample ( "makeusm" , "video1.mp4" , "video2.mp4" , "video3.mp4" ) ;
44+
45+ config . AddCommand < MakeAcbCommand > ( "makeacb" )
46+ . WithDescription ( "将音频文件转换为 ACB 格式" )
47+ . WithExample ( "makeacb" , "audio.wav" )
48+ . WithExample ( "makeacb" , "audio.mp3" , "-O" , "output.acb" )
49+ . WithExample ( "makeacb" , "audio1.wav" , "audio2.mp3" , "--padding" , "0.5" ) ;
50+ } ) ;
51+
52+ return await app . RunAsync ( args ) ;
1753}
18-
19- var app = new CommandApp ( ) ;
20-
21- app . Configure ( config =>
54+ catch ( Exception e )
2255{
23- config . SetApplicationName ( "mcm" ) ;
24-
25- config . AddCommand < MakeUsmCommand > ( "makeusm" )
26- . WithDescription ( "将视频文件转换为 USM 格式" )
27- . WithExample ( "makeusm" , "video.mp4" )
28- . WithExample ( "makeusm" , "video.mp4" , "-O" , "output.dat" )
29- . WithExample ( "makeusm" , "video1.mp4" , "video2.mp4" , "video3.mp4" ) ;
30-
31- config . AddCommand < MakeAcbCommand > ( "makeacb" )
32- . WithDescription ( "将音频文件转换为 ACB 格式" )
33- . WithExample ( "makeacb" , "audio.wav" )
34- . WithExample ( "makeacb" , "audio.mp3" , "-O" , "output.acb" )
35- . WithExample ( "makeacb" , "audio1.wav" , "audio2.mp3" , "--padding" , "0.5" ) ;
36- } ) ;
37-
38- return await app . RunAsync ( args ) ;
56+ SentrySdk . CaptureException ( e ) ;
57+ Console . Error . WriteLine ( $ "发生错误: { e . Message } ") ;
58+ return 1 ;
59+ }
0 commit comments