Test 2024 01 30 (#1541)

* applications.jsonAdded Foxit Reader app and updated Foxit Editor to show the difference.

* applications.json

Added Foxit Reader app and updated Foxit Editor to show the difference.

* Compile Winutil

* Fix Broken Link and add syncthingtray (#1508)

* Compile Winutil

* Remove Nano-Removed bugged Nano package for now

* Remove Nano

-Removed bugged Nano package for now

* Compile Winutil

* tweaks and fetures tabs clean up automation from inputXML.xaml

* tweaks and fetures tabs clean up automation from inputXML.xaml

* fixed some commas in tweaks.json file

* recompile

* Update tweaks.json

* Compile Winutil

* Choosing Alternate Scartch Path and Busy Messages

* Choosing Alternate Scartch Path and Busy Messages

* Change Selected index to be pro

* Compile Winutil

* Improve detection for Pro editions of Windows (#1539)

* Update applications.json

Fake app add made by linux fanboy

* Compile Winutil

* Update files

- Add detections for whether the image to be processed by MicroWin is Windows 10 or later
- Add procedure to clear the indexes ComboBox (WinForms term) every time an ISO is specified

* Update screen-install.png (#1464)

* Compile Winutil

* Improve detection for Professional editions

---------

Co-authored-by: Chris Titus <dfm.titus@gmail.com>
Co-authored-by: ChrisTitusTech <ChrisTitusTech@users.noreply.github.com>
Co-authored-by: Samq64 <81489795+Samq64@users.noreply.github.com>
Co-authored-by: Chris Titus <contact@christitus.com>

* Fix features not being installed and winget reinstall (#1537)

* Fix typo in features variable

This fucker caused every. single. feature in config tab to not install

* Add argument "--force" to winget reinstall

Some users reported not being able to reinstall winget without this argument.

* Revert "Add argument "--force" to winget reinstall"

This reverts commit b331460340.

* Add "--force" argument when reinstalling winget

---------

Co-authored-by: Chris Titus <contact@christitus.com>

* RE: Add Adobe Creative Cloud Cleaner tool (#1532)

* Add a new function for handling the new tool

Implement a new function called Invoke-WPFRunAdobeCCCleanerTool which will download, run the tool and delete it afterwards.

* Add the button invocation to call the new function

If this is not done, the button will do nothing if the user clicks on it.

* Add the button to the XML code

* Add button using the new way

Using inputXAML.xml is the old way.

* Compile Winutil

* application are evenly distributed to 5 columns (#1534)

* Exclude compiled winutil

* Fix unit tests

---------

Co-authored-by: LoopTJ <34551682+LoopTJ@users.noreply.github.com>
Co-authored-by: ChrisTitusTech <ChrisTitusTech@users.noreply.github.com>
Co-authored-by: Roc Wang <rocwang911@gmail.com>
Co-authored-by: Jes Herring <123990927+jesjess243@users.noreply.github.com>
Co-authored-by: ogfrm <96927197+ogfrm@users.noreply.github.com>
Co-authored-by: LeeDowA <157072913+LeeDowA@users.noreply.github.com>
Co-authored-by: CodingWonders <101426328+CodingWonders@users.noreply.github.com>
Co-authored-by: Samq64 <81489795+Samq64@users.noreply.github.com>
Co-authored-by: Yuri Gabriel <97139700+Yuuh15@users.noreply.github.com>
Co-authored-by: Ken Hoo <158048821+mrkenhoo@users.noreply.github.com>
This commit is contained in:
Chris Titus
2024-02-02 16:22:08 -06:00
committed by GitHub
parent b2dc605098
commit f472057c12
14 changed files with 1291 additions and 1073 deletions

View File

@ -52,57 +52,123 @@ $sync.runspace.Open()
$inputXML = $inputXML -replace 'mc:Ignorable="d"', '' -replace "x:N", 'N' -replace '^<Win.*', '<Window'
$organizedData = @{}
# Iterate through JSON data and organize by panel and category
foreach ($appName in $sync.configs.applications.PSObject.Properties.Name) {
$appInfo = $sync.configs.applications.$appName
function Get-TabXaml {
param( [Parameter(Mandatory=$true)]
$tabname,
$columncount = 0
)
$organizedData = @{}
# Iterate through JSON data and organize by panel and category
foreach ($appName in $sync.configs.$tabname.PSObject.Properties.Name) {
$appInfo = $sync.configs.$tabname.$appName
# Create an object for the application
$appObject = [PSCustomObject]@{
Name = $appName
Category = $appInfo.Category
Content = $appInfo.Content
Choco = $appInfo.choco
Winget = $appInfo.winget
Panel = $appInfo.panel
Link = $appInfo.link
Description = $appInfo.description
# Create an object for the application
$appObject = [PSCustomObject]@{
Name = $appName
Category = $appInfo.Category
Content = $appInfo.Content
Choco = $appInfo.choco
Winget = $appInfo.winget
Panel = if ($columncount -gt 0 ) { "0" } else {$appInfo.panel}
Link = $appInfo.link
Description = $appInfo.description
# Type is (Checkbox,Toggle,Button,Combobox ) (Default is Checkbox)
Type = $appInfo.type
ComboItems = $appInfo.ComboItems
# Checked is the property to set startup checked status of checkbox (Default is false)
Checked = $appInfo.Checked
}
if (-not $organizedData.ContainsKey($appObject.panel)) {
$organizedData[$appObject.panel] = @{}
}
if (-not $organizedData[$appObject.panel].ContainsKey($appObject.Category)) {
$organizedData[$appObject.panel][$appObject.Category] = @{}
}
# Store application data in a sub-array under the category
# Add Order property to keep the original order of tweaks and features
$organizedData[$appObject.panel][$appInfo.Category]["$($appInfo.order)$appName"] = $appObject
}
if (-not $organizedData.ContainsKey($appInfo.panel)) {
$organizedData[$appInfo.panel] = @{}
$panelcount=0
$paneltotal = $organizedData.Keys.Count
if ($columncount -gt 0) {
$appcount = $sync.configs.$tabname.PSObject.Properties.Name.count + $organizedData["0"].Keys.count
$maxcount = [Math]::Round( $appcount / $columncount + 0.5)
$paneltotal = $columncount
}
if (-not $organizedData[$appInfo.panel].ContainsKey($appInfo.Category)) {
$organizedData[$appInfo.panel][$appInfo.Category] = @{}
}
# Store application data in a sub-array under the category
$organizedData[$appInfo.panel][$appInfo.Category][$appName] = $appObject
}
# Iterate through organizedData by panel, category, and application
foreach ($panel in $organizedData.Keys) {
foreach ($category in $organizedData[$panel].Keys) {
$blockXml += "<Label Content=""$($category)"" FontSize=""16""/>`n"
$sortedApps = $organizedData[$panel][$category].Keys | Sort-Object
foreach ($appName in $sortedApps) {
$appInfo = $organizedData[$panel][$category][$appName]
if ($null -eq $appInfo.Link)
{
$blockXml += "<CheckBox Name=""$appName"" Content=""$($appInfo.Content)"" ToolTip=""$($appInfo.Description)""/>`n"
# add ColumnDefinitions to evenly draw colums
$blockXml="<Grid.ColumnDefinitions>`n"+("<ColumnDefinition Width=""*""/>`n"*($paneltotal))+"</Grid.ColumnDefinitions>`n"
# Iterate through organizedData by panel, category, and application
$count = 0
foreach ($panel in ($organizedData.Keys | Sort-Object)) {
$blockXml += "<Border Grid.Row=""1"" Grid.Column=""$panelcount"">`n<StackPanel Background=""{MainBackgroundColor}"" SnapsToDevicePixels=""True"">`n"
$panelcount++
foreach ($category in ($organizedData[$panel].Keys | Sort-Object)) {
$count++
if ($columncount -gt 0) {
$panelcount2 = [Int](($count)/$maxcount-0.5)
if ($panelcount -eq $panelcount2 ) {
$blockXml +="`n</StackPanel>`n</Border>`n"
$blockXml += "<Border Grid.Row=""1"" Grid.Column=""$panelcount"">`n<StackPanel Background=""{MainBackgroundColor}"" SnapsToDevicePixels=""True"">`n"
$panelcount++
}
}
else
{
$blockXml += "<StackPanel Orientation=""Horizontal""><CheckBox Name=""$appName"" Content=""$($appInfo.Content)"" ToolTip=""$($appInfo.Description)"" Margin=""0,0,2,0""/><TextBlock Name=""$($appName)Link"" Style=""{StaticResource HoverTextBlockStyle}"" Text=""(?)"" ToolTip=""$($appInfo.Link)"" /></StackPanel>`n"
$blockXml += "<Label Content=""$($category -replace '^.__', '')"" FontSize=""16""/>`n"
$sortedApps = $organizedData[$panel][$category].Keys | Sort-Object
foreach ($appName in $sortedApps) {
$count++
if ($columncount -gt 0) {
$panelcount2 = [Int](($count)/$maxcount-0.5)
if ($panelcount -eq $panelcount2 ) {
$blockXml +="`n</StackPanel>`n</Border>`n"
$blockXml += "<Border Grid.Row=""1"" Grid.Column=""$panelcount"">`n<StackPanel Background=""{MainBackgroundColor}"" SnapsToDevicePixels=""True"">`n"
$panelcount++
}
}
$appInfo = $organizedData[$panel][$category][$appName]
if ("Toggle" -eq $appInfo.Type) {
$blockXml += "<StackPanel Orientation=`"Horizontal`" Margin=`"0,10,0,0`">`n<Label Content=`"$($appInfo.Content)`" Style=`"{StaticResource labelfortweaks}`" ToolTip=`"$($appInfo.Description)`" />`n"
$blockXml += "<CheckBox Name=`"$($appInfo.Name)`" Style=`"{StaticResource ColorfulToggleSwitchStyle}`" Margin=`"2.5,0`"/>`n</StackPanel>`n"
} elseif ("Combobox" -eq $appInfo.Type) {
$blockXml += "<StackPanel Orientation=`"Horizontal`" Margin=`"0,5,0,0`">`n<Label Content=`"$($appInfo.Content)`" HorizontalAlignment=`"Left`" VerticalAlignment=`"Center`"/>`n"
$blockXml += "<ComboBox Name=`"$($appInfo.Name)`" Height=`"32`" Width=`"186`" HorizontalAlignment=`"Left`" VerticalAlignment=`"Center`" Margin=`"5,5`">`n"
$addfirst="IsSelected=`"True`""
foreach ($comboitem in ($appInfo.ComboItems -split " ")) {
$blockXml += "<ComboBoxItem $addfirst Content=`"$comboitem`"/>`n"
$addfirst=""
}
$blockXml += "</ComboBox>`n</StackPanel>"
# If it is a digit, type is button and button length is digits
} elseif ($appInfo.Type -match "^[\d\.]+$") {
$blockXml += "<Button Name=`"$($appInfo.Name)`" Content=`"$($appInfo.Content)`" HorizontalAlignment = `"Left`" Width=`"$($appInfo.Type)`" Margin=`"5`" Padding=`"20,5`" />`n"
# else it is a checkbox
} else {
$checkedStatus = If ($null -eq $appInfo.Checked) {""} Else {"IsChecked=`"$($appInfo.Checked)`" "}
if ($null -eq $appInfo.Link)
{
$blockXml += "<CheckBox Name=`"$($appInfo.Name)`" Content=`"$($appInfo.Content)`" $($checkedStatus)Margin=`"5,0`" ToolTip=`"$($appInfo.Description)`"/>`n"
}
else
{
$blockXml += "<StackPanel Orientation=""Horizontal"">`n<CheckBox Name=""$($appInfo.Name)"" Content=""$($appInfo.Content)"" $($checkedStatus)ToolTip=""$($appInfo.Description)"" Margin=""0,0,2,0""/><TextBlock Name=""$($appInfo.Name)Link"" Style=""{StaticResource HoverTextBlockStyle}"" Text=""(?)"" ToolTip=""$($appInfo.Link)"" />`n</StackPanel>`n"
}
}
}
}
$blockXml +="`n</StackPanel>`n</Border>`n"
}
$inputXML = $inputXML -replace "{{InstallPanel$panel}}", $blockXml
$blockXml = ""
return ($blockXml)
}
$tabcolums=Get-TabXaml "applications" 5
$inputXML = $inputXML -replace "{{InstallPanel_applications}}", ($tabcolums)
$tabcolums=Get-TabXaml "tweaks"
$inputXML = $inputXML -replace "{{InstallPanel_tweaks}}", ($tabcolums)
$tabcolums=Get-TabXaml "feature"
$inputXML = $inputXML -replace "{{InstallPanel_features}}", ($tabcolums)
if ((Get-WinUtilToggleStatus WPFToggleDarkMode) -eq $True) {
$ctttheme = 'Matrix'
}
@ -168,7 +234,7 @@ $sync.keys | ForEach-Object {
Write-Debug "Opening: $($Sender.ToolTip)"
})
}
}
}
}
@ -287,7 +353,7 @@ $sync["Form"].Add_Deactivated({
$sync["Form"].Add_ContentRendered({
try {
try {
[void][Window]
} catch {
Add-Type @"
@ -300,11 +366,11 @@ Add-Type @"
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool MoveWindow(IntPtr handle, int x, int y, int width, int height, bool redraw);
[DllImport("user32.dll")]
public static extern int GetSystemMetrics(int nIndex);
};
@ -368,7 +434,7 @@ Add-Type @"
} else {
Write-Debug "Unable to retrieve information about the primary monitor."
}
Invoke-WPFTab "WPFTab1BT"
$sync["Form"].Focus()
@ -420,20 +486,20 @@ $sync["CheckboxFilter"].Add_TextChanged({
$filter = Get-WinUtilVariables -Type CheckBox
$CheckBoxes = $sync.GetEnumerator() | Where-Object { $psitem.Key -in $filter }
foreach ($CheckBox in $CheckBoxes) {
# Check if the checkbox is null or if it doesn't have content
if ($CheckBox -eq $null -or $CheckBox.Value -eq $null -or $CheckBox.Value.Content -eq $null) {
if ($CheckBox -eq $null -or $CheckBox.Value -eq $null -or $CheckBox.Value.Content -eq $null) {
continue
}
$textToSearch = $sync.CheckboxFilter.Text
$checkBoxName = $CheckBox.Key
$textBlockName = $checkBoxName + "Link"
# Retrieve the corresponding text block based on the generated name
$textBlock = $sync[$textBlockName]
if ($CheckBox.Value.Content.ToLower().Contains($textToSearch)) {
$CheckBox.Value.Visibility = "Visible"
# Set the corresponding text block visibility
@ -449,7 +515,7 @@ $sync["CheckboxFilter"].Add_TextChanged({
}
}
}
})
# Define event handler for button click
@ -493,7 +559,7 @@ GUI : @KonTy
MicroWin : @KonTy
GitHub : https://github.com/ChrisTitusTech/winutil
Version : $($sync.version)
"@
"@
Show-CustomDialog -Message $authorInfo -Width 400
})