waypoit debuguing

This commit is contained in:
2026-09-25 16:50:16 -06:00
parent 7bd65e7d76
commit 1dbd1ad79b
+94 -64
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,74 +124,76 @@ 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 {
$art = @' $art = @'
=#= -- ##*+++++ *+ =#= -- ##*+++++ *+
-#=#- +# -*%%= ##++++++++++# ##*********# -#=#- +# -*%%= ##++++++++++# ##*********#
#==#= *** %%++%% -++# #++++++++++++*+ *#***************# #==#= *** %%++%% -++# #++++++++++++*+ *#***************#
#===#= %***+%++#*%%@+++++% #++++++++++++**+++#******++********# #===#= %***+%++#*%%@+++++% #++++++++++++**+++#******++********#
====+#%@*******###%=%++##++% #+++++++++++*++++++++#***====+****++# ====+#%@*******###%=%++##++% #+++++++++++*++++++++#***====+****++#
=#=*==**#*#########%++#*+++@ *++++++++#+++++++++++#****==+******# =#=*==**#*#########%++#*+++@ *++++++++#+++++++++++#****==+******#
*#=====%####***%%++++#*+++**% ++++++++*+++++++++++++#************#******* *#=====%####***%%++++#*+++**% ++++++++*+++++++++++++#************#*******
@****#==%####**#*+++++++#+++#**# #+++++++++++++++++++#####+*****************# @****#==%####**#*+++++++#+++#**# #+++++++++++++++++++#####+*****************#
@****#######%**@+*%**#%+++++%##*** #+++++++++++++++++#+++++++#****+======*****+ @****#######%**@+*%**#%+++++%##*** #+++++++++++++++++#+++++#****+======*****+
#****##%####@**%+*******@@+++@###**% #+++++++++++++*++++++++++****========****# #****##%####@**%+*******@@+++@###**% #+++++++++++++*++++++++++****========****#
****#####%%*%*%+***@@@%%@*+++@####** *+++++++++++++++++++++#****=======****# ****#####%%*%*%+***@@@%%@*+++@####** *+++++++++++++++++++++#****=======****#
%***####%%**+%%*++*@=##@@%@++++%###*** +++++*+++++++++++#+**************# %***####%%**+%%*++*@=##@@%@++++%###*** +++++*+++++++++++#+**************#
@%%%@@##%%#++++++++==**@@**+++%*###**% +++++++++++#*+++++#*********#### @%%%@@##%%#++++++++==**@@**+++%*###**% +++++++++++#*+++++#*********####
%###%++++++++====**#++++%**##**% @% ++++#+++++++++++++**************# %###%++++++++====**#++++%**##**% @% ++++#+++++++++++++**************#
%###%++++++++++++++++++%**%##**%@###@ %++++++++++++++++***=====******** %###%++++++++++++++++++%**%##**%@###@ %++++++++++++++++***=====********
###%%++++++++%++++++*%%%%###***##%##@ +++++++++++++##**************# ###%%++++++++%++++++*%%%%###***##%##@ +++++++++++++##**************#
###%%%%+++++##+++++++#*+%###***%%%##@ ++++++++++++++%********+############%@ ###%%%%+++++##+++++++#*+%###***%%%##@ ++++++++++++++%********+############%@
@%%*@*%%%%###****+*%%****++%##***%##@@@ #+++++++++++++++*********###*****#########* @%%*@*%%%%###****+*%%****++%##***%##@@@ #+++++++++++++++*********###*****#########*
#%%###***#####%**++++##**%#@@#@ ##+++++++++*###%#+***+***##*************####### #%%###***#####%**++++##**%#@@#@ ##+++++++++*###%#+***+***##*************#######
@#%%####%%####%+++++++##*######%++++++++++++++#*+++++#%###%#######*********######% @#%%####%%####%+++++++##*######%++++++++++++++#*+++++#%###%#######*********######%
##%########@%@+++@###%*%#####@+++++++++++%**++++++++++%%%%%%########***==**###%##% ##%########@%@+++@###%*%#####@+++++++++++%**++++++++++%%%%%%########***==**###%##%
%#%###%###########@@%#%#@@##++++++++****++++********+++ %########**===*###%*# %#%###%###########@@%#%#@@##++++++++****++++********+++ %########**===*###%*#
#**##%####@@####%@######%*++++++++++++++++#++**+*#++++# ########******###% % #**##%####@@####%@######%*++++++++++++++++#++**+*#++++# ########******###% %
@#***# ###%@@##%#######@+++++++++++++++++++++%*++**++++# *########******##% @ @#***# ###%@@##%#######@+++++++++++++++++++++%*++**++++# *########******##% @
%*******% %##% =@#########++++++++++++++++++#++++*%++*#%#++# ########******##% *******% %##% =@#########++++++++++++++++++#++++*%++*#%#++# ########******##%
#@%@# %% *@#@@###*+++++++++++++++++++%+++##+++###++* ##*#####******##@ #@%@# %% *@#@@###*+++++++++++++++++++%+++##+++###++* ##*#####******##@
**##%*++%++++++++++++++++++++++++++++++++% +#**#####******### **##%*++%++++++++++++++++++++++++++++++++% +#**#####******###
##%#######*@***+#+++++++++++++++#***#++++++++++++ %**#####*******#% ##%#######*@***+#+++++++++++++++#***#++++++++++++ %**#####*******#%
*+++++++****##****++++++++##% #******#+++++++++++ %**#####*******#@ *+++++$****##****++++++++##% #******#+++++++++++ %**#####*******#@
#++++++++*******- ++++++++# *******#++++++++++# @**#####*******# #++++++++*******- ++++++++# *******#++++++++++# @**#####*******#
#@@+++++++******- *+++++++# #******#+++++++++* **####%**==+**@ #@@+++++++******- *+++++++# #******#+++++++++* **####%**==+**@
@@@@@+++ %+++++++# ******# %+++++++ %*###%***===**@ %= @@@@@+++ %+++++++# ******# %+++++++ %*###%***===**@ %=
@@@@@@@@@ #+++++++# =****** #++++++% *###%#***=+**% %** @@@@@@@@@ #+++++++# =****** #++++++% *###%#***=+**% %**
@@@@@@@@@@ ++++++++# ******# #++++++# *##@%********% @*@ @@@@@@@@@@ ++++++++# ******# #++++++# *##@%********% @*@
@@+@@@++@@+ ++++++++# #******# #++++++# @## #*********@ #***# @@+@@@++@@+ ++++++++# ******# #++++++# @## #*********@ #***#
@@+@@++@@@++ @@@++++++* @@@%**** #@@++++% +## %#****************% @@+@@++@@@++ @@@++++++* @@@%**** #@@++++% +## %#****************%
@*@**@+++# @@@@+++++ @@@@@@**# @@@@+++# @# %#**************** @*@**@+++# @@@@+++++ @@@@@@**# @@@@++++# @# %#****************
+#+++++# @@@@@@+++% @@@@@@@@# @@@@@@@++ @ %##************% +#+++++# @@@@@@+++% @@@@@@@@# @@@@@@@++ @ %##************%
#+++** @@@@@@@@@@ @@@@@@@@@ @@@@@@@@@ %###********%* #+++** @@@@@@@@@@ @@@@@@@@@ @@@@@@@@@ %###********%*
@@@@@@@@@@+ @@@@@@@@@@ =@@@@@@@@@ %%#####%% @@@@@@@@@@+ @@@@@@@@@@ =@@@@@@@@@ %%#####%%
*@@@@@@@@@@ @+*@@@@@@@= @@++@@@@@@ *@@@@@@@@@@ @+*@@@@@@@= @@++@@@@@@
@++@@@@@@@@ #**@**@@@@@ *@@*#@@@@@@ -= @++@@@@@@@@ #**@**@@@@@ *@@*#@@@@@@ -=
@%#@@@@@@@@ *#***@@@@@@ @+#+@++#@@@ @%#@@@@@@@@ *#***@@@@@@ @+#+@++#@@@
#+++@++@@@@@ **********# #+++++@+@@@@ #+++@++@@@@@ **********# #+++++@+@@@@
##+#+++@@@@@@ ##****#### *+#+##+++@@%% ##+#+++@@@@@@ ##****#### *+#+##+++@@%%
#+++++++++++# #++++++++++# #+++++++++++# #++++++++++#
#########* #########*
____ ____ ____ _ _ ___ ____ ___ ___ ____ ____ ____ ____ ____ _ _ ___ ____ ___ ___ ____ ____
( _ \( _ \(_ _)( \( )/ __)( ___)/ __)/ __) ( _ \(_ _)/\/ ( _ \( _ \(_ _)( \( )/ __)( ___)/ __)/ __) ( _ \(_ _)/\/
)___/ ) / _)(_ ) (( (__ )__) \__ \\__ \ )___/ _)(_ )___/ ) / _)(_ ) (( (__ )__) \__ \\__ \ )___/ _)(_
(__) (_)\_)(____)(_)\_)\___)(____)(___/(___/ (__) (____) (__) (_)\_)(____)(_)\_)\___)(____)(___/(___/ (__) (____)
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++;
Write-Progress -Activity "Matching Checksums ($Algorithm)" -Status "Processing file $($currentIndex.Value) of $totalFiles" -PercentComplete (($currentIndex.Value / $totalFiles) * 100); if ($showProgressMatch -and $totalFiles -gt 0) {
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,9 +355,11 @@ process {
} else { } else {
Write-Host "$($res.TargetFile): " -NoNewline; Write-Host "$($res.TargetFile): " -NoNewline;
Write-Host "FAILED" -ForegroundColor Red; Write-Host "FAILED" -ForegroundColor Red;
}; }
}; };
Write-Progress -Activity "Matching Checksums ($Algorithm)" -Completed; if ($showProgressMatch) {
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') {
@@ -454,7 +463,9 @@ process {
foreach ($res in $verifyResults) { foreach ($res in $verifyResults) {
$currentIndex.Value++; $currentIndex.Value++;
Write-Progress -Activity "Verifying Checksums ($fileAlgo)" -Status "Processing file $($currentIndex.Value) of $totalFiles" -PercentComplete (($currentIndex.Value / $totalFiles) * 100); if ($totalFiles -gt 0) {
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++;
Write-Progress -Activity "Computing Checksums ($Algorithm)" -Status "Directory: $(Split-Path $dirPath -Leaf) [$currentIndex/$totalFiles]" -PercentComplete (($currentIndex / $totalFiles) * 100); if ($showProgressGen -and $totalFiles -gt 0) {
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;
} }
Write-Progress -Activity "Computing Checksums ($Algorithm)" -Completed; if ($showProgressGen) {
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++;
Write-Progress -Activity "Computing Checksums ($Algorithm)" -Status "Processing file $currentIndex of $totalFiles" -PercentComplete (($currentIndex / $totalFiles) * 100); if ($showProgressGen -and $totalFiles -gt 0) {
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;
} }
Write-Progress -Activity "Computing Checksums ($Algorithm)" -Completed; if ($showProgressGen) {
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++;
Write-Progress -Activity "Computing Checksums ($Algorithm)" -Status "Processing file $currentIndex of $totalFiles" -PercentComplete (($currentIndex / $totalFiles) * 100); if ($showProgressGen -and $totalFiles -gt 0) {
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;
} }
Write-Progress -Activity "Computing Checksums ($Algorithm)" -Completed; if ($showProgressGen) {
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++;
Write-Progress -Activity "Computing Checksums ($Algorithm)" -Status "Processing file $currentIndex of $totalFiles" -PercentComplete (($currentIndex / $totalFiles) * 100); if ($showProgressGen -and $totalFiles -gt 0) {
Write-Progress -Activity "Computing Checksums ($Algorithm)" -Status "Processing file $currentIndex of $totalFiles" -PercentComplete (($currentIndex / $totalFiles) * 100);
}
Write-Output $res.OutputLine; Write-Output $res.OutputLine;
} }
Write-Progress -Activity "Computing Checksums ($Algorithm)" -Completed; if ($showProgressGen) {
Write-Progress -Activity "Computing Checksums ($Algorithm)" -Completed;
}
}; };
} }
} }