55 lines
1.8 KiB
PowerShell
55 lines
1.8 KiB
PowerShell
# Better-EN5 插件安装脚本
|
|
# 以管理员身份运行
|
|
param(
|
|
[string]$BuildConfig = "Release"
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$pluginName = "Better-EN5"
|
|
$seewoPath = "$env:ProgramFiles(x86)\Seewo\EasiNote5"
|
|
$dotnet = "C:\Program Files\dotnet\dotnet.exe"
|
|
|
|
# 查找最新版本目录
|
|
$versionDirs = Get-ChildItem "$seewoPath\EasiNote5_*" -Directory | Sort-Object Name -Descending
|
|
if ($versionDirs.Count -eq 0) {
|
|
Write-Host "未找到希沃白板安装目录" -ForegroundColor Red
|
|
exit 1
|
|
}
|
|
|
|
$targetDir = Join-Path $versionDirs[0].FullName "Main\Extensions\$pluginName"
|
|
$sourceDir = Join-Path $PSScriptRoot "..\Better-EN5\bin\$BuildConfig\net6.0-windows"
|
|
|
|
Write-Host "安装到: $targetDir" -ForegroundColor Cyan
|
|
|
|
# 检查构建输出
|
|
if (-not (Test-Path $sourceDir)) {
|
|
Write-Host "未找到构建输出,正在构建..." -ForegroundColor Yellow
|
|
if (Test-Path $dotnet) {
|
|
$env:Path = "C:\Program Files\dotnet;$env:Path"
|
|
& $dotnet build -c $BuildConfig (Join-Path $PSScriptRoot "..\Better-EN5")
|
|
if (-not $?) { exit 1 }
|
|
} else {
|
|
Write-Host "找不到 dotnet 编译器" -ForegroundColor Red
|
|
exit 1
|
|
}
|
|
}
|
|
|
|
# 创建插件目录
|
|
New-Item -ItemType Directory -Path $targetDir -Force | Out-Null
|
|
|
|
# 复制插件文件
|
|
Copy-Item "$sourceDir\*" $targetDir -Recurse -Force
|
|
Write-Host "插件文件已复制" -ForegroundColor Green
|
|
|
|
# 复制 manifest.coin
|
|
$manifestSource = Join-Path $PSScriptRoot "..\Better-EN5\manifest.coin"
|
|
if (Test-Path $manifestSource) {
|
|
Copy-Item $manifestSource $targetDir -Force
|
|
Write-Host "manifest.coin 已复制" -ForegroundColor Green
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "安装完成!请重启希沃白板以加载插件。" -ForegroundColor Green
|
|
Write-Host "在希沃白板的右键菜单中可以找到 'Better-Seewo 设置' 入口。" -ForegroundColor Cyan
|