From c8a448d46561f98f2dd5749523fd67de5f0ba80a Mon Sep 17 00:00:00 2001 From: "Mr.k" Date: Sun, 23 Jun 2024 09:01:57 +0300 Subject: [PATCH] Remove All Trailing Whitespace Characters in '.ps1' Files --- functions/private/ConvertTo-Icon.ps1 | 36 +++++------ functions/private/Copy-Files.ps1 | 18 +++--- functions/private/Get-LocalizedYesNo.ps1 | 32 +++++----- functions/private/Get-Oscdimg.ps1 | 8 +-- functions/private/Get-TabXaml.ps1 | 6 +- functions/private/Get-WPFObjectName.ps1 | 8 +-- functions/private/Get-WinUtilToggleStatus.ps1 | 8 +-- functions/private/Get-WinUtilWingetLatest.ps1 | 4 +- .../private/Install-WinUtilProgramChoco.ps1 | 10 +-- .../private/Install-WinUtilProgramWinget.ps1 | 16 ++--- functions/private/Install-WinUtilWinget.ps1 | 2 +- functions/private/Invoke-MicroWin-Helper.ps1 | 64 +++++++++---------- functions/private/Invoke-WinUtilGPU.ps1 | 8 +-- .../Invoke-WinUtilMouseAcceleration.ps1 | 6 +- .../private/Invoke-WinUtilStickyKeys.ps1 | 2 +- functions/private/Invoke-WinUtilTweaks.ps1 | 2 +- functions/private/Show-CustomDialog.ps1 | 16 ++--- .../private/Test-WinUtilPackageManager.ps1 | 2 +- functions/public/Invoke-ScratchDialog.ps1 | 8 +-- functions/public/Invoke-WPFFixesWinget.ps1 | 2 +- functions/public/Invoke-WPFGetIso.ps1 | 22 +++---- functions/public/Invoke-WPFImpex.ps1 | 4 +- functions/public/Invoke-WPFMicrowin.ps1 | 32 +++++----- functions/public/Invoke-WPFOOSU.ps1 | 2 +- functions/public/Invoke-WPFPresets.ps1 | 2 +- functions/public/Invoke-WPFTweakPS7.ps1 | 4 +- functions/public/Invoke-WPFtweaksbutton.ps1 | 2 +- scripts/main.ps1 | 4 +- 28 files changed, 165 insertions(+), 165 deletions(-) diff --git a/functions/private/ConvertTo-Icon.ps1 b/functions/private/ConvertTo-Icon.ps1 index 7a4d3e76..5ed7f5e7 100644 --- a/functions/private/ConvertTo-Icon.ps1 +++ b/functions/private/ConvertTo-Icon.ps1 @@ -1,27 +1,27 @@ -function ConvertTo-Icon { +function ConvertTo-Icon { <# - + .DESCRIPTION This function will convert PNG to ICO file .EXAMPLE ConvertTo-Icon -bitmapPath "$env:TEMP\cttlogo.png" -iconPath $iconPath #> - param( [Parameter(Mandatory=$true)] - $bitmapPath, + param( [Parameter(Mandatory=$true)] + $bitmapPath, $iconPath = "$env:temp\newicon.ico" - ) - - Add-Type -AssemblyName System.Drawing - - if (Test-Path $bitmapPath) { - $b = [System.Drawing.Bitmap]::FromFile($bitmapPath) - $icon = [System.Drawing.Icon]::FromHandle($b.GetHicon()) - $file = New-Object System.IO.FileStream($iconPath, 'OpenOrCreate') - $icon.Save($file) - $file.Close() - $icon.Dispose() - #explorer "/SELECT,$iconpath" - } - else { Write-Warning "$BitmapPath does not exist" } + ) + + Add-Type -AssemblyName System.Drawing + + if (Test-Path $bitmapPath) { + $b = [System.Drawing.Bitmap]::FromFile($bitmapPath) + $icon = [System.Drawing.Icon]::FromHandle($b.GetHicon()) + $file = New-Object System.IO.FileStream($iconPath, 'OpenOrCreate') + $icon.Save($file) + $file.Close() + $icon.Dispose() + #explorer "/SELECT,$iconpath" + } + else { Write-Warning "$BitmapPath does not exist" } } \ No newline at end of file diff --git a/functions/private/Copy-Files.ps1 b/functions/private/Copy-Files.ps1 index 4c054c81..447df38c 100644 --- a/functions/private/Copy-Files.ps1 +++ b/functions/private/Copy-Files.ps1 @@ -1,22 +1,22 @@ function Copy-Files { <# - + .DESCRIPTION This function will make all modifications to the registry .EXAMPLE Set-WinUtilRegistry -Name "PublishUserActivities" -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Type "DWord" -Value "0" - - #> + + #> param ( - [string] $Path, - [string] $Destination, - [switch] $Recurse = $false, + [string] $Path, + [string] $Destination, + [switch] $Recurse = $false, [switch] $Force = $false ) - try { + try { $files = Get-ChildItem -Path $path -Recurse:$recurse Write-Host "Copy $($files.Count)(s) from $path to $destination" @@ -35,9 +35,9 @@ function Copy-Files { else { Write-Debug "Copy from $($file.FullName) to $($destination+$restpath)" - Copy-Item $file.FullName ($destination+$restpath) -ErrorAction SilentlyContinue -Force:$force + Copy-Item $file.FullName ($destination+$restpath) -ErrorAction SilentlyContinue -Force:$force Set-ItemProperty -Path ($destination+$restpath) -Name IsReadOnly -Value $false - } + } } Write-Progress -Activity "Copy Windows files" -Status "Ready" -Completed } diff --git a/functions/private/Get-LocalizedYesNo.ps1 b/functions/private/Get-LocalizedYesNo.ps1 index db7c046e..72d46d31 100644 --- a/functions/private/Get-LocalizedYesNo.ps1 +++ b/functions/private/Get-LocalizedYesNo.ps1 @@ -1,17 +1,17 @@ function Get-LocalizedYesNo { <# .SYNOPSIS - This function runs choice.exe and captures its output to extract yes no in a localized Windows - + This function runs choice.exe and captures its output to extract yes no in a localized Windows + .DESCRIPTION The function retrieves the output of the command 'cmd /c "choice nul"' and converts the default output for Yes and No in the localized format, such as "Yes=, No=". - + .EXAMPLE $yesNoArray = Get-LocalizedYesNo Write-Host "Yes=$($yesNoArray[0]), No=$($yesNoArray[1])" #> - + # Run choice and capture its options as output # The output shows the options for Yes and No as "[Y,N]?" in the (partitially) localized format. # eg. English: [Y,N]? @@ -21,7 +21,7 @@ function Get-LocalizedYesNo { # Spanish: [S,N]? # Italian: [S,N]? # Russian: [Y,N]? - + $line = cmd /c "choice nul" $charactersArray = @() $regexPattern = '([a-zA-Z])' @@ -31,51 +31,51 @@ function Get-LocalizedYesNo { # Return the array of characters return $charactersArray } - + function Get-LocalizedYesNoTakeown { <# .SYNOPSIS - This function runs takeown.exe and captures its output to extract yes no in a localized Windows - + This function runs takeown.exe and captures its output to extract yes no in a localized Windows + .DESCRIPTION The function retrieves lines from the output of takeown.exe until there are at least 2 characters captured in a specific format, such as "Yes=, No=". - + .EXAMPLE $yesNoArray = Get-LocalizedYesNo Write-Host "Yes=$($yesNoArray[0]), No=$($yesNoArray[1])" #> - + # Run takeown.exe and capture its output $takeownOutput = & takeown.exe /? | Out-String # Parse the output and retrieve lines until there are at least 2 characters in the array $found = $false $charactersArray = @() - foreach ($line in $takeownOutput -split "`r`n") + foreach ($line in $takeownOutput -split "`r`n") { # skip everything before /D flag help - if ($found) + if ($found) { # now that /D is found start looking for a single character in double quotes # in help text there is another string in double quotes but it is not a single character $regexPattern = '"([a-zA-Z])"' $charactersArray = [regex]::Matches($line, $regexPattern) | ForEach-Object { $_.Groups[1].Value } - + # if ($charactersArray.Count -gt 0) { # Write-Output "Extracted symbols: $($matches -join ', ')" # } else { # Write-Output "No matches found." # } - if ($charactersArray.Count -ge 2) + if ($charactersArray.Count -ge 2) { break - } + } } - elseif ($line -match "/D ") + elseif ($line -match "/D ") { $found = $true } diff --git a/functions/private/Get-Oscdimg.ps1 b/functions/private/Get-Oscdimg.ps1 index 47a2eadd..38ea3b2c 100644 --- a/functions/private/Get-Oscdimg.ps1 +++ b/functions/private/Get-Oscdimg.ps1 @@ -1,13 +1,13 @@ -function Get-Oscdimg { +function Get-Oscdimg { <# - + .DESCRIPTION This function will download oscdimg file from github Release folders and put it into env:temp folder .EXAMPLE Get-Oscdimg #> - param( [Parameter(Mandatory=$true)] + param( [Parameter(Mandatory=$true)] [string]$oscdimgPath ) $oscdimgPath = "$env:TEMP\oscdimg.exe" @@ -24,4 +24,4 @@ function Get-Oscdimg { } else { Write-Host "Hashes do not match. File may be corrupted or tampered with." } -} +} diff --git a/functions/private/Get-TabXaml.ps1 b/functions/private/Get-TabXaml.ps1 index 9caf2e9b..e60bd02d 100644 --- a/functions/private/Get-TabXaml.ps1 +++ b/functions/private/Get-TabXaml.ps1 @@ -13,8 +13,8 @@ function Get-TabXaml { .EXAMPLE Get-TabXaml "applications" 3 #> - - + + param( [Parameter(Mandatory=$true)] $tabname, $columncount = 0 @@ -80,7 +80,7 @@ function Get-TabXaml { # Dot-source the Get-WPFObjectName function . .\functions\private\Get-WPFObjectName - + $categorycontent = $($category -replace '^.__', '') $categoryname = Get-WPFObjectName -type "Label" -name $categorycontent $blockXml += "