-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Refactor core UI rendering, search matching, and service maintenance loops #4906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
b96923d
89ee697
8ebe1bb
3e0fa36
413ba25
48fc917
9b60223
9c1863c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,8 +59,15 @@ function Invoke-WinUtilISOMountAndVerify { | |
| try { | ||
| Mount-DiskImage -ImagePath $isoPath | ||
|
|
||
| # Add 30s timeout to prevent infinite hang on mount failure | ||
| $mountTimeout = 30; $mountElapsed = 0 | ||
| do { | ||
| Start-Sleep -Milliseconds 500 | ||
| $mountElapsed += 0.5 | ||
| if ($mountElapsed -ge $mountTimeout) { | ||
| Dismount-DiskImage -ImagePath $isoPath -ErrorAction SilentlyContinue | ||
| throw "ISO mount timed out after $($mountTimeout)s - drive letter never appeared." | ||
| } | ||
| } until ((Get-DiskImage -ImagePath $isoPath | Get-Volume).DriveLetter) | ||
|
|
||
| $driveLetter = (Get-DiskImage -ImagePath $isoPath | Get-Volume).DriveLetter + ":" | ||
|
|
@@ -216,7 +223,10 @@ function Invoke-WinUtilISOModify { | |
| $sync["WPFWin11ISOStatusLog"].CaretIndex = $sync["WPFWin11ISOStatusLog"].Text.Length | ||
| $sync["WPFWin11ISOStatusLog"].ScrollToEnd() | ||
| }) | ||
| Add-Content -Path (Join-Path $workDir "WinUtil_Win11ISO.log") -Value "[$ts] $msg" | ||
| # Write to host only; transcript captures it without file-locking conflicts | ||
| Write-Host "[$ts] $msg" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. During Win11 ISO modification and cleanup, this replaces the per-workdir Useful? React with 👍 / 👎. |
||
| # Log beside the working directory so it exists from the first line and survives cleanup | ||
| Add-Content -Path "$workDir.log" -Value "[$ts] $msg" -ErrorAction SilentlyContinue | ||
| } | ||
|
|
||
| function SetProgress($label, $pct) { | ||
|
|
@@ -409,7 +419,8 @@ function Invoke-WinUtilISOCleanAndReset { | |
| $sync["WPFWin11ISOStatusLog"].CaretIndex = $sync["WPFWin11ISOStatusLog"].Text.Length | ||
| $sync["WPFWin11ISOStatusLog"].ScrollToEnd() | ||
| }) | ||
| Add-Content -Path (Join-Path $workDir "WinUtil_Win11ISO.log") -Value "[$ts] $msg" | ||
| # Write to host; transcript captures it without file-locking conflicts | ||
| Write-Host "[$ts] $msg" | ||
| } | ||
|
|
||
| function SetProgress($label, $pct) { | ||
|
|
@@ -446,37 +457,21 @@ function Invoke-WinUtilISOCleanAndReset { | |
| } | ||
| } | ||
|
|
||
| # Batch delete instead of file-by-file with per-100 progress | ||
| if ($workDir -and (Test-Path $workDir)) { | ||
| Log "Scanning files to delete in: $workDir" | ||
| SetProgress "Scanning files..." 5 | ||
|
|
||
| $allFiles = @(Get-ChildItem -Path $workDir -File -Recurse -Force) | ||
| $allDirs = @(Get-ChildItem -Path $workDir -Directory -Recurse -Force | | ||
| Sort-Object { $_.FullName.Length } -Descending) | ||
| $total = $allFiles.Count | ||
| $deleted = 0 | ||
|
|
||
| Log "Found $total files to delete." | ||
|
|
||
| foreach ($f in $allFiles) { | ||
| try { Remove-Item -Path $f.FullName -Force } catch { Log "WARNING: could not delete $($f.FullName): $_" } | ||
| $deleted++ | ||
| if ($deleted % 100 -eq 0 -or $deleted -eq $total) { | ||
| $pct = [math]::Round(($deleted / [Math]::Max($total, 1)) * 85) + 5 | ||
| SetProgress "Deleting files in $($f.Directory.Name)... ($deleted / $total)" $pct | ||
| } | ||
| } | ||
|
|
||
| foreach ($d in $allDirs) { | ||
| try { Remove-Item -Path $d.FullName -Force } catch { Log "WARNING: could not delete $($d.FullName): $_" } | ||
| } | ||
|
|
||
| try { Remove-Item -Path $workDir -Recurse -Force } catch { Log "WARNING: could not delete temp directory ${workDir}: $_" } | ||
|
|
||
| if (Test-Path $workDir) { | ||
| Log "WARNING: some items could not be deleted in $workDir" | ||
| } else { | ||
| Log "Deleting working directory: $workDir" | ||
| SetProgress "Cleaning up..." 10 | ||
| try { | ||
| Remove-Item -Path $workDir -Recurse -Force -ErrorAction Stop | ||
| Log "Temp directory deleted successfully." | ||
| } catch { | ||
| Log "WARNING: batch delete failed, retrying file-by-file: $_" | ||
| Get-ChildItem -Path $workDir -File -Recurse -Force | ForEach-Object { | ||
| Remove-Item -Path $_.FullName -Force -ErrorAction SilentlyContinue | ||
| } | ||
| Remove-Item -Path $workDir -Recurse -Force -ErrorAction SilentlyContinue | ||
| if (Test-Path $workDir) { Log "WARNING: some items could not be deleted in $workDir" } | ||
| else { Log "Temp directory deleted on retry." } | ||
| } | ||
| } else { | ||
| Log "No temp directory found - resetting UI." | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Windows editions/builds where a configured tweak service is absent (for example optional services such as
CscServiceorMapsBroker), applying the tweak already only logs a warning and continues viaSet-WinUtilService, but this detection path now marks the whole tweak as not applied wheneverGet-Servicereturns nothing. That makes “Get Installed” leave a successfully applied tweak unchecked forever on those systems; keep missing services neutral as before, or align apply/detect semantics so absent services do not block detection.Useful? React with 👍 / 👎.