Skip to content

Commit 165feb7

Browse files
committed
fix: 恢复打包 7 个 native 库,等 wrc 那边优化了插件市场下载逻辑使其支持多产物选择下载。
1 parent 5cd4e0e commit 165feb7

File tree

3 files changed

+7
-126
lines changed

3 files changed

+7
-126
lines changed

SuperautoIsland/ClearScriptPackages.cs

Lines changed: 0 additions & 57 deletions
This file was deleted.

SuperautoIsland/Plugin.cs

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -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;

SuperautoIsland/SuperautoIsland.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@
1313
<ExcludeAssets>runtime; native</ExcludeAssets>
1414
</PackageReference>
1515
<PackageReference Include="Microsoft.ClearScript.V8" Version="7.5.0" />
16+
<PackageReference Include="Microsoft.ClearScript.V8.Native.linux-arm64" Version="7.5.0" />
17+
<PackageReference Include="Microsoft.ClearScript.V8.Native.linux-x64" Version="7.5.0" />
18+
<PackageReference Include="Microsoft.ClearScript.V8.Native.osx-arm64" Version="7.5.0" />
19+
<PackageReference Include="Microsoft.ClearScript.V8.Native.osx-x64" Version="7.5.0" />
20+
<PackageReference Include="Microsoft.ClearScript.V8.Native.win-arm64" Version="7.5.0" />
21+
<PackageReference Include="Microsoft.ClearScript.V8.Native.win-x64" Version="7.5.0" />
22+
<PackageReference Include="Microsoft.ClearScript.V8.Native.win-x86" Version="7.5.0" />
1623
<PackageReference Include="V8.Extended" Version="1.0.4" />
1724
<ProjectReference Include="..\SuperAutoIsland.Interface\SuperAutoIsland.Interface.csproj" />
1825
</ItemGroup>

0 commit comments

Comments
 (0)