mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-07-01 02:22:34 -05:00
Compare commits
31 Commits
admin-elev
...
18466bc496
Author | SHA1 | Date | |
---|---|---|---|
18466bc496 | |||
a17080f13b | |||
c056bbcfe4 | |||
2748767a47 | |||
83fe6c5b12 | |||
2ea708eeb0 | |||
6175c0889c | |||
210f321a34 | |||
f0b4660478 | |||
11d3c66fc0 | |||
3dd51a6c3c | |||
c24129387e | |||
80ca474891 | |||
307980a7ef | |||
a22d6b0d10 | |||
4c6990b515 | |||
3f48c8aa70 | |||
93c96fafd2 | |||
4d2ea15e19 | |||
cdf36857c5 | |||
e6e449af94 | |||
506c015496 | |||
3be1999c22 | |||
b15f31fdf8 | |||
47e80010d1 | |||
1132d53944 | |||
bb39be794b | |||
ec4cb1d520 | |||
eaa19eba8a | |||
dfe7dc4044 | |||
4402c5cf31 |
19
.github/workflows/github-pages.yaml
vendored
19
.github/workflows/github-pages.yaml
vendored
@ -1,15 +1,16 @@
|
||||
name: GitHub Pages Deploy
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published, prereleased]
|
||||
push:
|
||||
paths:
|
||||
- '.github/mkdocs.yml'
|
||||
- '.github/requirements.txt'
|
||||
- 'docs/**'
|
||||
- 'overrides/**'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
build-and-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
@ -22,10 +23,10 @@ jobs:
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.x # Install latest Stable release of Python 3
|
||||
cache: 'pip' # caching pip dependencies
|
||||
cache: 'pip' # Caching pip dependencies
|
||||
|
||||
- name: Install Necessary Dependencies using 'pip install -r .github/requirements.txt'
|
||||
- name: Install Necessary Dependencies
|
||||
run: pip install -r .github/requirements.txt
|
||||
|
||||
- name: Build & Deploy using 'mkdocs'
|
||||
- name: Build & Deploy using mkdocs
|
||||
run: mkdocs gh-deploy --force -f .github/mkdocs.yml
|
13
Compile.ps1
13
Compile.ps1
@ -110,20 +110,7 @@ Get-ChildItem "$workingdir\config" | Where-Object {$psitem.extension -eq ".json"
|
||||
|
||||
$xaml = (Get-Content "$workingdir\xaml\inputXML.xaml").replace("'","''")
|
||||
|
||||
# Dot-source the Get-TabXaml function
|
||||
. "$workingdir\functions\private\Get-TabXaml.ps1"
|
||||
|
||||
Update-Progress "Building: Xaml " 75
|
||||
$appXamlContent = Get-TabXaml "applications" 5
|
||||
$tweaksXamlContent = Get-TabXaml "tweaks"
|
||||
$featuresXamlContent = Get-TabXaml "feature"
|
||||
|
||||
|
||||
Update-Progress "Adding: Xaml " 90
|
||||
# Replace the placeholder in $inputXML with the content of inputApp.xaml
|
||||
$xaml = $xaml -replace "{{InstallPanel_applications}}", $appXamlContent
|
||||
$xaml = $xaml -replace "{{InstallPanel_tweaks}}", $tweaksXamlContent
|
||||
$xaml = $xaml -replace "{{InstallPanel_features}}", $featuresXamlContent
|
||||
|
||||
$script_content.Add($(Write-output "`$inputXML = '$xaml'"))
|
||||
|
||||
|
@ -52,7 +52,7 @@ If you have Issues, refer to [Known Issues](https://christitustech.github.io/win
|
||||
|
||||
These are the sponsors that help keep this project alive with monthly contributions.
|
||||
|
||||
<!-- sponsors --><a href="https://github.com/ysaito8015"><img src="https://github.com/ysaito8015.png" width="60px" alt="Yusuke Saito" /></a><a href="https://github.com/TriHydera"><img src="https://github.com/TriHydera.png" width="60px" alt="TriHydera" /></a><a href="https://github.com/jozozovko"><img src="https://github.com/jozozovko.png" width="60px" alt="" /></a><a href="https://github.com/DelDongo"><img src="https://github.com/DelDongo.png" width="60px" alt="" /></a><a href="https://github.com/markamos"><img src="https://github.com/markamos.png" width="60px" alt="Mark Amos" /></a><a href="https://github.com/dwelfusius"><img src="https://github.com/dwelfusius.png" width="60px" alt="" /></a><a href="https://github.com/mews-se"><img src="https://github.com/mews-se.png" width="60px" alt="" /></a><a href="https://github.com/jdiegmueller"><img src="https://github.com/jdiegmueller.png" width="60px" alt="Jason A. Diegmueller" /></a><a href="https://github.com/AlanTristar"><img src="https://github.com/AlanTristar.png" width="60px" alt="" /></a><a href="https://github.com/JennJones89"><img src="https://github.com/JennJones89.png" width="60px" alt="" /></a><a href="https://github.com/zepled112"><img src="https://github.com/zepled112.png" width="60px" alt="wyatt" /></a><a href="https://github.com/altugtekiner"><img src="https://github.com/altugtekiner.png" width="60px" alt="" /></a><a href="https://github.com/getsmor"><img src="https://github.com/getsmor.png" width="60px" alt="" /></a><a href="https://github.com/robertsandrock"><img src="https://github.com/robertsandrock.png" width="60px" alt="" /></a><a href="https://github.com/jeffnesbit"><img src="https://github.com/jeffnesbit.png" width="60px" alt="" /></a><a href="https://github.com/mmomega"><img src="https://github.com/mmomega.png" width="60px" alt="" /></a><a href="https://github.com/KenichiQaz"><img src="https://github.com/KenichiQaz.png" width="60px" alt="Stefan" /></a><a href="https://github.com/thaddl"><img src="https://github.com/thaddl.png" width="60px" alt="thaddl" /></a><a href="https://github.com/paulsheets"><img src="https://github.com/paulsheets.png" width="60px" alt="Paul" /></a><a href="https://github.com/djones369"><img src="https://github.com/djones369.png" width="60px" alt="Dave Jones" /></a><a href="https://github.com/anthonymendez"><img src="https://github.com/anthonymendez.png" width="60px" alt="Anthony Mendez" /></a><a href="https://github.com/woobe-studio"><img src="https://github.com/woobe-studio.png" width="60px" alt="Michael Wozniak" /></a><a href="https://github.com/xBandaku"><img src="https://github.com/xBandaku.png" width="60px" alt="xPandaku" /></a><!-- sponsors -->
|
||||
<!-- sponsors --><a href="https://github.com/ysaito8015"><img src="https://github.com/ysaito8015.png" width="60px" alt="Yusuke Saito" /></a><a href="https://github.com/TriHydera"><img src="https://github.com/TriHydera.png" width="60px" alt="TriHydera" /></a><a href="https://github.com/jozozovko"><img src="https://github.com/jozozovko.png" width="60px" alt="" /></a><a href="https://github.com/DelDongo"><img src="https://github.com/DelDongo.png" width="60px" alt="" /></a><a href="https://github.com/markamos"><img src="https://github.com/markamos.png" width="60px" alt="Mark Amos" /></a><a href="https://github.com/dwelfusius"><img src="https://github.com/dwelfusius.png" width="60px" alt="" /></a><a href="https://github.com/mews-se"><img src="https://github.com/mews-se.png" width="60px" alt="" /></a><a href="https://github.com/jdiegmueller"><img src="https://github.com/jdiegmueller.png" width="60px" alt="Jason A. Diegmueller" /></a><a href="https://github.com/AlanTristar"><img src="https://github.com/AlanTristar.png" width="60px" alt="" /></a><a href="https://github.com/JennJones89"><img src="https://github.com/JennJones89.png" width="60px" alt="" /></a><a href="https://github.com/zepled112"><img src="https://github.com/zepled112.png" width="60px" alt="wyatt" /></a><a href="https://github.com/altugtekiner"><img src="https://github.com/altugtekiner.png" width="60px" alt="" /></a><a href="https://github.com/robertsandrock"><img src="https://github.com/robertsandrock.png" width="60px" alt="" /></a><a href="https://github.com/mmomega"><img src="https://github.com/mmomega.png" width="60px" alt="" /></a><a href="https://github.com/KenichiQaz"><img src="https://github.com/KenichiQaz.png" width="60px" alt="Stefan" /></a><a href="https://github.com/thaddl"><img src="https://github.com/thaddl.png" width="60px" alt="thaddl" /></a><a href="https://github.com/paulsheets"><img src="https://github.com/paulsheets.png" width="60px" alt="Paul" /></a><a href="https://github.com/djones369"><img src="https://github.com/djones369.png" width="60px" alt="Dave Jones" /></a><a href="https://github.com/anthonymendez"><img src="https://github.com/anthonymendez.png" width="60px" alt="Anthony Mendez" /></a><a href="https://github.com/woobe-studio"><img src="https://github.com/woobe-studio.png" width="60px" alt="Michael Wozniak" /></a><a href="https://github.com/xBandaku"><img src="https://github.com/xBandaku.png" width="60px" alt="xPandaku" /></a><a href="https://github.com/claudemods"><img src="https://github.com/claudemods.png" width="60px" alt="Claudemods" /></a><a href="https://github.com/hkolatan"><img src="https://github.com/hkolatan.png" width="60px" alt="Halil Kolatan" /></a><!-- sponsors -->
|
||||
|
||||
## 🏅 Thanks to all Contributors
|
||||
Thanks a lot for spending your time helping Winutil grow. Thanks a lot! Keep rocking 🍻.
|
||||
|
@ -12,7 +12,7 @@
|
||||
"HeaderFontFamily": "Consolas, Monaco",
|
||||
|
||||
"CheckBoxBulletDecoratorFontSize": "14",
|
||||
"CheckBoxMargin": "15,0,0,2",
|
||||
"CheckBoxMargin": "5,0,0,2",
|
||||
|
||||
"TabButtonFontSize": "14",
|
||||
"TabButtonWidth": "100",
|
||||
@ -86,7 +86,7 @@
|
||||
"HeaderFontFamily": "Consolas, Monaco",
|
||||
|
||||
"CheckBoxBulletDecoratorFontSize": "14",
|
||||
"CheckBoxMargin": "15,0,0,2",
|
||||
"CheckBoxMargin": "5,0,0,1",
|
||||
|
||||
"TabButtonFontSize": "14",
|
||||
"TabButtonWidth": "100",
|
||||
@ -158,7 +158,7 @@
|
||||
"HeaderFontFamily": "Consolas, Monaco",
|
||||
|
||||
"CheckBoxBulletDecoratorFontSize": "14",
|
||||
"CheckBoxMargin": "15,0,0,2",
|
||||
"CheckBoxMargin": "5,0,0,0.8",
|
||||
|
||||
"TabButtonFontSize": "14",
|
||||
"TabButtonWidth": "100",
|
||||
|
@ -198,26 +198,7 @@ The utility provides three distinct settings for managing Windows updates: Defau
|
||||
* Selecting a scratch directory will copy the contents of the ISO file to the directory you specify instead of an automatically generated folder in the `%TEMP%` directory.
|
||||
* You can select an edition of Windows to debloat (**SKU**) using the convenient drop-down menu.
|
||||
|
||||
By default, MicroWin will debloat the Pro edition, but you can choose any edition you want.
|
||||
|
||||
|
||||
##### Customization options
|
||||
|
||||
* **Keep Provisioned Packages**: leaving this option unticked (default) will try to remove every operating system package.
|
||||
|
||||
Some packages may remain after processing. This can happen if the packages in question are permanent or have been superseded by newer versions.
|
||||
|
||||
* **Keep Appx Packages**: leaving this option unticked (default) will try to remove every Microsoft Store app from the Windows image.
|
||||
|
||||
This option will exclude some applications that are essential in the event that you want or need to add a Store app later on.
|
||||
|
||||
* **Keep Defender**: leaving this option unticked will try to remove every part of Windows Defender, including the Windows Security app.
|
||||
|
||||
Leaving this option unticked is **NOT recommended** unless you plan to use a third-party antivirus solution on your MicroWin installation. In that regard, don't install AVs with bad reputations or rogueware.
|
||||
|
||||
* **Keep Edge**: leaving this option unticked will try to remove every part of the Microsoft Edge browser using the best methods available.
|
||||
|
||||
Leaving this option unticked is not recommended because it might break some applications that might depend on the `Edge WebView2` runtime. However, if that happens, you can easily [reinstall it](https://developer.microsoft.com/en-us/microsoft-edge/webview2)
|
||||
By default, MicroWin will debloat the Pro edition, but you can choose any edition you want.
|
||||
|
||||
|
||||
##### Driver integration options
|
||||
@ -225,7 +206,15 @@ The utility provides three distinct settings for managing Windows updates: Defau
|
||||
* **Inject drivers** will add the drivers in the folder that you specify to the target Windows image.
|
||||
* **Import drivers from the current system** will add every third-party driver that is present in your active installation.
|
||||
|
||||
This makes the target image have the same hardware compatibility as the active installation. However, this means that you will only be able to install the target Windows image and take full advantage of it on computers with **the same hardware**. To avoid this, you'll need to customize the `install.wim` file of the target ISO in the 'sources` folder.
|
||||
This makes the target image have the same hardware compatibility as the active installation. However, this means that you will only be able to install the target Windows image and take full advantage of it on computers with **the same hardware**. To avoid this, you'll need to customize the `install.wim` file of the target ISO in the 'sources` folder.
|
||||
|
||||
##### Custom user settings
|
||||
|
||||
With MicroWin, you can also configure your user before proceeding if you don't want to use the default `User` account. To do this, simply type the account name (20 characters maximum), and a password. Then, let MicroWin do the rest.
|
||||
|
||||
!!! info
|
||||
|
||||
Please make sure that you remember your password. MicroWin will configure auto-login settings, so you won't have to enter your password. However, if you are required to enter your password, it's best that you don't forget it.
|
||||
|
||||
|
||||
##### Ventoy options
|
||||
|
@ -1,221 +0,0 @@
|
||||
function Get-TabXaml {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Generates XAML for a tab in the WinUtil GUI
|
||||
This function is used to generate the XAML for the applications tab in the WinUtil GUI
|
||||
It takes the tabname and the number of columns to display the applications in as input and returns the XAML for the tab as output
|
||||
|
||||
.PARAMETER tabname
|
||||
The name of the tab to generate XAML for
|
||||
Note: the 'tabname' parameter must equal one of the json files found in $sync.configs variable
|
||||
Otherwise, it'll throw an exception
|
||||
|
||||
.PARAMETER columncount
|
||||
The number of columns to display the applications in, default is 0
|
||||
|
||||
.OUTPUTS
|
||||
The XAML for the tab
|
||||
|
||||
.EXAMPLE
|
||||
Get-TabXaml "applications" 3
|
||||
#>
|
||||
|
||||
|
||||
param(
|
||||
[Parameter(Mandatory, position=0)]
|
||||
[string]$tabname,
|
||||
|
||||
[Parameter(position=1)]
|
||||
[ValidateRange(0,10)] # 10 panels as max number is more then enough
|
||||
[int]$columncount = 0
|
||||
)
|
||||
|
||||
# Validate tabname
|
||||
if ($sync.configs.$tabname -eq $null) {
|
||||
throw "Invalid parameter passed, can't find '$tabname' in '`$sync.configs' variable, please double check any calls to 'Get-TabXaml' function."
|
||||
}
|
||||
|
||||
$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 = 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
|
||||
ButtonWidth = $appInfo.ButtonWidth
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
# Same tab amount in last line of 'inputXML.xaml' file
|
||||
# TODO: Get the base repeat (amount) of tabs from last line (or even lines)
|
||||
# so it can dynamicly react to whatever is before this generated XML string.
|
||||
# .. may be solve this even before calling this function, and pass the result as a parameter?
|
||||
$tab_repeat = 7
|
||||
$spaces_per_tab = 4 # The convenction used across the code base
|
||||
$tab_as_spaces = $(" " * $spaces_per_tab)
|
||||
$precal_indent = $($tab_as_spaces * $tab_repeat)
|
||||
$precal_indent_p1 = $($tab_as_spaces * ($tab_repeat + 1))
|
||||
$precal_indent_p2 = $($tab_as_spaces * ($tab_repeat + 2))
|
||||
$precal_indent_m1 = $($tab_as_spaces * ($tab_repeat - 1))
|
||||
$precal_indent_m2 = $($tab_as_spaces * ($tab_repeat - 2))
|
||||
|
||||
# Calculate the needed number of panels
|
||||
$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
|
||||
}
|
||||
# add ColumnDefinitions to evenly draw colums
|
||||
$blockXml = "<Grid.ColumnDefinitions>"
|
||||
$blockXml += $("`r`n" + " " * ($spaces_per_tab * $tab_repeat) +
|
||||
"<ColumnDefinition Width=""*""/>") * $paneltotal
|
||||
$blockXml += $("`r`n" + " " * ($spaces_per_tab * ($tab_repeat - 1))) +
|
||||
"</Grid.ColumnDefinitions>" + "`r`n"
|
||||
|
||||
# Iterate through 'organizedData' by panel, category, and application
|
||||
$count = 0
|
||||
foreach ($panel in ($organizedData.Keys | Sort-Object)) {
|
||||
$blockXml += $precal_indent_m1 + "<Border Grid.Row=""1"" Grid.Column=""$panelcount"">" + "`r`n"
|
||||
$blockXml += $precal_indent + "<StackPanel Background=""{MainBackgroundColor}"" SnapsToDevicePixels=""True"">" + "`r`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 += $precal_indent_p2 + "</StackPanel>" + "`r`n"
|
||||
$blockXml += $precal_indent_p1 + "</Border>" + "`r`n"
|
||||
$blockXml += $precal_indent_p1 + "<Border Grid.Row=""1"" Grid.Column=""$panelcount"">" + "`r`n"
|
||||
$blockXml += $precal_indent_p2 + "<StackPanel Background=""{MainBackgroundColor}"" SnapsToDevicePixels=""True"">" + "`r`n"
|
||||
$panelcount++
|
||||
}
|
||||
}
|
||||
|
||||
# Dot-source the Get-WPFObjectName function
|
||||
. "$($sync.PSScriptRoot)\functions\private\Get-WPFObjectName.ps1"
|
||||
|
||||
$categorycontent = $($category -replace '^.__', '')
|
||||
$categoryname = Get-WPFObjectName -type "Label" -name $categorycontent
|
||||
$blockXml += $("`r`n" + " " * ($spaces_per_tab * $tab_repeat)) +
|
||||
"<Label Name=""$categoryname"" Content=""$categorycontent""" + " " +
|
||||
"FontSize=""{FontSizeHeading}"" FontFamily=""{HeaderFontFamily}""/>" + "`r`n" + "`r`n"
|
||||
$sortedApps = $organizedData[$panel][$category].Keys | Sort-Object
|
||||
foreach ($appName in $sortedApps) {
|
||||
$count++
|
||||
|
||||
if ($columncount -gt 0) {
|
||||
$panelcount2 = [Int](($count)/$maxcount-0.5)
|
||||
# Verify the indentation actually works...
|
||||
if ($panelcount -eq $panelcount2 ) {
|
||||
$blockXml += $precal_indent_m1 +
|
||||
"</StackPanel>" + "`r`n"
|
||||
$blockXml += $precal_indent_m2 +
|
||||
"</Border>" + "`r`n"
|
||||
$blockXml += $precal_indent_m2 +
|
||||
"<Border Grid.Row=""1"" Grid.Column=""$panelcount"">" + "`r`n"
|
||||
$blockXml += $precal_indent_m1 +
|
||||
"<StackPanel Background=""{MainBackgroundColor}"" SnapsToDevicePixels=""True"">" + "`r`n"
|
||||
$panelcount++
|
||||
}
|
||||
}
|
||||
|
||||
$appInfo = $organizedData[$panel][$category][$appName]
|
||||
switch ($appInfo.Type) {
|
||||
"Toggle" {
|
||||
$blockXml += $precal_indent_m1 +
|
||||
"<DockPanel LastChildFill=""True"">" + "`r`n"
|
||||
$blockXml += $precal_indent +
|
||||
"<CheckBox Name=""$($appInfo.Name)"" Style=""{StaticResource ColorfulToggleSwitchStyle}"" Margin=""4,0""" + " " +
|
||||
"HorizontalAlignment=""Right"" FontSize=""{FontSize}""/>" + "`r`n"
|
||||
$blockXml += $precal_indent +
|
||||
"<Label Content=""$($appInfo.Content)"" ToolTip=""$($appInfo.Description)""" + " " +
|
||||
"HorizontalAlignment=""Left"" FontSize=""{FontSize}""/>" + "`r`n"
|
||||
$blockXml += $precal_indent_m1 +
|
||||
"</DockPanel>" + "`r`n"
|
||||
}
|
||||
|
||||
"Combobox" {
|
||||
$blockXml += $precal_indent_m1 +
|
||||
"<StackPanel Orientation=""Horizontal"" Margin=""0,5,0,0"">" + "`r`n"
|
||||
$blockXml += $precal_indent + "<Label Content=""$($appInfo.Content)"" HorizontalAlignment=""Left""" + " " +
|
||||
"VerticalAlignment=""Center"" FontSize=""{FontSize}""/>" + "`r`n"
|
||||
$blockXml += $precal_indent +
|
||||
"<ComboBox Name=""$($appInfo.Name)"" Height=""32"" Width=""186"" HorizontalAlignment=""Left""" + " " +
|
||||
"VerticalAlignment=""Center"" Margin=""5,5"" FontSize=""{FontSize}"">" + "`r`n"
|
||||
|
||||
$addfirst="IsSelected=""True"""
|
||||
foreach ($comboitem in ($appInfo.ComboItems -split " ")) {
|
||||
$blockXml += $precal_indent_p1 +
|
||||
"<ComboBoxItem $addfirst Content=""$comboitem"" FontSize=""{FontSize}""/>" + "`r`n"
|
||||
$addfirst=""
|
||||
}
|
||||
|
||||
$blockXml += $precal_indent_p1 + "</ComboBox>" + "`r`n"
|
||||
$blockXml += $precal_indent + "</StackPanel>" + "`r`n"
|
||||
}
|
||||
|
||||
"Button" {
|
||||
if ($appInfo.ButtonWidth -ne $null) {
|
||||
$ButtonWidthStr = "Width=""$($appInfo.ButtonWidth)"""
|
||||
}
|
||||
$blockXml += $precal_indent +
|
||||
"<Button Name=""$($appInfo.Name)"" Content=""$($appInfo.Content)""" + " " +
|
||||
"HorizontalAlignment=""Left"" Margin=""5"" Padding=""20,5"" $($ButtonWidthStr)/>" + "`r`n"
|
||||
}
|
||||
|
||||
# else it is a checkbox
|
||||
default {
|
||||
$checkedStatus = If ($appInfo.Checked -eq $null) {""} else {" IsChecked=""$($appInfo.Checked)"""}
|
||||
if ($appInfo.Link -eq $null) {
|
||||
$blockXml += $precal_indent +
|
||||
"<CheckBox Name=""$($appInfo.Name)"" Content=""$($appInfo.Content)""$($checkedStatus) Margin=""5,0""" + " " +
|
||||
"ToolTip=""$($appInfo.Description)""/>" + "`r`n"
|
||||
} else {
|
||||
$blockXml += $precal_indent +
|
||||
"<StackPanel Orientation=""Horizontal"">" + "`r`n"
|
||||
$blockXml += $precal_indent_p1 +
|
||||
"<CheckBox Name=""$($appInfo.Name)"" Content=""$($appInfo.Content)""$($checkedStatus)" + " " +
|
||||
"ToolTip=""$($appInfo.Description)"" Margin=""0,0,2,0""/>" + "`r`n"
|
||||
$blockXml += $precal_indent_p1 +
|
||||
"<TextBlock Name=""$($appInfo.Name)Link"" Style=""{StaticResource HoverTextBlockStyle}"" Text=""(?)""" + " " +
|
||||
"ToolTip=""$($appInfo.Link)""/>" + "`r`n"
|
||||
$blockXml += $precal_indent +
|
||||
"</StackPanel>" + "`r`n"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$blockXml += $precal_indent_p1 + "</StackPanel>" + "`r`n"
|
||||
$blockXml += $precal_indent + "</Border>" + "`r`n"
|
||||
}
|
||||
return ($blockXml)
|
||||
}
|
@ -101,7 +101,9 @@ function Remove-Packages {
|
||||
$_ -NotLike "*DesktopAppInstaller*" -AND
|
||||
$_ -NotLike "*WebMediaExtensions*" -AND
|
||||
$_ -NotLike "*WMIC*" -AND
|
||||
$_ -NotLike "*UI.XaML*"
|
||||
$_ -NotLike "*UI.XaML*" -AND
|
||||
$_ -NotLike "*Ethernet*" -AND
|
||||
$_ -NotLike "*Wifi*"
|
||||
}
|
||||
|
||||
foreach ($pkg in $pkglist) {
|
||||
@ -132,6 +134,8 @@ function Remove-ProvisionedPackages() {
|
||||
.EXAMPLE
|
||||
Remove-ProvisionedPackages
|
||||
#>
|
||||
try
|
||||
{
|
||||
$appxProvisionedPackages = Get-AppxProvisionedPackage -Path "$($scratchDir)" | Where-Object {
|
||||
$_.PackageName -NotLike "*AppInstaller*" -AND
|
||||
$_.PackageName -NotLike "*Store*" -and
|
||||
@ -141,7 +145,6 @@ function Remove-ProvisionedPackages() {
|
||||
$_.PackageName -NotLike "*LanguageFeatures*" -and
|
||||
$_.PackageName -NotLike "*Notepad*" -and
|
||||
$_.PackageName -NotLike "*Printing*" -and
|
||||
$_.PackageName -NotLike "*Wifi*" -and
|
||||
$_.PackageName -NotLike "*Foundation*" -and
|
||||
$_.PackageName -NotLike "*YourPhone*" -and
|
||||
$_.PackageName -NotLike "*Xbox*" -and
|
||||
@ -153,7 +156,6 @@ function Remove-ProvisionedPackages() {
|
||||
$_.PackageName -NotLike "*Gaming*" -and
|
||||
$_.PackageName -NotLike "*Extension*" -and
|
||||
$_.PackageName -NotLike "*SecHealthUI*"
|
||||
|
||||
}
|
||||
|
||||
$counter = 0
|
||||
@ -169,6 +171,12 @@ function Remove-ProvisionedPackages() {
|
||||
}
|
||||
Write-Progress -Activity "Removing Provisioned Apps" -Status "Ready" -Completed
|
||||
}
|
||||
catch
|
||||
{
|
||||
# This can happen if getting AppX packages fails
|
||||
Write-Host "Unable to get information about the AppX packages. MicroWin processing will continue, but AppX packages will not be processed"
|
||||
}
|
||||
}
|
||||
|
||||
function Copy-ToUSB([string]$fileToCopy) {
|
||||
foreach ($volume in Get-Volume) {
|
||||
@ -239,6 +247,11 @@ function Remove-FileOrDirectory([string]$pathToDelete, [string]$mask = "", [swit
|
||||
|
||||
function New-Unattend {
|
||||
|
||||
param (
|
||||
[Parameter(Mandatory, Position = 0)] [string] $userName,
|
||||
[Parameter(Position = 1)] [string] $userPassword
|
||||
)
|
||||
|
||||
$unattend = @'
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<unattend xmlns="urn:schemas-microsoft-com:unattend"
|
||||
@ -261,21 +274,21 @@ function New-Unattend {
|
||||
<UserAccounts>
|
||||
<LocalAccounts>
|
||||
<LocalAccount wcm:action="add">
|
||||
<Name>User</Name>
|
||||
<Name>USER-REPLACEME</Name>
|
||||
<Group>Administrators</Group>
|
||||
<Password>
|
||||
<Value></Value>
|
||||
<Value>PW-REPLACEME</Value>
|
||||
<PlainText>true</PlainText>
|
||||
</Password>
|
||||
</LocalAccount>
|
||||
</LocalAccounts>
|
||||
</UserAccounts>
|
||||
<AutoLogon>
|
||||
<Username>User</Username>
|
||||
<Username>USER-REPLACEME</Username>
|
||||
<Enabled>true</Enabled>
|
||||
<LogonCount>1</LogonCount>
|
||||
<Password>
|
||||
<Value></Value>
|
||||
<Value>PW-REPLACEME</Value>
|
||||
<PlainText>true</PlainText>
|
||||
</Password>
|
||||
</AutoLogon>
|
||||
@ -535,6 +548,11 @@ function New-Unattend {
|
||||
# Replace the placeholder text with the Specialize pass
|
||||
$unattend = $unattend.Replace("<#REPLACEME#>", $specPass).Trim()
|
||||
}
|
||||
# Replace default User and Password values with the provided parameters
|
||||
$unattend = $unattend.Replace("USER-REPLACEME", $userName).Trim()
|
||||
$unattend = $unattend.Replace("PW-REPLACEME", $userPassword).Trim()
|
||||
|
||||
# Save unattended answer file with UTF-8 encoding
|
||||
$unattend | Out-File -FilePath "$env:temp\unattend.xml" -Force -Encoding utf8
|
||||
}
|
||||
|
||||
|
@ -178,7 +178,22 @@ public class PowerManagement {
|
||||
Write-Host "Removal complete!"
|
||||
|
||||
Write-Host "Create unattend.xml"
|
||||
New-Unattend
|
||||
#New-Unattend
|
||||
if ($sync.MicrowinUserName.Text -eq "")
|
||||
{
|
||||
New-Unattend -userName "User"
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($sync.MicrowinUserPassword.Password -eq "")
|
||||
{
|
||||
New-Unattend -userName "$($sync.MicrowinUserName.Text)"
|
||||
}
|
||||
else
|
||||
{
|
||||
New-Unattend -userName "$($sync.MicrowinUserName.Text)" -userPassword "$($sync.MicrowinUserPassword.Password)"
|
||||
}
|
||||
}
|
||||
Write-Host "Done Create unattend.xml"
|
||||
Write-Host "Copy unattend.xml file into the ISO"
|
||||
New-Item -ItemType Directory -Force -Path "$($scratchDir)\Windows\Panther"
|
||||
@ -248,8 +263,11 @@ public class PowerManagement {
|
||||
# reg delete "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Orchestrator\UScheduler\$_" /f | Out-Null
|
||||
|
||||
# When in Offline Image
|
||||
if (Test-Path "HKLM:\zSOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\$_")
|
||||
{
|
||||
reg delete "HKLM\zSOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\$_" /f | Out-Null
|
||||
}
|
||||
}
|
||||
|
||||
reg add "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d 0 /f
|
||||
Write-Host "Setting all services to start manually"
|
||||
|
315
functions/public/Invoke-WPFUIElements.ps1
Normal file
315
functions/public/Invoke-WPFUIElements.ps1
Normal file
@ -0,0 +1,315 @@
|
||||
function Invoke-WPFUIElements {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Adds UI elements to a specified Grid in the WinUtil GUI based on a JSON configuration.
|
||||
.PARAMETER configVariable
|
||||
The variable/link containing the JSON configuration.
|
||||
.PARAMETER targetGridName
|
||||
The name of the grid to which the UI elements should be added.
|
||||
.PARAMETER columncount
|
||||
The number of columns to be used in the Grid. If not provided, a default value is used based on the panel.
|
||||
.EXAMPLE
|
||||
Invoke-WPFUIElements -configVariable $sync.configs.applications -targetGridName "install" -columncount 5
|
||||
.NOTES
|
||||
Future me/contributer: If possible please wrap this into a runspace to make it load all panels at the same time.
|
||||
#>
|
||||
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
[PSCustomObject]$configVariable,
|
||||
|
||||
[Parameter(Mandatory)]
|
||||
[string]$targetGridName,
|
||||
|
||||
[Parameter(Mandatory)]
|
||||
[int]$columncount
|
||||
)
|
||||
|
||||
$theme = $sync.configs.themes.$ctttheme
|
||||
|
||||
# Convert PSCustomObject to Hashtable
|
||||
$configHashtable = @{}
|
||||
$configVariable.PSObject.Properties.Name | ForEach-Object {
|
||||
$configHashtable[$_] = $configVariable.$_
|
||||
}
|
||||
|
||||
$organizedData = @{}
|
||||
# Iterate through JSON data and organize by panel and category
|
||||
foreach ($entry in $configHashtable.Keys) {
|
||||
$entryInfo = $configHashtable[$entry]
|
||||
|
||||
# Create an object for the application
|
||||
$entryObject = [PSCustomObject]@{
|
||||
Name = $entry
|
||||
Order = $entryInfo.order
|
||||
Category = $entryInfo.Category
|
||||
Content = $entryInfo.Content
|
||||
Choco = $entryInfo.choco
|
||||
Winget = $entryInfo.winget
|
||||
Panel = if ($entryInfo.Panel) { $entryInfo.Panel } else { "0" }
|
||||
Link = $entryInfo.link
|
||||
Description = $entryInfo.description
|
||||
Type = $entryInfo.type
|
||||
ComboItems = $entryInfo.ComboItems
|
||||
Checked = $entryInfo.Checked
|
||||
ButtonWidth = $entryInfo.ButtonWidth
|
||||
}
|
||||
|
||||
if (-not $organizedData.ContainsKey($entryObject.Panel)) {
|
||||
$organizedData[$entryObject.Panel] = @{}
|
||||
}
|
||||
|
||||
if (-not $organizedData[$entryObject.Panel].ContainsKey($entryObject.Category)) {
|
||||
$organizedData[$entryObject.Panel][$entryObject.Category] = @()
|
||||
}
|
||||
|
||||
# Store application data in an array under the category
|
||||
$organizedData[$entryObject.Panel][$entryObject.Category] += $entryObject
|
||||
}
|
||||
|
||||
# Retrieve the main window and the target Grid by name
|
||||
$window = $sync["Form"]
|
||||
$targetGrid = $window.FindName($targetGridName)
|
||||
|
||||
# Clear existing ColumnDefinitions and Children
|
||||
$targetGrid.ColumnDefinitions.Clear() | Out-Null
|
||||
$targetGrid.Children.Clear() | Out-Null
|
||||
|
||||
# Add ColumnDefinitions to the target Grid
|
||||
for ($i = 0; $i -lt $columncount; $i++) {
|
||||
$colDef = New-Object Windows.Controls.ColumnDefinition
|
||||
$colDef.Width = New-Object Windows.GridLength(1, [Windows.GridUnitType]::Star)
|
||||
$targetGrid.ColumnDefinitions.Add($colDef) | Out-Null
|
||||
}
|
||||
|
||||
# Only apply the logic for distributing entries across columns if the targetGridName is "appspanel"
|
||||
if ($targetGridName -eq "appspanel") {
|
||||
$panelcount = 0
|
||||
$entrycount = $configHashtable.Keys.Count + $organizedData["0"].Keys.Count
|
||||
$maxcount = [Math]::Round($entrycount / $columncount + 0.5)
|
||||
}
|
||||
|
||||
# Iterate through 'organizedData' by panel, category, and application
|
||||
$count = 0
|
||||
foreach ($panelKey in ($organizedData.Keys | Sort-Object)) {
|
||||
# Create a Border for each column
|
||||
$border = New-Object Windows.Controls.Border
|
||||
$border.VerticalAlignment = "Stretch" # Ensure the border stretches vertically
|
||||
[System.Windows.Controls.Grid]::SetColumn($border, $panelcount)
|
||||
$border.style = $window.FindResource("BorderStyle")
|
||||
$targetGrid.Children.Add($border) | Out-Null
|
||||
|
||||
# Create a StackPanel inside the Border
|
||||
$stackPanel = New-Object Windows.Controls.StackPanel
|
||||
$stackPanel.Background = [Windows.Media.Brushes]::Transparent
|
||||
$stackPanel.SnapsToDevicePixels = $true
|
||||
$stackPanel.VerticalAlignment = "Stretch" # Ensure the stack panel stretches vertically
|
||||
$border.Child = $stackPanel
|
||||
$panelcount++
|
||||
|
||||
foreach ($category in ($organizedData[$panelKey].Keys | Sort-Object)) {
|
||||
$count++
|
||||
if ($targetGridName -eq "appspanel" -and $columncount -gt 0) {
|
||||
$panelcount2 = [Int](($count) / $maxcount - 0.5)
|
||||
if ($panelcount -eq $panelcount2) {
|
||||
# Create a new Border for the new column
|
||||
$border = New-Object Windows.Controls.Border
|
||||
$border.VerticalAlignment = "Stretch" # Ensure the border stretches vertically
|
||||
[System.Windows.Controls.Grid]::SetColumn($border, $panelcount)
|
||||
$border.style = $window.FindResource("BorderStyle")
|
||||
$targetGrid.Children.Add($border) | Out-Null
|
||||
|
||||
# Create a new StackPanel inside the Border
|
||||
$stackPanel = New-Object Windows.Controls.StackPanel
|
||||
$stackPanel.Background = [Windows.Media.Brushes]::Transparent
|
||||
$stackPanel.SnapsToDevicePixels = $true
|
||||
$stackPanel.VerticalAlignment = "Stretch" # Ensure the stack panel stretches vertically
|
||||
$border.Child = $stackPanel
|
||||
$panelcount++
|
||||
}
|
||||
}
|
||||
|
||||
$label = New-Object Windows.Controls.Label
|
||||
$label.Content = $category -replace ".*__", ""
|
||||
$label.FontSize = $theme.FontSizeHeading
|
||||
$label.FontFamily = $theme.HeaderFontFamily
|
||||
$stackPanel.Children.Add($label) | Out-Null
|
||||
|
||||
$sync[$category] = $label
|
||||
|
||||
# Sort entries by Order and then by Name, but only display Name
|
||||
$entries = $organizedData[$panelKey][$category] | Sort-Object Order, Name
|
||||
foreach ($entryInfo in $entries) {
|
||||
$count++
|
||||
if ($targetGridName -eq "appspanel" -and $columncount -gt 0) {
|
||||
$panelcount2 = [Int](($count) / $maxcount - 0.5)
|
||||
if ($panelcount -eq $panelcount2) {
|
||||
# Create a new Border for the new column
|
||||
$border = New-Object Windows.Controls.Border
|
||||
$border.VerticalAlignment = "Stretch" # Ensure the border stretches vertically
|
||||
[System.Windows.Controls.Grid]::SetColumn($border, $panelcount)
|
||||
$border.style = $window.FindResource("BorderStyle")
|
||||
$targetGrid.Children.Add($border) | Out-Null
|
||||
|
||||
# Create a new StackPanel inside the Border
|
||||
$stackPanel = New-Object Windows.Controls.StackPanel
|
||||
$stackPanel.Background = [Windows.Media.Brushes]::Transparent
|
||||
$stackPanel.SnapsToDevicePixels = $true
|
||||
$stackPanel.VerticalAlignment = "Stretch" # Ensure the stack panel stretches vertically
|
||||
$border.Child = $stackPanel
|
||||
$panelcount++
|
||||
}
|
||||
}
|
||||
|
||||
switch ($entryInfo.Type) {
|
||||
"Toggle" {
|
||||
$dockPanel = New-Object Windows.Controls.DockPanel
|
||||
$checkBox = New-Object Windows.Controls.CheckBox
|
||||
$checkBox.Name = $entryInfo.Name
|
||||
$checkBox.HorizontalAlignment = "Right"
|
||||
$dockPanel.Children.Add($checkBox) | Out-Null
|
||||
$checkBox.Style = $window.FindResource("ColorfulToggleSwitchStyle")
|
||||
|
||||
$label = New-Object Windows.Controls.Label
|
||||
$label.Content = $entryInfo.Content
|
||||
$label.ToolTip = $entryInfo.Description
|
||||
$label.HorizontalAlignment = "Left"
|
||||
$label.FontSize = $theme.FontSize
|
||||
$dockPanel.Children.Add($label) | Out-Null
|
||||
$stackPanel.Children.Add($dockPanel) | Out-Null
|
||||
|
||||
$sync[$entryInfo.Name] = $checkBox
|
||||
|
||||
$sync[$entryInfo.Name].IsChecked = Get-WinUtilToggleStatus $sync[$entryInfo.Name].Name
|
||||
|
||||
$sync[$entryInfo.Name].Add_Click({
|
||||
[System.Object]$Sender = $args[0]
|
||||
Invoke-WPFToggle $Sender.name
|
||||
})
|
||||
}
|
||||
|
||||
"ToggleButton" {
|
||||
$toggleButton = New-Object Windows.Controls.ToggleButton
|
||||
$toggleButton.Name = $entryInfo.Name
|
||||
$toggleButton.Name = "WPFTab" + ($stackPanel.Children.Count + 1) + "BT"
|
||||
$toggleButton.HorizontalAlignment = "Left"
|
||||
$toggleButton.Height = $theme.TabButtonHeight
|
||||
$toggleButton.Width = $theme.TabButtonWidth
|
||||
$toggleButton.Background = $theme.ButtonInstallBackgroundColor
|
||||
$toggleButton.Foreground = [Windows.Media.Brushes]::White
|
||||
$toggleButton.FontWeight = [Windows.FontWeights]::Bold
|
||||
|
||||
$textBlock = New-Object Windows.Controls.TextBlock
|
||||
$textBlock.FontSize = $theme.TabButtonFontSize
|
||||
$textBlock.Background = [Windows.Media.Brushes]::Transparent
|
||||
$textBlock.Foreground = $theme.ButtonInstallForegroundColor
|
||||
|
||||
$underline = New-Object Windows.Documents.Underline
|
||||
$underline.Inlines.Add($entryInfo.name -replace "(.).*", "`$1")
|
||||
|
||||
$run = New-Object Windows.Documents.Run
|
||||
$run.Text = $entryInfo.name -replace "^.", ""
|
||||
|
||||
$textBlock.Inlines.Add($underline)
|
||||
$textBlock.Inlines.Add($run)
|
||||
|
||||
$toggleButton.Content = $textBlock
|
||||
|
||||
$stackPanel.Children.Add($toggleButton) | Out-Null
|
||||
|
||||
$sync[$entryInfo.Name] = $toggleButton
|
||||
}
|
||||
|
||||
"Combobox" {
|
||||
$horizontalStackPanel = New-Object Windows.Controls.StackPanel
|
||||
$horizontalStackPanel.Orientation = "Horizontal"
|
||||
$horizontalStackPanel.Margin = "0,5,0,0"
|
||||
|
||||
$label = New-Object Windows.Controls.Label
|
||||
$label.Content = $entryInfo.Content
|
||||
$label.HorizontalAlignment = "Left"
|
||||
$label.VerticalAlignment = "Center"
|
||||
$label.FontSize = $theme.ButtonFontSize
|
||||
$horizontalStackPanel.Children.Add($label) | Out-Null
|
||||
|
||||
$comboBox = New-Object Windows.Controls.ComboBox
|
||||
$comboBox.Name = $entryInfo.Name
|
||||
$comboBox.Height = $theme.ButtonHeight
|
||||
$comboBox.Width = $theme.ButtonWidth
|
||||
$comboBox.HorizontalAlignment = "Left"
|
||||
$comboBox.VerticalAlignment = "Center"
|
||||
$comboBox.Margin = "5,5"
|
||||
|
||||
foreach ($comboitem in ($entryInfo.ComboItems -split " ")) {
|
||||
$comboBoxItem = New-Object Windows.Controls.ComboBoxItem
|
||||
$comboBoxItem.Content = $comboitem
|
||||
$comboBoxItem.FontSize = $theme.ButtonFontSize
|
||||
$comboBox.Items.Add($comboBoxItem) | Out-Null
|
||||
}
|
||||
|
||||
$horizontalStackPanel.Children.Add($comboBox) | Out-Null
|
||||
$stackPanel.Children.Add($horizontalStackPanel) | Out-Null
|
||||
|
||||
$comboBox.SelectedIndex = 0
|
||||
|
||||
$sync[$entryInfo.Name] = $comboBox
|
||||
}
|
||||
|
||||
"Button" {
|
||||
$button = New-Object Windows.Controls.Button
|
||||
$button.Name = $entryInfo.Name
|
||||
$button.Content = $entryInfo.Content
|
||||
$button.HorizontalAlignment = "Left"
|
||||
$button.Margin = "5"
|
||||
$button.Padding = "20,5"
|
||||
$button.FontSize = $theme.ButtonFontSize
|
||||
if ($entryInfo.ButtonWidth) {
|
||||
$button.Width = $entryInfo.ButtonWidth
|
||||
}
|
||||
$stackPanel.Children.Add($button) | Out-Null
|
||||
|
||||
$sync[$entryInfo.Name] = $button
|
||||
}
|
||||
|
||||
default {
|
||||
$horizontalStackPanel = New-Object Windows.Controls.StackPanel
|
||||
$horizontalStackPanel.Orientation = "Horizontal"
|
||||
|
||||
$checkBox = New-Object Windows.Controls.CheckBox
|
||||
$checkBox.Name = $entryInfo.Name
|
||||
$checkBox.Content = $entryInfo.Content
|
||||
$checkBox.FontSize = $theme.FontSize
|
||||
$checkBox.ToolTip = $entryInfo.Description
|
||||
$checkBox.Margin = $theme.CheckBoxMargin
|
||||
if ($entryInfo.Checked) {
|
||||
$checkBox.IsChecked = $entryInfo.Checked
|
||||
}
|
||||
$horizontalStackPanel.Children.Add($checkBox) | Out-Null
|
||||
|
||||
if ($entryInfo.Link) {
|
||||
$textBlock = New-Object Windows.Controls.TextBlock
|
||||
$textBlock.Name = $checkBox.Name + "Link"
|
||||
$textBlock.Text = "(?)"
|
||||
$textBlock.ToolTip = $entryInfo.Link
|
||||
$textBlock.Style = $window.FindResource("HoverTextBlockStyle")
|
||||
|
||||
# Add event handler for click to open link
|
||||
$handler = [System.Windows.Input.MouseButtonEventHandler]{
|
||||
param($sender, $e)
|
||||
Start-Process $sender.ToolTip.ToString()
|
||||
}
|
||||
$textBlock.AddHandler([Windows.Controls.TextBlock]::MouseLeftButtonUpEvent, $handler)
|
||||
|
||||
$horizontalStackPanel.Children.Add($textBlock) | Out-Null
|
||||
|
||||
$sync[$textBlock.Name] = $textBlock
|
||||
}
|
||||
|
||||
$stackPanel.Children.Add($horizontalStackPanel) | Out-Null
|
||||
$sync[$entryInfo.Name] = $checkBox
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -81,6 +81,14 @@ try {
|
||||
Write-Host "Unable to load Windows.Markup.XamlReader. Double-check syntax and ensure .net is installed."
|
||||
}
|
||||
|
||||
|
||||
# Load the configuration files
|
||||
#Invoke-WPFUIElements -configVariable $sync.configs.nav -targetGridName "WPFMainGrid"
|
||||
Invoke-WPFUIElements -configVariable $sync.configs.applications -targetGridName "appspanel" -columncount 5
|
||||
Invoke-WPFUIElements -configVariable $sync.configs.tweaks -targetGridName "tweakspanel" -columncount 2
|
||||
Invoke-WPFUIElements -configVariable $sync.configs.feature -targetGridName "featurespanel" -columncount 2
|
||||
|
||||
|
||||
#===========================================================================
|
||||
# Store Form Objects In PowerShell
|
||||
#===========================================================================
|
||||
@ -89,16 +97,6 @@ $xaml.SelectNodes("//*[@Name]") | ForEach-Object {$sync["$("$($psitem.Name)")"]
|
||||
|
||||
$sync.keys | ForEach-Object {
|
||||
if($sync.$psitem) {
|
||||
if($($sync["$psitem"].GetType() | Select-Object -ExpandProperty Name) -eq "CheckBox" `
|
||||
-and $sync["$psitem"].Name -like "WPFToggle*") {
|
||||
$sync["$psitem"].IsChecked = Get-WinUtilToggleStatus $sync["$psitem"].Name
|
||||
|
||||
$sync["$psitem"].Add_Click({
|
||||
[System.Object]$Sender = $args[0]
|
||||
Invoke-WPFToggle $Sender.name
|
||||
})
|
||||
}
|
||||
|
||||
if($($sync["$psitem"].GetType() | Select-Object -ExpandProperty Name) -eq "ToggleButton") {
|
||||
$sync["$psitem"].Add_Click({
|
||||
[System.Object]$Sender = $args[0]
|
||||
@ -367,7 +365,6 @@ $labels = @{}
|
||||
$allCategories = $checkBoxes.Name | ForEach-Object {$sync.configs.applications.$_} | Select-Object -Unique -ExpandProperty category
|
||||
|
||||
$sync["SearchBar"].Add_TextChanged({
|
||||
|
||||
if ($sync.SearchBar.Text -ne "") {
|
||||
$sync.SearchBarClearButton.Visibility = "Visible"
|
||||
} else {
|
||||
@ -376,13 +373,14 @@ $sync["SearchBar"].Add_TextChanged({
|
||||
|
||||
$activeApplications = @()
|
||||
|
||||
$textToSearch = $sync.SearchBar.Text.ToLower()
|
||||
|
||||
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) {
|
||||
continue
|
||||
}
|
||||
|
||||
$textToSearch = $sync.SearchBar.Text.ToLower()
|
||||
$checkBoxName = $CheckBox.Key
|
||||
$textBlockName = $checkBoxName + "Link"
|
||||
|
||||
@ -393,22 +391,22 @@ $sync["SearchBar"].Add_TextChanged({
|
||||
$CheckBox.Value.Visibility = "Visible"
|
||||
$activeApplications += $sync.configs.applications.$checkboxName
|
||||
# Set the corresponding text block visibility
|
||||
if ($textBlock -ne $null) {
|
||||
if ($textBlock -ne $null -and $textBlock -is [System.Windows.Controls.TextBlock]) {
|
||||
$textBlock.Visibility = "Visible"
|
||||
}
|
||||
} else {
|
||||
$CheckBox.Value.Visibility = "Collapsed"
|
||||
# Set the corresponding text block visibility
|
||||
if ($textBlock -ne $null) {
|
||||
if ($textBlock -ne $null -and $textBlock -is [System.Windows.Controls.TextBlock]) {
|
||||
$textBlock.Visibility = "Collapsed"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$activeCategories = $activeApplications | Select-Object -ExpandProperty category -Unique
|
||||
|
||||
foreach ($category in $activeCategories) {
|
||||
$label = $labels[$(Get-WPFObjectName -type "Label" -name $category)]
|
||||
$label.Visibility = "Visible"
|
||||
$sync[$category].Visibility = "Visible"
|
||||
}
|
||||
if ($activeCategories) {
|
||||
$inactiveCategories = Compare-Object -ReferenceObject $allCategories -DifferenceObject $activeCategories -PassThru
|
||||
@ -416,8 +414,8 @@ $sync["SearchBar"].Add_TextChanged({
|
||||
$inactiveCategories = $allCategories
|
||||
}
|
||||
foreach ($category in $inactiveCategories) {
|
||||
$label = $labels[$(Get-WPFObjectName -type "Label" -name $category)]
|
||||
$label.Visibility = "Collapsed"}
|
||||
$sync[$category].Visibility = "Collapsed"
|
||||
}
|
||||
})
|
||||
|
||||
# Initialize the hashtable
|
||||
|
@ -502,7 +502,7 @@
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="Border">
|
||||
<Style x:Key="BorderStyle" TargetType="Border">
|
||||
<Setter Property="Background" Value="{MainBackgroundColor}"/>
|
||||
<Setter Property="BorderBrush" Value="{BorderColor}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
@ -566,6 +566,36 @@
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style TargetType="PasswordBox">
|
||||
<Setter Property="Background" Value="{MainBackgroundColor}"/>
|
||||
<Setter Property="BorderBrush" Value="{MainForegroundColor}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Foreground" Value="{MainForegroundColor}"/>
|
||||
<Setter Property="FontSize" Value="{FontSize}"/>
|
||||
<Setter Property="Padding" Value="5"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="PasswordBox">
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="5">
|
||||
<Grid>
|
||||
<ScrollViewer x:Name="PART_ContentHost" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Effect">
|
||||
<Setter.Value>
|
||||
<DropShadowEffect ShadowDepth="5" BlurRadius="5" Opacity="{BorderOpacity}" Color="{BorderColor}"/>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style x:Key="ScrollVisibilityRectangle" TargetType="Rectangle">
|
||||
<Setter Property="Visibility" Value="Collapsed"/>
|
||||
<Style.Triggers>
|
||||
@ -767,8 +797,7 @@
|
||||
|
||||
<ScrollViewer x:Name="scrollViewer" Grid.Row="1" Grid.Column="0" Padding="-1" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto"
|
||||
BorderBrush="Transparent" BorderThickness="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||
{{InstallPanel_applications}}
|
||||
<Grid Name="appspanel" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
|
||||
@ -777,14 +806,21 @@
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="Tweaks" Visibility="Collapsed" Name="WPFTab2">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<Grid>
|
||||
<!-- Main content area with a ScrollViewer -->
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" Grid.Row="0">
|
||||
<Grid Background="Transparent">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="45px"/>
|
||||
<RowDefinition Height=".70*"/>
|
||||
<RowDefinition Height=".10*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
{{InstallPanel_tweaks}}
|
||||
|
||||
<StackPanel Background="{MainBackgroundColor}" Orientation="Horizontal" HorizontalAlignment="Left" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="5">
|
||||
<Label Content="Recommended Selections:" FontSize="{FontSize}" VerticalAlignment="Center" Margin="2"/>
|
||||
<Button Name="WPFstandard" Content=" Standard " Margin="2"/>
|
||||
@ -792,7 +828,12 @@
|
||||
<Button Name="WPFclear" Content=" Clear " Margin="2"/>
|
||||
<Button Name="WPFGetInstalledTweaks" Content=" Get Installed " Margin="2"/>
|
||||
</StackPanel>
|
||||
<Border Grid.ColumnSpan="2" Grid.Row="2" Grid.Column="0">
|
||||
|
||||
<Grid Name="tweakspanel" Grid.Row="1">
|
||||
<!-- Your tweakspanel content goes here -->
|
||||
</Grid>
|
||||
|
||||
<Border Grid.ColumnSpan="2" Grid.Row="2" Grid.Column="0" Style="{StaticResource BorderStyle}">
|
||||
<StackPanel Background="{MainBackgroundColor}" Orientation="Horizontal" HorizontalAlignment="Left">
|
||||
<TextBlock Padding="10">
|
||||
Note: Hover over items to get a better description. Please be careful as many of these tweaks will heavily modify your system.
|
||||
@ -800,14 +841,13 @@
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="Config" Visibility="Collapsed" Name="WPFTab3">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<Grid Background="Transparent">
|
||||
{{InstallPanel_features}}
|
||||
<Grid Name="featurespanel" Grid.Row="1" Background="Transparent">
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
@ -819,19 +859,19 @@
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border Grid.Row="0" Grid.Column="0">
|
||||
<Border Grid.Row="0" Grid.Column="0" Style="{StaticResource BorderStyle}">
|
||||
<StackPanel Background="{MainBackgroundColor}" SnapsToDevicePixels="True">
|
||||
<Button Name="WPFUpdatesdefault" FontSize="{ConfigTabButtonFontSize}" Height="Auto" Width="Auto" Content="Default (Out of Box) Settings" Margin="20,4,20,10" Padding="10"/>
|
||||
<TextBlock Margin="20,0,20,0" Padding="10" TextWrapping="WrapWithOverflow" MaxWidth="300">This is the default settings that come with Windows. <LineBreak/><LineBreak/> No modifications are made and will remove any custom windows update settings.<LineBreak/><LineBreak/>Note: If you still encounter update errors, reset all updates in the config tab. That will restore ALL Microsoft Update Services from their servers and reinstall them to default settings.</TextBlock>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border Grid.Row="0" Grid.Column="1">
|
||||
<Border Grid.Row="0" Grid.Column="1" Style="{StaticResource BorderStyle}">
|
||||
<StackPanel Background="{MainBackgroundColor}" SnapsToDevicePixels="True">
|
||||
<Button Name="WPFUpdatessecurity" FontSize="{ConfigTabButtonFontSize}" Height="Auto" Width="Auto" Content="Security (Recommended) Settings" Margin="20,4,20,10" Padding="10"/>
|
||||
<TextBlock Margin="20,0,20,0" Padding="10" TextWrapping="WrapWithOverflow" MaxWidth="300">This is my recommended setting I use on all computers.<LineBreak/><LineBreak/> It will delay feature updates by 2 years and will install security updates 4 days after release.<LineBreak/><LineBreak/>Feature Updates: Adds features and often bugs to systems when they are released. You want to delay these as long as possible.<LineBreak/><LineBreak/>Security Updates: Typically these are pressing security flaws that need to be patched quickly. You only want to delay these a couple of days just to see if they are safe and don't break other systems. You don't want to go without these for ANY extended periods of time.</TextBlock>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border Grid.Row="0" Grid.Column="2">
|
||||
<Border Grid.Row="0" Grid.Column="2" Style="{StaticResource BorderStyle}">
|
||||
<StackPanel Background="{MainBackgroundColor}" SnapsToDevicePixels="True">
|
||||
<Button Name="WPFUpdatesdisable" FontSize="{ConfigTabButtonFontSize}" Height="Auto" Width="Auto" Content="Disable ALL Updates (NOT RECOMMENDED!)" Margin="20,4,20,10" Padding="10,10,10,10"/>
|
||||
<TextBlock Margin="20,0,20,0" Padding="10" TextWrapping="WrapWithOverflow" MaxWidth="300">This completely disables ALL Windows Updates and is NOT RECOMMENDED.<LineBreak/><LineBreak/> However, it can be suitable if you use your system for a select purpose and do not actively browse the internet. <LineBreak/><LineBreak/>Note: Your system will be easier to hack and infect without security updates.</TextBlock>
|
||||
@ -852,16 +892,17 @@
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Border Grid.Row="0" Grid.Column="0"
|
||||
Style="{StaticResource BorderStyle}"
|
||||
VerticalAlignment="Stretch"
|
||||
HorizontalAlignment="Stretch">
|
||||
<StackPanel Name="MicrowinMain" Background="{MainBackgroundColor}" SnapsToDevicePixels="True" Grid.Column="0" Grid.Row="0">
|
||||
<StackPanel Background="Transparent" SnapsToDevicePixels="True" Margin="1">
|
||||
<CheckBox x:Name="WPFMicrowinDownloadFromGitHub" Content="Download oscdimg.exe from CTT Github repo" IsChecked="False" Margin="-10,1,1,1" />
|
||||
<CheckBox x:Name="WPFMicrowinDownloadFromGitHub" Content="Download oscdimg.exe from CTT Github repo" IsChecked="False" Margin="{CheckBoxMargin}" />
|
||||
<TextBlock Margin="5" Padding="1" TextWrapping="Wrap" Foreground="{ComboBoxForegroundColor}">
|
||||
Choose a Windows ISO file that you've downloaded <LineBreak/>
|
||||
Check the status in the console
|
||||
</TextBlock>
|
||||
<CheckBox x:Name="WPFMicrowinISOScratchDir" Content="Use ISO directory for ScratchDir " IsChecked="False" Margin="-10,1,1,1"
|
||||
<CheckBox x:Name="WPFMicrowinISOScratchDir" Content="Use ISO directory for ScratchDir " IsChecked="False" Margin="{CheckBoxMargin}"
|
||||
ToolTip="Use ISO directory for ScratchDir " />
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
@ -917,9 +958,26 @@
|
||||
Foreground="{LabelboxForegroundColor}"
|
||||
ToolTip="Path to unpacked drivers all sys and inf files for devices that need drivers"
|
||||
/>
|
||||
<CheckBox Name="MicrowinImportDrivers" Content="Import drivers from current system" Margin="-10,5,0,0" IsChecked="False" ToolTip="Export all third-party drivers from your system and inject them to the MicroWin image"/>
|
||||
<CheckBox Name="MicrowinImportDrivers" Content="Import drivers from current system" Margin="{CheckBoxMargin}" IsChecked="False" ToolTip="Export all third-party drivers from your system and inject them to the MicroWin image"/>
|
||||
<Rectangle Fill="{MainForegroundColor}" Height="2" HorizontalAlignment="Stretch" Margin="0,10,0,10"/>
|
||||
<CheckBox Name="WPFMicrowinCopyToUsb" Content="Copy to Ventoy" Margin="-10,5,0,0" IsChecked="False" ToolTip="Copy to USB disk with a label Ventoy"/>
|
||||
<CheckBox Name="WPFMicrowinCopyToUsb" Content="Copy to Ventoy" Margin="{CheckBoxMargin}" IsChecked="False" ToolTip="Copy to USB disk with a label Ventoy"/>
|
||||
<Rectangle Fill="{MainForegroundColor}" Height="2" HorizontalAlignment="Stretch" Margin="0,10,0,10"/>
|
||||
<TextBlock Margin="6" Padding="1" TextWrapping="Wrap"><Bold>Custom user settings (leave empty for default user)</Bold></TextBlock>
|
||||
<TextBlock Margin="6" Padding="1" TextWrapping="Wrap">User name (20 characters max.):</TextBlock>
|
||||
<TextBox Name="MicrowinUserName" Background="Transparent" BorderThickness="1" BorderBrush="{MainForegroundColor}"
|
||||
Margin="6"
|
||||
Text=""
|
||||
IsReadOnly="False"
|
||||
TextWrapping="Wrap"
|
||||
Foreground="{LabelboxForegroundColor}"
|
||||
MaxLength="20"
|
||||
/>
|
||||
<TextBlock Margin="6" Padding="1" TextWrapping="Wrap">Password (characters will not be shown for your security):</TextBlock>
|
||||
<PasswordBox Name="MicrowinUserPassword" Background="Transparent" BorderThickness="1" BorderBrush="{MainForegroundColor}"
|
||||
Margin="6"
|
||||
PasswordChar="*"
|
||||
Foreground="{LabelboxForegroundColor}"
|
||||
/>
|
||||
<Rectangle Fill="{MainForegroundColor}" Height="2" HorizontalAlignment="Stretch" Margin="0,10,0,10"/>
|
||||
<Button Name="WPFMicrowin" Content="Start the process" Margin="2" Padding="15"/>
|
||||
</StackPanel>
|
||||
@ -932,6 +990,7 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border
|
||||
Style="{StaticResource BorderStyle}"
|
||||
VerticalAlignment="Stretch"
|
||||
HorizontalAlignment="Stretch"
|
||||
Grid.Row="0" Grid.Column="1">
|
||||
@ -968,15 +1027,14 @@
|
||||
Foreground="{ComboBoxForegroundColor}">
|
||||
<Bold>MicroWin features:</Bold><LineBreak/>
|
||||
- Remove Telemetry and Tracking <LineBreak/>
|
||||
- Fast Install using "User" local account <LineBreak/>
|
||||
- Fast Install using either the "User" local account or the account of your choosing <LineBreak/>
|
||||
- No internet requirement for install <LineBreak/>
|
||||
- Apps debloat <LineBreak/>
|
||||
<LineBreak/>
|
||||
<LineBreak/>
|
||||
|
||||
<Bold>INSTRUCTIONS</Bold> <LineBreak/>
|
||||
- Download the latest Windows 11 image from Microsoft <LineBreak/>
|
||||
LINK: https://www.microsoft.com/software-download/windows11 <LineBreak/>
|
||||
- <TextBlock Name="Win11DownloadLink" Style="{StaticResource HoverTextBlockStyle}" ToolTip="https://www.microsoft.com/software-download/windows11">Download</TextBlock> the latest Windows 11 image from Microsoft <LineBreak/>
|
||||
May take several minutes to process the ISO depending on your machine and connection <LineBreak/>
|
||||
- Put it somewhere on the C:\ drive so it is easily accessible <LineBreak/>
|
||||
- Launch WinUtil and MicroWin <LineBreak/>
|
||||
|
Reference in New Issue
Block a user