mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-01-15 17:30:37 -06:00
Compare commits
2 Commits
ae87100c61
...
5621b50762
Author | SHA1 | Date | |
---|---|---|---|
|
5621b50762 | ||
|
b02294daf9 |
@ -3091,8 +3091,8 @@
|
||||
"panel": "1",
|
||||
"Order": "a002_",
|
||||
"InvokeScript": [
|
||||
"Get-ChildItem -Path \"C:\\Windows\\Temp\" *.* -Recurse | Remove-Item -Force -Recurse
|
||||
Get-ChildItem -Path $env:TEMP *.* -Recurse | Remove-Item -Force -Recurse"
|
||||
"Get-ChildItem -Path \"C:\\Windows\\Temp\" *.* -Recurse | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue
|
||||
Get-ChildItem -Path $env:TEMP *.* -Recurse | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue"
|
||||
],
|
||||
"link": "https://christitustech.github.io/winutil/dev/tweaks/Essential-Tweaks/DeleteTempFiles"
|
||||
},
|
||||
|
@ -43,6 +43,7 @@ function Set-WinUtilTaskbaritem {
|
||||
[string]$description
|
||||
)
|
||||
|
||||
try {
|
||||
if ($value) {
|
||||
$sync["Form"].taskbarItemInfo.ProgressValue = $value
|
||||
}
|
||||
@ -83,4 +84,7 @@ function Set-WinUtilTaskbaritem {
|
||||
if ($description) {
|
||||
$sync["Form"].taskbarItemInfo.Description = $description
|
||||
}
|
||||
} catch {
|
||||
#nothing
|
||||
}
|
||||
}
|
||||
|
@ -18,12 +18,14 @@ function Invoke-WPFFeatureInstall {
|
||||
|
||||
if ($FeatureConfig) {
|
||||
$Features = $FeatureConfig
|
||||
$automation = $true
|
||||
} else {
|
||||
$Features = (Get-WinUtilCheckBoxes)["WPFFeature"]
|
||||
$automation = $false
|
||||
}
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList $Features -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($Features, $DebugPreference)
|
||||
Invoke-WPFRunspace -ArgumentList $Features, $automation -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($Features, $automation, $DebugPreference)
|
||||
$sync.ProcessRunning = $true
|
||||
if ($Features.count -eq 1) {
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" })
|
||||
|
@ -18,8 +18,10 @@ function Invoke-WPFInstall {
|
||||
|
||||
if ($InstallConfig) {
|
||||
$PackagesToInstall = $InstallConfig
|
||||
$automation = $true
|
||||
} else {
|
||||
$PackagesToInstall = (Get-WinUtilCheckBoxes)["Install"]
|
||||
$automation = $false
|
||||
}
|
||||
|
||||
if ($PackagesToInstall.Count -eq 0) {
|
||||
@ -29,8 +31,8 @@ function Invoke-WPFInstall {
|
||||
}
|
||||
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList $PackagesToInstall -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($PackagesToInstall, $DebugPreference)
|
||||
Invoke-WPFRunspace -ArgumentList $PackagesToInstall, $automation -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($PackagesToInstall, $automation, $DebugPreference)
|
||||
if ($PackagesToInstall.count -eq 1) {
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" })
|
||||
} else {
|
||||
|
@ -22,9 +22,13 @@ function Invoke-WPFRunspace {
|
||||
Param (
|
||||
$ScriptBlock,
|
||||
$ArgumentList,
|
||||
$DebugPreference
|
||||
$DebugPreference,
|
||||
$automation
|
||||
)
|
||||
|
||||
if ($automation = $true) {
|
||||
& $ScriptBlock @ArgumentList @DebugPreference
|
||||
} else {
|
||||
# Create a PowerShell instance
|
||||
$script:powershell = [powershell]::Create()
|
||||
|
||||
@ -46,3 +50,4 @@ function Invoke-WPFRunspace {
|
||||
[System.GC]::Collect()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,8 +18,10 @@ function Invoke-WPFtweaksbutton {
|
||||
|
||||
if ($TweaksConfig) {
|
||||
$Tweaks = $TweaksConfig
|
||||
$automation = $true
|
||||
} else {
|
||||
$Tweaks = (Get-WinUtilCheckBoxes)["WPFTweaks"]
|
||||
$automation = $false
|
||||
}
|
||||
|
||||
Set-WinUtilDNS -DNSProvider $sync["WPFchangedns"].text
|
||||
@ -32,8 +34,8 @@ function Invoke-WPFtweaksbutton {
|
||||
|
||||
Write-Debug "Number of tweaks to process: $($Tweaks.Count)"
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList $Tweaks -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($Tweaks, $DebugPreference)
|
||||
Invoke-WPFRunspace -ArgumentList $Tweaks, $automation -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($Tweaks, $automation, $DebugPreference)
|
||||
Write-Debug "Inside Number of tweaks to process: $($Tweaks.Count)"
|
||||
|
||||
$sync.ProcessRunning = $true
|
||||
|
@ -146,12 +146,60 @@ Invoke-WPFRunspace -ScriptBlock {
|
||||
} | Out-Null
|
||||
|
||||
#===========================================================================
|
||||
# Setup and Show the Form
|
||||
# Print Logo into Console
|
||||
#===========================================================================
|
||||
|
||||
# Print the logo
|
||||
Invoke-WPFFormVariables
|
||||
|
||||
#===========================================================================
|
||||
# Run Automation
|
||||
#===========================================================================
|
||||
|
||||
if ($PARAM_CONFIG) {
|
||||
if ($PARAM_RUN) {
|
||||
$installConfig = Get-Content $PARAM_CONFIG -Raw | ConvertFrom-Json
|
||||
if ($installConfig.WPFInstall) {
|
||||
write-host "Installing Programs"
|
||||
|
||||
# Create a new array to hold the combined install configurations
|
||||
$combinedInstallConfig = @()
|
||||
|
||||
# Iterate over each WPFInstall entry
|
||||
for ($i = 0; $i -lt $installConfig.WPFInstall.Count; $i++) {
|
||||
$wpfInstallEntry = $installConfig.WPFInstall[$i]
|
||||
$installEntry = $installConfig.Install[$i]
|
||||
|
||||
# Create a new object with the combined values
|
||||
$combinedEntry = @{
|
||||
Name = $wpfInstallEntry
|
||||
Winget = $installEntry.winget
|
||||
Choco = $installEntry.choco
|
||||
}
|
||||
|
||||
# Add the combined entry to the array
|
||||
$combinedInstallConfig += $combinedEntry
|
||||
}
|
||||
|
||||
# Invoke the WPFInstall function with the combined configuration
|
||||
Invoke-WPFInstall -InstallConfig $combinedInstallConfig
|
||||
}
|
||||
if ($installConfig.WPFTweaks) {
|
||||
write-host "Running Tweaks"
|
||||
Invoke-WPFtweaksbutton -TweaksConfig $installConfig.WPFTweaks
|
||||
}
|
||||
if ($installConfig.WPFFeature) {
|
||||
write-host "Installing Features"
|
||||
Invoke-WPFFeatureInstall -FeatureConfig $installConfig.WPFFeature
|
||||
}
|
||||
} else {
|
||||
Invoke-WPFImpex -type "import" -Config $PARAM_CONFIG
|
||||
}
|
||||
}
|
||||
|
||||
#===========================================================================
|
||||
# Setup and Show the Form
|
||||
#===========================================================================
|
||||
|
||||
# Progress bar in taskbaritem > Set-WinUtilProgressbar
|
||||
$sync["Form"].TaskbarItemInfo = New-Object System.Windows.Shell.TaskbarItemInfo
|
||||
Set-WinUtilTaskbaritem -state "None"
|
||||
@ -318,49 +366,6 @@ Add-Type @"
|
||||
|
||||
Invoke-WPFTab "WPFTab1BT"
|
||||
$sync["Form"].Focus()
|
||||
|
||||
# maybe this is not the best place to load and execute config file?
|
||||
# maybe community can help?
|
||||
if ($PARAM_CONFIG) {
|
||||
if ($PARAM_RUN) {
|
||||
$installConfig = Get-Content $PARAM_CONFIG -Raw | ConvertFrom-Json
|
||||
if ($installConfig.WPFTweaks) {
|
||||
write-host "Running Tweaks"
|
||||
Invoke-WPFtweaksbutton -TweaksConfig $installConfig.WPFTweaks
|
||||
}
|
||||
if ($installConfig.WPFFeature) {
|
||||
write-host "Installing Features"
|
||||
Invoke-WPFFeatureInstall -FeatureConfig $installConfig.WPFFeature
|
||||
}
|
||||
if ($installConfig.WPFInstall) {
|
||||
write-host "Installing Programs"
|
||||
|
||||
# Create a new array to hold the combined install configurations
|
||||
$combinedInstallConfig = @()
|
||||
|
||||
# Iterate over each WPFInstall entry
|
||||
for ($i = 0; $i -lt $installConfig.WPFInstall.Count; $i++) {
|
||||
$wpfInstallEntry = $installConfig.WPFInstall[$i]
|
||||
$installEntry = $installConfig.Install[$i]
|
||||
|
||||
# Create a new object with the combined values
|
||||
$combinedEntry = @{
|
||||
Name = $wpfInstallEntry
|
||||
Winget = $installEntry.winget
|
||||
Choco = $installEntry.choco
|
||||
}
|
||||
|
||||
# Add the combined entry to the array
|
||||
$combinedInstallConfig += $combinedEntry
|
||||
}
|
||||
|
||||
# Invoke the WPFInstall function with the combined configuration
|
||||
Invoke-WPFInstall -InstallConfig $combinedInstallConfig
|
||||
}
|
||||
} else {
|
||||
Invoke-WPFImpex -type "import" -Config $PARAM_CONFIG
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
# Load Checkboxes and Labels outside of the Filter function only once on startup for performance reasons
|
||||
@ -535,5 +540,8 @@ $sync["SponsorMenuItem"].Add_Click({
|
||||
$Height = $sync.configs.themes.$ctttheme.CustomDialogHeight
|
||||
Show-CustomDialog -Message $authorInfo -Width $Width -Height $Height -FontSize $FontSize -HeaderFontSize $HeaderFontSize -IconSize $IconSize -EnableScroll $true
|
||||
})
|
||||
|
||||
if (!$PARAM_RUN) {
|
||||
$sync["Form"].ShowDialog() | out-null
|
||||
Stop-Transcript
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user