退役独立扒图程序与试验工具,消除重复源码:删 pdfbt 项目/cadbt C#部分(保留 node+CAD-Viewer 网页引擎,主程序扒图依赖)/ghj/yjktool;打包链同步(make_package 去独立exe/setup.iss 删pdfbt/更新包不再带pdfbt.exe);护栏扩到全部4对双胞胎文件;README 结构更新;编译+组装验证通过
This commit is contained in:
+26
-12
@@ -1,4 +1,4 @@
|
||||
# ============================================================
|
||||
# ============================================================
|
||||
# 扒图同步检查.ps1 —— Cad/Pdf 扒图窗口 Form3.cs 漂移护栏
|
||||
# ============================================================
|
||||
# 背景: 扒图\Cad\Form3.cs 与 扒图\Pdf\Form3.cs 是约 98% 重复的双胞胎文件
|
||||
@@ -18,8 +18,19 @@ $cadPath = Join-Path $root '成套报价软件\扒图\Cad\Form3.cs'
|
||||
$pdfPath = Join-Path $root '成套报价软件\扒图\Pdf\Form3.cs'
|
||||
$baseline = Join-Path $PSScriptRoot '扒图同步基线.txt'
|
||||
|
||||
foreach ($f in @($cadPath, $pdfPath)) {
|
||||
if (-not (Test-Path $f)) { Write-Host "[FAIL] 缺少文件: $f" -ForegroundColor Red; exit 2 }
|
||||
# ★ 2026-10-01 扩充:从只查 Form3.cs 扩展到全部 Cad/Pdf 双胞胎文件对
|
||||
# (新建项目.cs 与两对 Designer/ui.cs 此前是漂移盲区)
|
||||
$pairs = @(
|
||||
@('成套报价软件\扒图\Cad\Form3.cs', '成套报价软件\扒图\Pdf\Form3.cs'),
|
||||
@('成套报价软件\扒图\Cad\新建项目.cs', '成套报价软件\扒图\Pdf\新建项目.cs'),
|
||||
@('成套报价软件\扒图\Cad\Form3.ui.cs', '成套报价软件\扒图\Pdf\Form3.Designer.cs'),
|
||||
@('成套报价软件\扒图\Cad\新建项目.ui.cs', '成套报价软件\扒图\Pdf\新建项目.Designer.cs')
|
||||
)
|
||||
|
||||
foreach ($p in $pairs) {
|
||||
foreach ($f in @((Join-Path $root $p[0]), (Join-Path $root $p[1]))) {
|
||||
if (-not (Test-Path $f)) { Write-Host "[FAIL] 缺少文件: $f" -ForegroundColor Red; exit 2 }
|
||||
}
|
||||
}
|
||||
|
||||
function Normalize([string]$path) {
|
||||
@@ -34,17 +45,20 @@ function Normalize([string]$path) {
|
||||
|
||||
$tmpCad = Join-Path $env:TEMP 'baotu_cad_norm.cs'
|
||||
$tmpPdf = Join-Path $env:TEMP 'baotu_pdf_norm.cs'
|
||||
Normalize $cadPath | Set-Content $tmpCad -Encoding UTF8
|
||||
Normalize $pdfPath | Set-Content $tmpPdf -Encoding UTF8
|
||||
|
||||
$diffFile = Join-Path $env:TEMP 'baotu_drift.diff'
|
||||
$null = git diff --no-index --unified=1 $tmpCad $tmpPdf 2>$null | Out-File $diffFile -Encoding UTF8
|
||||
|
||||
$numstat = git diff --no-index --numstat $tmpCad $tmpPdf 2>$null
|
||||
$added = 0; $deleted = 0
|
||||
if ($numstat) {
|
||||
$parts = (@($numstat)[0]) -split "`t"
|
||||
if ($parts.Count -ge 2) { $added = [int]$parts[0]; $deleted = [int]$parts[1] }
|
||||
"" | Out-File $diffFile -Encoding UTF8
|
||||
|
||||
foreach ($p in $pairs) {
|
||||
$cadF = Join-Path $root $p[0]; $pdfF = Join-Path $root $p[1]
|
||||
Normalize $cadF | Set-Content $tmpCad -Encoding UTF8
|
||||
Normalize $pdfF | Set-Content $tmpPdf -Encoding UTF8
|
||||
$null = git diff --no-index --unified=1 $tmpCad $tmpPdf 2>$null | Out-File $diffFile -Append -Encoding UTF8
|
||||
$numstat = git diff --no-index --numstat $tmpCad $tmpPdf 2>$null
|
||||
if ($numstat) {
|
||||
$parts = (@($numstat)[0]) -split "`t"
|
||||
if ($parts.Count -ge 2) { $added += [int]$parts[0]; $deleted += [int]$parts[1] }
|
||||
}
|
||||
}
|
||||
$drift = $added + $deleted
|
||||
|
||||
|
||||
Reference in New Issue
Block a user