vcx2txt.ps1: conversie incrementala reala - fara reconversii false la fiecare rulare
- Start-Process -Wait in loc de "&" (exe GUI - controlul se preda inainte de final, iar stergerea binarului copiat omora conversia in curs). - succes decis pe rescrierea efectiva a textului sau raportul E0 al exe-ului, nu pe simpla existenta a unui text vechi (esecurile erau mascate ca "OK"). - FoxBin2Prg nu actualizeaza mtime cand textul regenerat e identic (ex. binare reatinse de Project > Build fara schimbari reale) - sincronizam mtime-ul textului, altfel fisierul parea stale si se reconvertea la nesfarsit. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
19
vcx2txt.ps1
19
vcx2txt.ps1
@@ -94,13 +94,28 @@ function Convert-One($fullPath) {
|
|||||||
Copy-Item -LiteralPath $f.FullName -Destination $binCopy -Force
|
Copy-Item -LiteralPath $f.FullName -Destination $binCopy -Force
|
||||||
if (Test-Path $memo) { Copy-Item -LiteralPath $memo -Destination (Join-Path $workDir (Split-Path $memo -Leaf)) -Force }
|
if (Test-Path $memo) { Copy-Item -LiteralPath $memo -Destination (Join-Path $workDir (Split-Path $memo -Leaf)) -Force }
|
||||||
|
|
||||||
& $exe $binCopy '' '' '' '1' '0' '1' | Out-Null
|
# FoxBin2Prg.EXE e aplicatie GUI: "&" poate preda controlul inainte de final, iar stergerea
|
||||||
|
# binarului copiat ar omori conversia in curs -> Start-Process -Wait asteapta terminarea reala.
|
||||||
|
$started = Get-Date
|
||||||
|
$outLog = Join-Path $workDir ([IO.Path]::GetFileNameWithoutExtension($f.Name) + '.fb2p_out.tmp')
|
||||||
|
Start-Process -FilePath $exe -ArgumentList "`"$binCopy`" `"`" `"`" `"`" 1 0 1" -Wait -WindowStyle Hidden -RedirectStandardOutput $outLog
|
||||||
|
$exeOut = ''
|
||||||
|
if (Test-Path $outLog) { $exeOut = Get-Content -Raw $outLog; Remove-Item -LiteralPath $outLog -Force -ErrorAction SilentlyContinue }
|
||||||
|
|
||||||
Remove-Item -LiteralPath $binCopy -Force -ErrorAction SilentlyContinue
|
Remove-Item -LiteralPath $binCopy -Force -ErrorAction SilentlyContinue
|
||||||
$memoCopy = Join-Path $workDir (Split-Path $memo -Leaf)
|
$memoCopy = Join-Path $workDir (Split-Path $memo -Leaf)
|
||||||
if (Test-Path $memoCopy) { Remove-Item -LiteralPath $memoCopy -Force -ErrorAction SilentlyContinue }
|
if (Test-Path $memoCopy) { Remove-Item -LiteralPath $memoCopy -Force -ErrorAction SilentlyContinue }
|
||||||
|
|
||||||
if (Test-Path $txtOut) { return 'ok' } else { return 'fail' }
|
# succes = textul rescris acum SAU exe-ul raporteaza 0 erori (linia "O,P1,E0,S1,X0,<txt>").
|
||||||
|
# FoxBin2Prg NU actualizeaza mtime cand textul regenerat e identic cu cel existent (ex. binar
|
||||||
|
# reatins de Project > Build fara schimbari reale) -> sincronizam mtime-ul textului, altfel
|
||||||
|
# fisierul pare stale si se reconverteste la fiecare rulare.
|
||||||
|
$fresh = (Test-Path $txtOut) -and ((Get-Item $txtOut).LastWriteTime -ge $started)
|
||||||
|
if ($fresh -or ((Test-Path $txtOut) -and ($exeOut -match ',E0,'))) {
|
||||||
|
if ((Get-Item $txtOut).LastWriteTime -lt $f.LastWriteTime) { (Get-Item $txtOut).LastWriteTime = Get-Date }
|
||||||
|
return 'ok'
|
||||||
|
}
|
||||||
|
return 'fail'
|
||||||
}
|
}
|
||||||
|
|
||||||
# --- Construieste lista de fisiere ---
|
# --- Construieste lista de fisiere ---
|
||||||
|
|||||||
Reference in New Issue
Block a user