Skip to content

Commit 4737b47

Browse files
committed
Local Lists and GPO colored status
1 parent eac886c commit 4737b47

File tree

1 file changed

+56
-43
lines changed

1 file changed

+56
-43
lines changed

Sources/Winget-AutoUpdate/WAU-Settings-GUI.ps1

Lines changed: 56 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -594,53 +594,66 @@ function Update-WAUGUIFromConfig {
594594
}
595595
$Controls.WinGetVersion.Text = "WinGet Version: $Script:WINGET_VERSION"
596596
$Controls.InstallLocationText.Text = "Install Location: $($updatedConfig.InstallLocation) | "
597-
try {
598-
$installdir = $updatedConfig.InstallLocation
597+
if ($updatedConfig.WAU_ListPath -eq "GPO") {
598+
$Controls.LocalListText.Inlines.Clear()
599+
$Controls.LocalListText.Inlines.Add("Local List: ")
599600
if ($updatedConfig.WAU_UseWhiteList -eq 1) {
600-
$whiteListFile = Join-Path $installdir 'included_apps.txt'
601-
if (Test-Path $whiteListFile) {
602-
$Controls.ActiveListText.Inlines.Clear()
603-
$Controls.ActiveListText.Inlines.Add("Active List: ")
604-
$run = New-Object System.Windows.Documents.Run("'included_apps.txt'")
605-
$run.Foreground = $Script:COLOR_ENABLED
606-
$Controls.ActiveListText.Inlines.Add($run)
607-
} else {
608-
$Controls.ActiveListText.Inlines.Clear()
609-
$Controls.ActiveListText.Inlines.Add("Missing List: ")
610-
$run = New-Object System.Windows.Documents.Run("'included_apps.txt'!")
611-
$run.Foreground = $Script:COLOR_DISABLED
612-
$Controls.ActiveListText.Inlines.Add($run)
613-
}
601+
$run = New-Object System.Windows.Documents.Run("'GPO (Included Apps)'")
614602
} else {
615-
$excludedFile = Join-Path $installdir 'excluded_apps.txt'
616-
$defaultExcludedFile = Join-Path $installdir 'config\default_excluded_apps.txt'
617-
if (Test-Path $excludedFile) {
618-
$Controls.ActiveListText.Inlines.Clear()
619-
$Controls.ActiveListText.Inlines.Add("Active List: ")
620-
$run = New-Object System.Windows.Documents.Run("'excluded_apps.txt'")
621-
$run.Foreground = $Script:COLOR_ENABLED
622-
$Controls.ActiveListText.Inlines.Add($run)
623-
} elseif (Test-Path $defaultExcludedFile) {
624-
$Controls.ActiveListText.Inlines.Clear()
625-
$Controls.ActiveListText.Inlines.Add("Active List: ")
626-
$run = New-Object System.Windows.Documents.Run("'config\default_excluded_apps.txt'")
627-
$run.Foreground = "Orange"
628-
$Controls.ActiveListText.Inlines.Add($run)
603+
$run = New-Object System.Windows.Documents.Run("'GPO (Excluded Apps)'")
604+
}
605+
$run.Foreground = $Script:COLOR_ENABLED
606+
$Controls.LocalListText.Inlines.Add($run)
607+
}
608+
else {
609+
try {
610+
$installdir = $updatedConfig.InstallLocation
611+
if ($updatedConfig.WAU_UseWhiteList -eq 1) {
612+
$whiteListFile = Join-Path $installdir 'included_apps.txt'
613+
if (Test-Path $whiteListFile) {
614+
$Controls.LocalListText.Inlines.Clear()
615+
$Controls.LocalListText.Inlines.Add("Local List: ")
616+
$run = New-Object System.Windows.Documents.Run("'included_apps.txt'")
617+
$run.Foreground = $Script:COLOR_ENABLED
618+
$Controls.LocalListText.Inlines.Add($run)
619+
} else {
620+
$Controls.LocalListText.Inlines.Clear()
621+
$Controls.LocalListText.Inlines.Add("Missing Local List: ")
622+
$run = New-Object System.Windows.Documents.Run("'included_apps.txt'")
623+
$run.Foreground = $Script:COLOR_DISABLED
624+
$Controls.LocalListText.Inlines.Add($run)
625+
}
629626
} else {
630-
$Controls.ActiveListText.Inlines.Clear()
631-
$Controls.ActiveListText.Inlines.Add("Missing Lists: ")
632-
$run = New-Object System.Windows.Documents.Run("'excluded_apps.txt' and 'config\default_excluded_apps.txt'!")
633-
$run.Foreground = $Script:COLOR_DISABLED
634-
$Controls.ActiveListText.Inlines.Add($run)
627+
$excludedFile = Join-Path $installdir 'excluded_apps.txt'
628+
$defaultExcludedFile = Join-Path $installdir 'config\default_excluded_apps.txt'
629+
if (Test-Path $excludedFile) {
630+
$Controls.LocalListText.Inlines.Clear()
631+
$Controls.LocalListText.Inlines.Add("Local List: ")
632+
$run = New-Object System.Windows.Documents.Run("'excluded_apps.txt'")
633+
$run.Foreground = $Script:COLOR_ENABLED
634+
$Controls.LocalListText.Inlines.Add($run)
635+
} elseif (Test-Path $defaultExcludedFile) {
636+
$Controls.LocalListText.Inlines.Clear()
637+
$Controls.LocalListText.Inlines.Add("Local List: ")
638+
$run = New-Object System.Windows.Documents.Run("'config\default_excluded_apps.txt'")
639+
$run.Foreground = "Orange"
640+
$Controls.LocalListText.Inlines.Add($run)
641+
} else {
642+
$Controls.LocalListText.Inlines.Clear()
643+
$Controls.LocalListText.Inlines.Add("Missing Local Lists: ")
644+
$run = New-Object System.Windows.Documents.Run("'excluded_apps.txt' and 'config\default_excluded_apps.txt'")
645+
$run.Foreground = $Script:COLOR_DISABLED
646+
$Controls.LocalListText.Inlines.Add($run)
647+
}
635648
}
636649
}
637-
}
638-
catch {
639-
$Controls.ActiveListText.Inlines.Clear()
640-
$Controls.ActiveListText.Inlines.Add("Active List: ")
641-
$run = New-Object System.Windows.Documents.Run("Unknown!")
642-
$run.Foreground = $Script:COLOR_INACTIVE
643-
$Controls.ActiveListText.Inlines.Add($run)
650+
catch {
651+
$Controls.LocalListText.Inlines.Clear()
652+
$Controls.LocalListText.Inlines.Add("Local List: ")
653+
$run = New-Object System.Windows.Documents.Run("'Unknown'")
654+
$run.Foreground = $Script:COLOR_INACTIVE
655+
$Controls.LocalListText.Inlines.Add($run)
656+
}
644657
}
645658

646659
# Update WAU AutoUpdate status
@@ -945,7 +958,7 @@ function Show-WAUSettingsGUI {
945958
</StackPanel>
946959
<StackPanel Orientation="Horizontal">
947960
<TextBlock x:Name="InstallLocationText" Text="Install Location: " FontSize="9"/>
948-
<TextBlock x:Name="ActiveListText" Text="Active List: " FontSize="9"/>
961+
<TextBlock x:Name="LocalListText" Text="Local List: " FontSize="9"/>
949962
</StackPanel>
950963
951964
<TextBlock x:Name="WAUAutoUpdateText" Text="WAU AutoUpdate: " FontSize="9"/>

0 commit comments

Comments
 (0)