From 53cca489baeb110e99bf202b27a210c662735856 Mon Sep 17 00:00:00 2001 From: Sunset Date: Wed, 15 Feb 2023 00:57:12 +0500 Subject: [PATCH] style improvements --- CCS.ps1 | 16 ++++++++-------- Functions.ps1 | 4 ++-- Listener.ps1 | 18 +++++++++--------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/CCS.ps1 b/CCS.ps1 index 975e558..6fcf645 100644 --- a/CCS.ps1 +++ b/CCS.ps1 @@ -8,7 +8,7 @@ Remove-Module -Name Functions -ErrorAction SilentlyContinue Clear-Variable -Name Localization, windowsTheme, cursorSize, useClassicWheel, useAlternatePrecision, originalCursorFolder, customCursorFolder, byteDiffFolder, useListener, input -ErrorAction SilentlyContinue Import-LocalizedData -BindingVariable Localization -BaseDirectory $PSScriptRoot\Localizations -FileName Strings Import-Module -Name $PSScriptRoot\Functions.ps1 -#endregion +#endregion Preparation #region Dialogs do { @@ -72,7 +72,7 @@ switch ($input) { 1 {$useListener = $true} 2 {$useListener = $false} } -#endregion +#endregion Dialogs #region Variables @@ -80,7 +80,7 @@ $windowsTheme = Get-WindowsTheme $originalCursorFolder = "$PSScriptRoot\Resources\Original Cursors\$windowsTheme\$cursorSize" $byteDiffFolder = "$PSScriptRoot\Resources\Byte Diff\$cursorSize" $customCursorFolder = "$PSScriptRoot\Resources\Custom Cursor" -#endregion +#endregion Variables #region Cursor Copy-Item -Path $originalCursorFolder\default\* -Destination $customCursorFolder -Recurse -Force @@ -101,13 +101,13 @@ if ($useAlternatePrecision) { } Install-CursorFromFolder -Path $customCursorFolder Apply-Changes -#endregion +#endregion Cursor #region Parameters Set-Content -Path $PSScriptRoot\Resources\Preferences -Value $cursorSize Add-Content -Path $PSScriptRoot\Resources\Preferences -Value $useClassicWheel Add-Content -Path $PSScriptRoot\Resources\Preferences -Value $useAlternatePrecision -#endregion +#endregion Parameters #region Listener if ($useListener) { @@ -119,10 +119,10 @@ if ($useListener) { $settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -StartWhenAvailable -DontStopIfGoingOnBatteries -ExecutionTimeLimit '00:00:00' Stop-ScheduledTask -TaskName $name -ErrorAction SilentlyContinue Register-ScheduledTask -TaskName $name -Description $description -Action $action -Trigger $trigger -Settings $settings -RunLevel Highest -Force | Out-Null - Start-Sleep 1 + Start-Sleep -Seconds 1 Start-ScheduledTask -TaskName $name } -#endregion +#endregion Listener #region Final Messages Clear-Host @@ -133,4 +133,4 @@ Write-Host -Object $Localization.GitHubReminderMessage Write-Host Pause exit -#endregion \ No newline at end of file +#endregion Final Messages \ No newline at end of file diff --git a/Functions.ps1 b/Functions.ps1 index e59a970..1cd6a4a 100644 --- a/Functions.ps1 +++ b/Functions.ps1 @@ -144,10 +144,10 @@ function Patch-Cursor { [CmdletBinding()] param ( [Parameter(Mandatory)] - [array]$Diff, + [array]$Diff, [Parameter(Mandatory)] - [byte[]]$Cursor + [byte[]]$Cursor ) $color = Get-WindowsAccentColor $counter = 0 diff --git a/Listener.ps1 b/Listener.ps1 index 8a1bca4..acb055c 100644 --- a/Listener.ps1 +++ b/Listener.ps1 @@ -6,17 +6,17 @@ $ErrorActionPreference = 'Stop' Remove-Module -Name Functions -ErrorAction SilentlyContinue Clear-Variable -Name lastTheme, currentTheme, lastAccentColor, currentAccentColor, useClassicWheel, useAlternatePrecision, originalCursorFolder, customCursorFolder -ErrorAction SilentlyContinue Import-Module -Name $PSScriptRoot\Functions.ps1 -#endregion +#endregion Preparation #region Variables $cursorSize = Get-Content -Path $PSScriptRoot\Resources\Preferences -First 1 $useClassicWheel = Get-Content -Path $PSScriptRoot\Resources\Preferences -First 2 | Select-Object -Skip 1 $useAlternatePrecision = [System.Convert]::ToBoolean( $(Get-Content -Path $PSScriptRoot\Resources\Preferences -Last 1) ) -$byteDiffFolder = "$PSScriptRoot\Resources\Byte Diff\$cursorSize" -$customCursorFolder = "$PSScriptRoot\Resources\Custom Cursor" -$lastTheme = Get-WindowsTheme -$lastAccentColor = Get-WindowsAccentColor -#endregion +$byteDiffFolder = "$PSScriptRoot\Resources\Byte Diff\$cursorSize" +$customCursorFolder = "$PSScriptRoot\Resources\Custom Cursor" +$lastTheme = Get-WindowsTheme +$lastAccentColor = Get-WindowsAccentColor +#endregion Variables while (1) { #region Theme @@ -43,7 +43,7 @@ while (1) { Apply-Changes $lastTheme = $currentTheme } - #endregion + #endregion Theme #region Accent Color $currentAccentColor = Get-WindowsAccentColor @@ -60,7 +60,7 @@ while (1) { } $lastAccentColor = $currentAccentColor } - #endregion + #endregion Accent Color - Start-Sleep 1 + Start-Sleep -Seconds 1 } \ No newline at end of file