waypoit debuguing

This commit is contained in:
2026-09-25 16:50:16 -06:00
parent 7bd65e7d76
commit 1dbd1ad79b
+38 -8
View File
@@ -52,6 +52,7 @@ param(
begin { begin {
function Show-Help { function Show-Help {
@' @'
Princess Pi's Magical CHECKSUM! Princess Pi's Magical CHECKSUM!
NAME NAME
@@ -123,14 +124,15 @@ EXAMPLES
Princess Pi LOVES YOU!~ Princess Pi LOVES YOU!~
https://linktr.ee/princesspi3 https://linktr.ee/princesspi3
'@ '@
}; };
function Write-ErrorWithHelp { function Write-ErrorWithHelp {
param([string]$ErrorMessage); param([string]$ErrorMessage);
Write-Error $ErrorMessage;
Write-Host "";
Show-Help; Show-Help;
Write-Host "";
Write-Error $ErrorMessage;
}; };
function Show-PrincessPiArt { function Show-PrincessPiArt {
@@ -144,7 +146,7 @@ https://linktr.ee/princesspi3
=#=*==**#*#########%++#*+++@ *++++++++#+++++++++++#****==+******# =#=*==**#*#########%++#*+++@ *++++++++#+++++++++++#****==+******#
*#=====%####***%%++++#*+++**% ++++++++*+++++++++++++#************#******* *#=====%####***%%++++#*+++**% ++++++++*+++++++++++++#************#*******
@****#==%####**#*+++++++#+++#**# #+++++++++++++++++++#####+*****************# @****#==%####**#*+++++++#+++#**# #+++++++++++++++++++#####+*****************#
@****#######%**@+*%**#%+++++%##*** #+++++++++++++++++#+++++++#****+======*****+ @****#######%**@+*%**#%+++++%##*** #+++++++++++++++++#+++++#****+======*****+
#****##%####@**%+*******@@+++@###**% #+++++++++++++*++++++++++****========****# #****##%####@**%+*******@@+++@###**% #+++++++++++++*++++++++++****========****#
****#####%%*%*%+***@@@%%@*+++@####** *+++++++++++++++++++++#****=======****# ****#####%%*%*%+***@@@%%@*+++@####** *+++++++++++++++++++++#****=======****#
%***####%%**+%%*++*@=##@@%@++++%###*** +++++*+++++++++++#+**************# %***####%%**+%%*++*@=##@@%@++++%###*** +++++*+++++++++++#+**************#
@@ -160,19 +162,19 @@ https://linktr.ee/princesspi3
%#%###%###########@@%#%#@@##++++++++****++++********+++ %########**===*###%*# %#%###%###########@@%#%#@@##++++++++****++++********+++ %########**===*###%*#
#**##%####@@####%@######%*++++++++++++++++#++**+*#++++# ########******###% % #**##%####@@####%@######%*++++++++++++++++#++**+*#++++# ########******###% %
@#***# ###%@@##%#######@+++++++++++++++++++++%*++**++++# *########******##% @ @#***# ###%@@##%#######@+++++++++++++++++++++%*++**++++# *########******##% @
%*******% %##% =@#########++++++++++++++++++#++++*%++*#%#++# ########******##% *******% %##% =@#########++++++++++++++++++#++++*%++*#%#++# ########******##%
#@%@# %% *@#@@###*+++++++++++++++++++%+++##+++###++* ##*#####******##@ #@%@# %% *@#@@###*+++++++++++++++++++%+++##+++###++* ##*#####******##@
**##%*++%++++++++++++++++++++++++++++++++% +#**#####******### **##%*++%++++++++++++++++++++++++++++++++% +#**#####******###
##%#######*@***+#+++++++++++++++#***#++++++++++++ %**#####*******#% ##%#######*@***+#+++++++++++++++#***#++++++++++++ %**#####*******#%
*+++++++****##****++++++++##% #******#+++++++++++ %**#####*******#@ *+++++$****##****++++++++##% #******#+++++++++++ %**#####*******#@
#++++++++*******- ++++++++# *******#++++++++++# @**#####*******# #++++++++*******- ++++++++# *******#++++++++++# @**#####*******#
#@@+++++++******- *+++++++# #******#+++++++++* **####%**==+**@ #@@+++++++******- *+++++++# #******#+++++++++* **####%**==+**@
@@@@@+++ %+++++++# ******# %+++++++ %*###%***===**@ %= @@@@@+++ %+++++++# ******# %+++++++ %*###%***===**@ %=
@@@@@@@@@ #+++++++# =****** #++++++% *###%#***=+**% %** @@@@@@@@@ #+++++++# =****** #++++++% *###%#***=+**% %**
@@@@@@@@@@ ++++++++# ******# #++++++# *##@%********% @*@ @@@@@@@@@@ ++++++++# ******# #++++++# *##@%********% @*@
@@+@@@++@@+ ++++++++# #******# #++++++# @## #*********@ #***# @@+@@@++@@+ ++++++++# ******# #++++++# @## #*********@ #***#
@@+@@++@@@++ @@@++++++* @@@%**** #@@++++% +## %#****************% @@+@@++@@@++ @@@++++++* @@@%**** #@@++++% +## %#****************%
@*@**@+++# @@@@+++++ @@@@@@**# @@@@+++# @# %#**************** @*@**@+++# @@@@+++++ @@@@@@**# @@@@++++# @# %#****************
+#+++++# @@@@@@+++% @@@@@@@@# @@@@@@@++ @ %##************% +#+++++# @@@@@@+++% @@@@@@@@# @@@@@@@++ @ %##************%
#+++** @@@@@@@@@@ @@@@@@@@@ @@@@@@@@@ %###********%* #+++** @@@@@@@@@@ @@@@@@@@@ @@@@@@@@@ %###********%*
@@@@@@@@@@+ @@@@@@@@@@ =@@@@@@@@@ %%#####%% @@@@@@@@@@+ @@@@@@@@@@ =@@@@@@@@@ %%#####%%
@@ -191,6 +193,7 @@ https://linktr.ee/princesspi3
Princess Pi Princess Pi
https://linktr.ee/princesspi3 https://linktr.ee/princesspi3
'@ '@
Write-Host $art -ForegroundColor Blue; Write-Host $art -ForegroundColor Blue;
}; };
@@ -338,9 +341,13 @@ process {
} }
} -ThrottleLimit 16; } -ThrottleLimit 16;
$showProgressMatch = $Recursive.IsPresent -or $isWildcardGlobal;
foreach ($res in $results) { foreach ($res in $results) {
$currentIndex.Value++; $currentIndex.Value++;
if ($showProgressMatch -and $totalFiles -gt 0) {
Write-Progress -Activity "Matching Checksums ($Algorithm)" -Status "Processing file $($currentIndex.Value) of $totalFiles" -PercentComplete (($currentIndex.Value / $totalFiles) * 100); Write-Progress -Activity "Matching Checksums ($Algorithm)" -Status "Processing file $($currentIndex.Value) of $totalFiles" -PercentComplete (($currentIndex.Value / $totalFiles) * 100);
}
if ($res.IsMatch) { if ($res.IsMatch) {
Write-Host "$($res.TargetFile): " -NoNewline; Write-Host "$($res.TargetFile): " -NoNewline;
@@ -348,10 +355,12 @@ process {
} else { } else {
Write-Host "$($res.TargetFile): " -NoNewline; Write-Host "$($res.TargetFile): " -NoNewline;
Write-Host "FAILED" -ForegroundColor Red; Write-Host "FAILED" -ForegroundColor Red;
}
}; };
}; if ($showProgressMatch) {
Write-Progress -Activity "Matching Checksums ($Algorithm)" -Completed; Write-Progress -Activity "Matching Checksums ($Algorithm)" -Completed;
} }
}
# --- VERIFICATION MODE (-c / -Check) --- # --- VERIFICATION MODE (-c / -Check) ---
elseif ($PSCmdlet.ParameterSetName -eq 'Verify') { elseif ($PSCmdlet.ParameterSetName -eq 'Verify') {
$checkFiles = @(); $checkFiles = @();
@@ -454,7 +463,9 @@ process {
foreach ($res in $verifyResults) { foreach ($res in $verifyResults) {
$currentIndex.Value++; $currentIndex.Value++;
if ($totalFiles -gt 0) {
Write-Progress -Activity "Verifying Checksums ($fileAlgo)" -Status "Processing file $($currentIndex.Value) of $totalFiles" -PercentComplete (($currentIndex.Value / $totalFiles) * 100); Write-Progress -Activity "Verifying Checksums ($fileAlgo)" -Status "Processing file $($currentIndex.Value) of $totalFiles" -PercentComplete (($currentIndex.Value / $totalFiles) * 100);
}
Write-Host "$($res.DisplayPath): " -NoNewline; Write-Host "$($res.DisplayPath): " -NoNewline;
if ($res.IsError) { if ($res.IsError) {
@@ -477,6 +488,9 @@ process {
$wantCustomOut = $PSBoundParameters.ContainsKey('OutFile'); $wantCustomOut = $PSBoundParameters.ContainsKey('OutFile');
$wantAutoOut = $Save.IsPresent; $wantAutoOut = $Save.IsPresent;
# Show progress if wildcard used anywhere in inputs or recursive flag set
$showProgressGen = $Recursive.IsPresent -or $isWildcardGlobal;
if ($wantCustomOut -or $wantAutoOut) { if ($wantCustomOut -or $wantAutoOut) {
# Recursive wildcard auto-saves per directory # Recursive wildcard auto-saves per directory
if ($Recursive -and $isWildcardGlobal) { if ($Recursive -and $isWildcardGlobal) {
@@ -499,12 +513,16 @@ process {
$parallelResults = Invoke-ParallelHashing -Items $filesInDir -Algorithm $Algorithm; $parallelResults = Invoke-ParallelHashing -Items $filesInDir -Algorithm $Algorithm;
foreach ($res in $parallelResults) { foreach ($res in $parallelResults) {
$currentIndex++; $currentIndex++;
if ($showProgressGen -and $totalFiles -gt 0) {
Write-Progress -Activity "Computing Checksums ($Algorithm)" -Status "Directory: $(Split-Path $dirPath -Leaf) [$currentIndex/$totalFiles]" -PercentComplete (($currentIndex / $totalFiles) * 100); Write-Progress -Activity "Computing Checksums ($Algorithm)" -Status "Directory: $(Split-Path $dirPath -Leaf) [$currentIndex/$totalFiles]" -PercentComplete (($currentIndex / $totalFiles) * 100);
}
$linesToWrite += $res.OutputLine; $linesToWrite += $res.OutputLine;
Write-Output $res.OutputLine; Write-Output $res.OutputLine;
} }
if ($showProgressGen) {
Write-Progress -Activity "Computing Checksums ($Algorithm)" -Completed; Write-Progress -Activity "Computing Checksums ($Algorithm)" -Completed;
}
Set-Content -Path ($currentOutFile) -Value $linesToWrite -Encoding utf8; Set-Content -Path ($currentOutFile) -Value $linesToWrite -Encoding utf8;
}; };
@@ -525,12 +543,16 @@ process {
$parallelResults = Invoke-ParallelHashing -Items $allItems -Algorithm $Algorithm; $parallelResults = Invoke-ParallelHashing -Items $allItems -Algorithm $Algorithm;
foreach ($res in $parallelResults) { foreach ($res in $parallelResults) {
$currentIndex++; $currentIndex++;
if ($showProgressGen -and $totalFiles -gt 0) {
Write-Progress -Activity "Computing Checksums ($Algorithm)" -Status "Processing file $currentIndex of $totalFiles" -PercentComplete (($currentIndex / $totalFiles) * 100); Write-Progress -Activity "Computing Checksums ($Algorithm)" -Status "Processing file $currentIndex of $totalFiles" -PercentComplete (($currentIndex / $totalFiles) * 100);
}
$linesToWrite += $res.OutputLine; $linesToWrite += $res.OutputLine;
Write-Output $res.OutputLine; Write-Output $res.OutputLine;
} }
if ($showProgressGen) {
Write-Progress -Activity "Computing Checksums ($Algorithm)" -Completed; Write-Progress -Activity "Computing Checksums ($Algorithm)" -Completed;
}
Set-Content -Path ($singleOutFile) -Value $linesToWrite -Encoding utf8; Set-Content -Path ($singleOutFile) -Value $linesToWrite -Encoding utf8;
} }
@@ -542,12 +564,16 @@ process {
$parallelResults = Invoke-ParallelHashing -Items $allItems -Algorithm $Algorithm; $parallelResults = Invoke-ParallelHashing -Items $allItems -Algorithm $Algorithm;
foreach ($res in $parallelResults) { foreach ($res in $parallelResults) {
$currentIndex++; $currentIndex++;
if ($showProgressGen -and $totalFiles -gt 0) {
Write-Progress -Activity "Computing Checksums ($Algorithm)" -Status "Processing file $currentIndex of $totalFiles" -PercentComplete (($currentIndex / $totalFiles) * 100); Write-Progress -Activity "Computing Checksums ($Algorithm)" -Status "Processing file $currentIndex of $totalFiles" -PercentComplete (($currentIndex / $totalFiles) * 100);
}
Write-Output $res.OutputLine; Write-Output $res.OutputLine;
Set-Content -Path ($res.ItemOutFile) -Value $res.OutputLine -Encoding utf8; Set-Content -Path ($res.ItemOutFile) -Value $res.OutputLine -Encoding utf8;
} }
if ($showProgressGen) {
Write-Progress -Activity "Computing Checksums ($Algorithm)" -Completed; Write-Progress -Activity "Computing Checksums ($Algorithm)" -Completed;
}
}; };
}; };
} }
@@ -559,11 +585,15 @@ process {
$parallelResults = Invoke-ParallelHashing -Items $allItems -Algorithm $Algorithm; $parallelResults = Invoke-ParallelHashing -Items $allItems -Algorithm $Algorithm;
foreach ($res in $parallelResults) { foreach ($res in $parallelResults) {
$currentIndex++; $currentIndex++;
if ($showProgressGen -and $totalFiles -gt 0) {
Write-Progress -Activity "Computing Checksums ($Algorithm)" -Status "Processing file $currentIndex of $totalFiles" -PercentComplete (($currentIndex / $totalFiles) * 100); Write-Progress -Activity "Computing Checksums ($Algorithm)" -Status "Processing file $currentIndex of $totalFiles" -PercentComplete (($currentIndex / $totalFiles) * 100);
}
Write-Output $res.OutputLine; Write-Output $res.OutputLine;
} }
if ($showProgressGen) {
Write-Progress -Activity "Computing Checksums ($Algorithm)" -Completed; Write-Progress -Activity "Computing Checksums ($Algorithm)" -Completed;
}
}; };
} }
} }