Skip to content

Commit 5fb36ae

Browse files
committed
Code went missing.. ..and minor name changes
1 parent 8b57817 commit 5fb36ae

File tree

2 files changed

+52
-12
lines changed

2 files changed

+52
-12
lines changed

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

Lines changed: 51 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -716,9 +716,9 @@ function New-WAUTransformFile {
716716
$transformPath = [System.IO.Path]::Combine($msiDirectory, $transformName)
717717

718718
# Create a copy of the MSI to modify
719-
$BackupFile = [System.IO.Path]::GetTempFileName()
720-
Copy-Item $selectedFile $BackupFile -Force
721-
$modifiedDb = $installer.GetType().InvokeMember("OpenDatabase", "InvokeMethod", $null, $installer, @($BackupFile, 1))
719+
$tempFile = [System.IO.Path]::GetTempFileName()
720+
Copy-Item $selectedFile $tempFile -Force
721+
$modifiedDb = $installer.GetType().InvokeMember("OpenDatabase", "InvokeMethod", $null, $installer, @($tempFile, 1))
722722

723723
# Collect all properties from form controls
724724
$properties = @{
@@ -896,8 +896,8 @@ msiexec /x"$($guid)" REBOOT=R /qn /l*v "%~dp0Uninst-$logFileName"
896896
}
897897

898898
# Clean up temp file
899-
if (Test-Path $BackupFile) {
900-
Remove-Item $BackupFile -Force -ErrorAction SilentlyContinue
899+
if (Test-Path $tempFile) {
900+
Remove-Item $tempFile -Force -ErrorAction SilentlyContinue
901901
}
902902
}
903903
catch {
@@ -1161,7 +1161,7 @@ function Set-ControlsState {
11611161

11621162
$alwaysEnabledControls = @(
11631163
'ScreenshotButton', 'SaveButton', 'CancelButton', 'RunNowButton', 'OpenLogsButton',
1164-
'DevTaskButton', 'DevRegButton', 'DevGUIDButton', 'DevListButton', 'DevMSTButton'
1164+
'DevTaskButton', 'DevRegButton', 'DevGUIDButton', 'DevListButton', 'DevMSIButton'
11651165
)
11661166

11671167
function Get-Children($control) {
@@ -1697,7 +1697,36 @@ function Test-SettingsChanged {
16971697
$guiAzureBlob = $controls.AzureBlobSASURLTextBox.Text
16981698
if ($savedAzureBlob -ne $guiAzureBlob) { $changes += "Azure Blob SAS URL" }
16991699

1700-
# Include shortcuts in normal mode too
1700+
# All checkboxes
1701+
$savedDisableAutoUpdate = [bool](Get-DisplayValue "WAU_DisableAutoUpdate" $currentConfig $policies)
1702+
$guiDisableAutoUpdate = [bool]$controls.DisableWAUAutoUpdateCheckBox.IsChecked
1703+
if ($savedDisableAutoUpdate -ne $guiDisableAutoUpdate) { $changes += "Disable WAU AutoUpdate" }
1704+
1705+
$savedUpdatePrerelease = [bool](Get-DisplayValue "WAU_UpdatePrerelease" $currentConfig $policies)
1706+
$guiUpdatePrerelease = [bool]$controls.UpdatePreReleaseCheckBox.IsChecked
1707+
if ($savedUpdatePrerelease -ne $guiUpdatePrerelease) { $changes += "Update PreRelease" }
1708+
1709+
$savedDoNotRunOnMetered = [bool](Get-DisplayValue "WAU_DoNotRunOnMetered" $currentConfig $policies)
1710+
$guiDoNotRunOnMetered = [bool]$controls.DoNotRunOnMeteredCheckBox.IsChecked
1711+
if ($savedDoNotRunOnMetered -ne $guiDoNotRunOnMetered) { $changes += "Don't run on data plan" }
1712+
1713+
$savedUpdatesAtLogon = [bool](Get-DisplayValue "WAU_UpdatesAtLogon" $currentConfig $policies)
1714+
$guiUpdatesAtLogon = [bool]$controls.UpdatesAtLogonCheckBox.IsChecked
1715+
if ($savedUpdatesAtLogon -ne $guiUpdatesAtLogon) { $changes += "Run at user logon" }
1716+
1717+
$savedUserContext = [bool](Get-DisplayValue "WAU_UserContext" $currentConfig $policies)
1718+
$guiUserContext = [bool]$controls.UserContextCheckBox.IsChecked
1719+
if ($savedUserContext -ne $guiUserContext) { $changes += "Run in user context" }
1720+
1721+
$savedBypassListForUsers = [bool](Get-DisplayValue "WAU_BypassListForUsers" $currentConfig $policies)
1722+
$guiBypassListForUsers = [bool]$controls.BypassListForUsersCheckBox.IsChecked
1723+
if ($savedBypassListForUsers -ne $guiBypassListForUsers) { $changes += "Bypass list in user context" }
1724+
1725+
$savedUseWhiteList = [bool](Get-DisplayValue "WAU_UseWhiteList" $currentConfig $policies)
1726+
$guiUseWhiteList = [bool]$controls.UseWhiteListCheckBox.IsChecked
1727+
if ($savedUseWhiteList -ne $guiUseWhiteList) { $changes += "Use whitelist" }
1728+
1729+
# Shortcut checkboxes
17011730
$savedDesktop = [bool]($currentConfig.WAU_DesktopShortcut -eq 1)
17021731
$guiDesktop = [bool]$controls.DesktopShortcutCheckBox.IsChecked
17031732
if ($savedDesktop -ne $guiDesktop) { $changes += "Desktop Shortcut" }
@@ -1710,7 +1739,18 @@ function Test-SettingsChanged {
17101739
$guiAppInstaller = [bool]$controls.AppInstallerShortcutCheckBox.IsChecked
17111740
if ($savedAppInstaller -ne $guiAppInstaller) { $changes += "App Installer Shortcut" }
17121741

1713-
# Add more settings as needed: WAU_DoNotUpdate, WAU_DisableWAUAutoUpdate, etc.
1742+
# Log settings
1743+
$savedMaxLogFiles = Get-DisplayValue "WAU_MaxLogFiles" $currentConfig $policies
1744+
$guiMaxLogFiles = $controls.MaxLogFilesComboBox.SelectedItem.Content
1745+
if ($savedMaxLogFiles -ne $guiMaxLogFiles) { $changes += "Max Log Files" }
1746+
1747+
$savedMaxLogSize = Get-DisplayValue "WAU_MaxLogSize" $currentConfig $policies
1748+
$guiMaxLogSize = if ($controls.MaxLogSizeComboBox.SelectedItem -and $controls.MaxLogSizeComboBox.SelectedItem.Tag) {
1749+
$controls.MaxLogSizeComboBox.SelectedItem.Tag
1750+
} else {
1751+
$controls.MaxLogSizeComboBox.Text
1752+
}
1753+
if ($savedMaxLogSize -ne $guiMaxLogSize) { $changes += "Max Log Size" }
17141754
}
17151755

17161756
return @{
@@ -1920,7 +1960,7 @@ function Set-DevToolsVisibility {
19201960
$controls.DevRegButton.Visibility = 'Visible'
19211961
$controls.DevGUIDButton.Visibility = 'Visible'
19221962
$controls.DevListButton.Visibility = 'Visible'
1923-
$controls.DevMSTButton.Visibility = 'Visible'
1963+
$controls.DevMSIButton.Visibility = 'Visible'
19241964
$controls.DevCfgButton.Visibility = 'Visible'
19251965
$controls.LinksStackPanel.Visibility = 'Visible'
19261966
$window.Title = "$Script:WAU_TITLE - Dev Tools"
@@ -1929,7 +1969,7 @@ function Set-DevToolsVisibility {
19291969
$controls.DevRegButton.Visibility = 'Collapsed'
19301970
$controls.DevGUIDButton.Visibility = 'Collapsed'
19311971
$controls.DevListButton.Visibility = 'Collapsed'
1932-
$controls.DevMSTButton.Visibility = 'Collapsed'
1972+
$controls.DevMSIButton.Visibility = 'Collapsed'
19331973
$controls.DevCfgButton.Visibility = 'Collapsed'
19341974
$controls.LinksStackPanel.Visibility = 'Collapsed'
19351975
$window.Title = "$Script:WAU_TITLE"
@@ -2291,7 +2331,7 @@ function Show-WAUSettingsGUI {
22912331
}
22922332
})
22932333

2294-
$controls.DevMSTButton.Add_Click({
2334+
$controls.DevMSIButton.Add_Click({
22952335
if (New-WAUTransformFile -controls $controls) {
22962336
# Update status to "Done"
22972337
$controls.StatusBarText.Text = $Script:STATUS_DONE_TEXT

Sources/Winget-AutoUpdate/config/settings-window.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
ToolTip="open the GUID path to registry/installer folder"/>
5050
<Button x:Name="DevListButton" Content="[list]" Width="36" Height="25" Visibility="Collapsed" Margin="0,0,3,0"
5151
ToolTip="open the current local list"/>
52-
<Button x:Name="DevMSTButton" Content="[mst]" Width="36" Height="25" Visibility="Collapsed" Margin="0,0,3,0"
52+
<Button x:Name="DevMSIButton" Content="[msi]" Width="36" Height="25" Visibility="Collapsed" Margin="0,0,3,0"
5353
ToolTip="create a transform file for 'WAU.msi' using the current visible settings"/>
5454
<Button x:Name="DevCfgButton" Content="[cfg]" Width="36" Height="25" Visibility="Collapsed" Margin="0,0,0,0"
5555
ToolTip="backup current &amp; import WAU settings file"/>

0 commit comments

Comments
 (0)