Files
dsh-float-window/tools/fix-bom.ps1
T
jiangchen 8e4a648465 feat: DSH 悬浮窗 v0.1.0 — 原生置顶小窗 + 会话镜像 + 抓屏隐身
- shell: WinForms + WebView2 原生壳(无边框/置顶/固定位置/锁定尺寸/全屏/自适应缩放/截图排除)
- shell/ui.html: 自适应界面(工具栏、会话镜像区、底部聊天框、轮/步/tok/s/MTOK/缓存命中/上下文状态条、外观设置)
- lib/host.js: DSH 插件 Host 半(endpoint 写入、SSE 会话与指标快照、float_window Agent 工具)
- tools: WebView2 SDK 拉取、BOM 修复、Host 冒烟测试
- README: 架构、实测结论(WDA_EXCLUDEFROMCAPTURE、玻璃模式、DPI、WebView2 加载)
2026-09-27 14:02:58 +08:00

21 lines
1.1 KiB
PowerShell

# fix-bom.ps1 - ensure every .ps1 in this repo is UTF-8 WITH BOM.
# Windows PowerShell 5.1 reads BOM-less .ps1 as ANSI/GBK, which corrupts non-ASCII
# comments and can silently break parsing (observed: variables becoming empty).
# ASCII-only on purpose: this file must survive being saved without a BOM.
param([string]$Root)
$ErrorActionPreference = 'Stop'
if (-not $Root) { $Root = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path) }
$utf8Bom = New-Object System.Text.UTF8Encoding($true)
$fixed = 0
Get-ChildItem $Root -Recurse -File -Filter *.ps1 | Where-Object { $_.FullName -notmatch '\\\.cache\\' } | ForEach-Object {
$bytes = [System.IO.File]::ReadAllBytes($_.FullName)
$hasBom = $bytes.Length -ge 3 -and $bytes[0] -eq 0xEF -and $bytes[1] -eq 0xBB -and $bytes[2] -eq 0xBF
if (-not $hasBom) {
$text = [System.IO.File]::ReadAllText($_.FullName, [System.Text.Encoding]::UTF8)
[System.IO.File]::WriteAllText($_.FullName, $text, $utf8Bom)
Write-Host "[bom] + $($_.Name)"
$script:fixed++
}
}
Write-Host "[bom] done, fixed=$fixed"