@@ -39,75 +39,6 @@ public override void Initialize(HostBuilderContext context, IServiceCollection s
3939 _logger . Info ( "欢迎使用 SuperAutoIsland" ) ;
4040 _logger . Info ( "初期化中..." ) ;
4141
42- _logger . Info ( "检查并补全 ClearScripts 中..." ) ;
43- ClearScriptPackages . Initialize ( ) ;
44-
45- string platform ;
46- if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
47- {
48- platform = "win" ;
49- }
50- else if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) )
51- {
52- platform = "linux" ;
53- }
54- else if ( RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) )
55- {
56- platform = "osx" ;
57- }
58- else
59- {
60- _logger . Error ( "未知平台,退出 SuperAutoIsland." ) ;
61- return ;
62- }
63-
64- string arch ;
65- switch ( RuntimeInformation . ProcessArchitecture )
66- {
67- case Architecture . X86 :
68- arch = "x86" ;
69- break ;
70- case Architecture . X64 :
71- arch = "x64" ;
72- break ;
73- case Architecture . Arm64 :
74- arch = "arm64" ;
75- break ;
76- case Architecture . Arm :
77- case Architecture . Wasm :
78- case Architecture . S390x :
79- case Architecture . LoongArch64 :
80- case Architecture . Armv6 :
81- case Architecture . Ppc64le :
82- default :
83- _logger . Error ( "未知架构,退出 SuperAutoIsland." ) ;
84- return ;
85- }
86-
87- var target = $ "{ platform } -{ arch } ";
88- var packageInfo = ClearScriptPackages . Infos [ target ] ;
89- var packagePath = $ "{ Info . PluginFolderPath } /runtimes/{ target } /native/{ packageInfo . FileName } ";
90-
91- if ( ! File . Exists ( packagePath ) )
92- {
93- _logger . Info ( "不存在依赖库!开始下载..." ) ;
94-
95- // 已过时
96- // using var web = new WebClient();
97- // web.DownloadFile(packageInfo.Url, packagePath);
98-
99- var httpClient = new HttpClient ( ) ;
100- using var response = httpClient . GetAsync ( packageInfo . Url ) . Result ;
101- using var fs = File . Create ( packagePath ) ;
102- response . Content . CopyToAsync ( fs ) . Wait ( ) ;
103-
104- _logger . Info ( "依赖库下载完毕!" ) ;
105- }
106- else
107- {
108- _logger . Info ( "存在依赖库!继续执行" ) ;
109- }
110-
11142 _logger . Info ( "加载配置..." ) ;
11243 GlobalConstants . PluginFolder = Info . PluginFolderPath ;
11344 GlobalConstants . PluginConfigFolder = PluginConfigFolder ;
0 commit comments