mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-07-01 10:32:35 -05:00
Compare commits
46 Commits
revert-270
...
24.10.01
Author | SHA1 | Date | |
---|---|---|---|
d92284ec83 | |||
d855b08119 | |||
0deac4ebb2 | |||
c6fcf21dce | |||
64ed00c2db | |||
e165388117 | |||
806cbd021a | |||
869071783c | |||
ae74965548 | |||
b43d31088c | |||
4fa1b0ddc7 | |||
f012064574 | |||
db26666f97 | |||
38cf922572 | |||
dd337be45e | |||
3670c78789 | |||
225e774f1e | |||
0703935bfb | |||
fd2ac35228 | |||
f516c09ab3 | |||
182fe09b64 | |||
02751c706d | |||
102231c0e3 | |||
b9d7619f9b | |||
4e39096b51 | |||
662139ca5f | |||
42febae25e | |||
395ac9495d | |||
6cc7d314fe | |||
ba45c3303e | |||
1f683d3f78 | |||
18dff2af5e | |||
377758758e | |||
3f2759f967 | |||
1ee7274bdb | |||
06baebc60b | |||
10917c159c | |||
0251757fc0 | |||
9136ed9802 | |||
b3bbe0dbe5 | |||
16b11e994b | |||
a5a06c2a9b | |||
81aead7a68 | |||
a55a44a54c | |||
9c0b0b8913 | |||
7fe0f9a163 |
117
.github/CONTRIBUTING.md
vendored
117
.github/CONTRIBUTING.md
vendored
@ -1,117 +0,0 @@
|
|||||||
# How to Contribute?
|
|
||||||
|
|
||||||
## Testing
|
|
||||||
|
|
||||||
* Test the latest changes to WinUtil by running the pre-release and reporting issues you are encountering to help us continually improve WinUtil!
|
|
||||||
|
|
||||||
#### **Run the latest pre-release**
|
|
||||||
```ps1
|
|
||||||
irm christitus.com/windev | iex
|
|
||||||
```
|
|
||||||
|
|
||||||
!!! bug "Keep in mind"
|
|
||||||
|
|
||||||
This is a pre-release and should be treated as such. It exists for developers to test the utility and report or fix bugs before they get added to the stable release. Don't use it in production!
|
|
||||||
|
|
||||||
## Issues
|
|
||||||
|
|
||||||
* If you encounter any challenges or problems with the script, I kindly request that you submit them via the "Issues" tab on the GitHub repository. By filling out the provided template, you can provide specific details about the issue, allowing me (and others in the community) to promptly address any bugs or consider feature requests.
|
|
||||||
|
|
||||||
## Contribute Code
|
|
||||||
|
|
||||||
* Pull requests are now handled directly on the **MAIN branch**. This was done since we can now select specific releases to launch via releases in GitHub.
|
|
||||||
|
|
||||||
* If you're doing code changes, then you can submit a PR to `main` branch, but I am very selective about these.
|
|
||||||
|
|
||||||
!!! warning "Important"
|
|
||||||
|
|
||||||
Do not use a code formatter, make massive amounts of line changes, or make multiple feature changes. EACH FEATURE CHANGE SHOULD BE IT'S OWN PULL REQUEST!
|
|
||||||
|
|
||||||
* When creating pull requests, it is essential to thoroughly document all changes made. This includes, but is not limited to, documenting any additions made to the `tweaks` section and corresponding `undo tweak`, so users are able to remove the newly added tweaks if necessary, and comprehensive documentation is required for all code changes. Document your changes and briefly explain why you made your changes in your Pull Request Description. Failure to adhere to this format may result in the denial of the pull request. Additionally, any code lacking sufficient documentation may also be denied.
|
|
||||||
|
|
||||||
* By following these guidelines, we can maintain a high standard of quality and ensure that the codebase remains organized and well-documented.
|
|
||||||
|
|
||||||
!!! note
|
|
||||||
|
|
||||||
When creating a function, please include "WPF" or "WinUtil" in the file name so it can be loaded into the runspace.
|
|
||||||
|
|
||||||
## Walk through
|
|
||||||
|
|
||||||
* This is a guide for beginners. If you are still having issues, look at the following official GitHub documentation:
|
|
||||||
* [Commit through WEB](https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/about-commits)
|
|
||||||
* [Commit through GitHub Desktop](https://docs.github.com/en/desktop/making-changes-in-a-branch/committing-and-reviewing-changes-to-your-project-in-github-desktop#about-commits)
|
|
||||||
* [Create a Pull Request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request)
|
|
||||||
|
|
||||||
|
|
||||||
### Overview
|
|
||||||
|
|
||||||
``` mermaid
|
|
||||||
%%{init: {"flowchart": {"curve": "cardinal"}} }%%
|
|
||||||
graph TD
|
|
||||||
A[Fork Project] --> B[Clone Repository];
|
|
||||||
B --> C[Create New Branch];
|
|
||||||
C --> D[Make Changes];
|
|
||||||
D --> G[Test Changes];
|
|
||||||
G --> H{Tests Passed?};
|
|
||||||
H -->|Yes| E[Commit Changes];
|
|
||||||
H -->|No| J[Fix Issues];
|
|
||||||
J --> G;
|
|
||||||
E --> F[Push Branch];
|
|
||||||
F --> K[Create Pull Request];
|
|
||||||
K --> L[Fill out PR template];
|
|
||||||
classDef default stroke:#333,stroke-width:4px,font-size:12pt;
|
|
||||||
```
|
|
||||||
!!! info
|
|
||||||
|
|
||||||
This is a diagram to guide you through the process. It may vary depending on the type of change you're making.
|
|
||||||
|
|
||||||
### Fork the Repo
|
|
||||||
* Fork the WinUtil Repository [here](https://github.com/ChrisTitusTech/winutil) to create a copy that will be available in your repository list.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### Clone the Fork
|
|
||||||
!!! tip
|
|
||||||
|
|
||||||
While you can make your changes directly through the Web, we recommend cloning the repo to your device using the application GitHub Desktop (available in WinUtil) to test your fork easily.
|
|
||||||
|
|
||||||
* Install GitHub Desktop if it is not already installed.
|
|
||||||
* Log in using the same GitHub account you used to fork WinUtil.
|
|
||||||
* Choose the fork under "Your Repositories" and press "clone {repo name}"
|
|
||||||
* Create a new branch and name it something relatable to your changes.
|
|
||||||
|
|
||||||
* Now you can modify WinUtil to your liking using your preferred text editor.
|
|
||||||
|
|
||||||
|
|
||||||
### Testing your changes
|
|
||||||
|
|
||||||
* To test to see if your changes work as intended run following commands in a powershell teminal as admin:
|
|
||||||
|
|
||||||
* Change the directory where you are running the commands to the forked project.
|
|
||||||
* `cd {path to the folder with the compile.ps1}`
|
|
||||||
* Run the following command to compile and run WinUtil:
|
|
||||||
* `.\Compile.ps1 -run`
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
* After seeing that your changes work properly, feel free to commit the changes to the repository and make a PR. For help on that, follow the documentation below.
|
|
||||||
|
|
||||||
### Committing the changes
|
|
||||||
* Before committing your changes, please discard changes made to the `winutil.ps1` file, like the following:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
* Now, commit your changes once you are happy with the result.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
* Push the changes to upload them to your fork on github.com.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### Making a PR
|
|
||||||
* To make a PR on your repo under a new branch linking to the main branch, a button will show and say Preview and Create pull request. Click that button and fill in all the information that is provided on the template. Once all the information is filled in correctly, check your PR to make sure there is not a WinUtil.ps1 file attached to the PR. Once everything is good, make the PR and wait for Chris (the maintainer) to accept or deny your PR. Once it is accepted by Chris, you will be able to see your changes in the "/windev" build.
|
|
||||||
* If you do not see your feature in the main "/win" build, that is fine. All new changes go into the /windev build to make sure everything is working OK before going fully public.
|
|
||||||
* Congratulations! You just submitted your first PR. Thank you so much for contributing to WinUtil.
|
|
3
.github/mkdocs.yml
vendored
3
.github/mkdocs.yml
vendored
@ -11,6 +11,9 @@ nav:
|
|||||||
- Known Issues: 'KnownIssues.md'
|
- Known Issues: 'KnownIssues.md'
|
||||||
- FAQ: 'faq.md'
|
- FAQ: 'faq.md'
|
||||||
|
|
||||||
|
not_in_nav: |
|
||||||
|
dev/
|
||||||
|
|
||||||
theme:
|
theme:
|
||||||
name: material
|
name: material
|
||||||
custom_dir: '../overrides'
|
custom_dir: '../overrides'
|
||||||
|
4
.github/release-drafter.yml
vendored
4
.github/release-drafter.yml
vendored
@ -19,10 +19,6 @@ template: |
|
|||||||
|
|
||||||
$CHANGES
|
$CHANGES
|
||||||
|
|
||||||
## Contributors
|
|
||||||
|
|
||||||
$CONTRIBUTORS
|
|
||||||
|
|
||||||
change-title-escapes: '\<*_&"'''
|
change-title-escapes: '\<*_&"'''
|
||||||
autolabeler:
|
autolabeler:
|
||||||
- label: 'documentation'
|
- label: 'documentation'
|
||||||
|
40
.github/workflows/close-issue-command.yaml
vendored
40
.github/workflows/close-issue-command.yaml
vendored
@ -15,18 +15,33 @@ jobs:
|
|||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check for /close comment
|
- run: echo "command=false" >> $GITHUB_ENV
|
||||||
id: check_comment
|
|
||||||
|
- name: Check for /close command
|
||||||
|
id: check_close_command
|
||||||
run: |
|
run: |
|
||||||
if [[ "${{ contains(github.event.comment.body, '/close') }}" == "true" ]]; then
|
if [[ "${{ contains(github.event.comment.body, '/close') }}" == "true" ]]; then
|
||||||
echo "comment=true" >> $GITHUB_ENV
|
echo "command=true" >> $GITHUB_ENV
|
||||||
|
echo "close_command=true" >> $GITHUB_ENV
|
||||||
|
echo "reopen_command=false" >> $GITHUB_ENV
|
||||||
else
|
else
|
||||||
echo "comment=false" >> $GITHUB_ENV
|
echo "close_command=false" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Check for /open or /reopen command
|
||||||
|
id: check_reopen_command
|
||||||
|
run: |
|
||||||
|
if [[ "${{ contains(github.event.comment.body, '/open') }}" == "true" ]] || [[ "${{ contains(github.event.comment.body, '/reopen') }}" == "true" ]]; then
|
||||||
|
echo "command=true" >> $GITHUB_ENV
|
||||||
|
echo "reopen_command=true" >> $GITHUB_ENV
|
||||||
|
echo "close_command=false" >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo "reopen_command=false" >> $GITHUB_ENV
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Check if the user is allowed
|
- name: Check if the user is allowed
|
||||||
id: check_user
|
id: check_user
|
||||||
if: env.comment == 'true'
|
if: env.command == 'true'
|
||||||
run: |
|
run: |
|
||||||
ALLOWED_USERS=("ChrisTitusTech" "og-mrk" "Marterich" "MyDrift-user" "Real-MullaC")
|
ALLOWED_USERS=("ChrisTitusTech" "og-mrk" "Marterich" "MyDrift-user" "Real-MullaC")
|
||||||
if [[ " ${ALLOWED_USERS[@]} " =~ " ${{ github.event.comment.user.login }} " ]]; then
|
if [[ " ${ALLOWED_USERS[@]} " =~ " ${{ github.event.comment.user.login }} " ]]; then
|
||||||
@ -36,10 +51,23 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Close issue if conditions are met
|
- name: Close issue if conditions are met
|
||||||
if: env.comment == 'true' && env.user == 'true'
|
if: env.close_command == 'true' && env.user == 'true'
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
ISSUE_NUMBER: ${{ github.event.issue.number }}
|
ISSUE_NUMBER: ${{ github.event.issue.number }}
|
||||||
run: |
|
run: |
|
||||||
echo Closing the issue...
|
echo Closing the issue...
|
||||||
|
if [[ "${{ contains(github.event.comment.body, 'not planned') }}" == "true" ]]; then
|
||||||
|
gh issue close $ISSUE_NUMBER --repo ${{ github.repository }} --reason 'not planned'
|
||||||
|
else
|
||||||
gh issue close $ISSUE_NUMBER --repo ${{ github.repository }}
|
gh issue close $ISSUE_NUMBER --repo ${{ github.repository }}
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Reopen issue if conditions are met
|
||||||
|
if: env.reopen_command == 'true' && env.user == 'true'
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
ISSUE_NUMBER: ${{ github.event.issue.number }}
|
||||||
|
run: |
|
||||||
|
echo Reopening the issue...
|
||||||
|
gh issue reopen $ISSUE_NUMBER --repo ${{ github.repository }}
|
||||||
|
15
Compile.ps1
15
Compile.ps1
@ -73,8 +73,8 @@ Get-ChildItem "functions" -Recurse -File | ForEach-Object {
|
|||||||
}
|
}
|
||||||
Update-Progress "Adding: Config *.json" 40
|
Update-Progress "Adding: Config *.json" 40
|
||||||
Get-ChildItem "config" | Where-Object {$psitem.extension -eq ".json"} | ForEach-Object {
|
Get-ChildItem "config" | Where-Object {$psitem.extension -eq ".json"} | ForEach-Object {
|
||||||
$json = (Get-Content $psitem.FullName).replace("'","''")
|
$json = (Get-Content $psitem.FullName -Raw)
|
||||||
$jsonAsObject = $json | convertfrom-json
|
$jsonAsObject = $json | ConvertFrom-Json
|
||||||
|
|
||||||
# Add 'WPFInstall' as a prefix to every entry-name in 'applications.json' file
|
# Add 'WPFInstall' as a prefix to every entry-name in 'applications.json' file
|
||||||
if ($psitem.Name -eq "applications.json") {
|
if ($psitem.Name -eq "applications.json") {
|
||||||
@ -85,12 +85,13 @@ Get-ChildItem "config" | Where-Object {$psitem.extension -eq ".json"} | ForEach-
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# The replace at the end is required, as without it the output of 'converto-json' will be somewhat weird for Multiline Strings
|
# Line 90 requires no whitespace inside the here-strings, to keep formatting of the JSON in the final script.
|
||||||
# Most Notably is the scripts in some json files, making it harder for users who want to review these scripts, which're found in the compiled script
|
$json = @"
|
||||||
$json = ($jsonAsObject | convertto-json -Depth 3).replace('\r\n',"`r`n")
|
$($jsonAsObject | ConvertTo-Json -Depth 3)
|
||||||
|
"@
|
||||||
|
|
||||||
$sync.configs.$($psitem.BaseName) = $json | convertfrom-json
|
$sync.configs.$($psitem.BaseName) = $json | ConvertFrom-Json
|
||||||
$script_content.Add($(Write-output "`$sync.configs.$($psitem.BaseName) = '$json' `| convertfrom-json" ))
|
$script_content.Add($(Write-Output "`$sync.configs.$($psitem.BaseName) = @'`n$json`n'@ `| ConvertFrom-Json" ))
|
||||||
}
|
}
|
||||||
|
|
||||||
# Read the entire XAML file as a single string, preserving line breaks
|
# Read the entire XAML file as a single string, preserving line breaks
|
||||||
|
@ -2855,14 +2855,6 @@
|
|||||||
"link": "https://www.kicad.org/",
|
"link": "https://www.kicad.org/",
|
||||||
"winget": "KiCad.KiCad"
|
"winget": "KiCad.KiCad"
|
||||||
},
|
},
|
||||||
"FormatFactory": {
|
|
||||||
"category": "Utilities",
|
|
||||||
"choco": "formatfactory",
|
|
||||||
"content": "Format Factory",
|
|
||||||
"description":"FormatFactory is an ad-supported freeware multimedia converter that can convert video, audio, and picture files. It is also capable of ripping DVDs and CDs to other file formats, as well as creating .iso images. It can also join multiple video files together into one.",
|
|
||||||
"link": "http://www.pcfreetime.com/formatfactory/",
|
|
||||||
"winget": "na"
|
|
||||||
},
|
|
||||||
"dropox": {
|
"dropox": {
|
||||||
"category": "Utilities",
|
"category": "Utilities",
|
||||||
"choco": "na",
|
"choco": "na",
|
||||||
|
@ -46,5 +46,23 @@
|
|||||||
"Secondary": "94.140.15.16",
|
"Secondary": "94.140.15.16",
|
||||||
"Primary6": "2a10:50c0::bad1:ff",
|
"Primary6": "2a10:50c0::bad1:ff",
|
||||||
"Secondary6": "2a10:50c0::bad2:ff"
|
"Secondary6": "2a10:50c0::bad2:ff"
|
||||||
|
},
|
||||||
|
"dns0.eu_Open":{
|
||||||
|
"Primary": "193.110.81.254",
|
||||||
|
"Secondary": "185.253.5.254",
|
||||||
|
"Primary6": "2a0f:fc80::ffff",
|
||||||
|
"Secondary6": "2a0f:fc81::ffff"
|
||||||
|
},
|
||||||
|
"dns0.eu_ZERO":{
|
||||||
|
"Primary": "193.110.81.9",
|
||||||
|
"Secondary": "185.253.5.9",
|
||||||
|
"Primary6": "2a0f:fc80::9",
|
||||||
|
"Secondary6": "2a0f:fc81::9"
|
||||||
|
},
|
||||||
|
"dns0.eu_KIDS":{
|
||||||
|
"Primary": "193.110.81.1",
|
||||||
|
"Secondary": "185.253.5.1",
|
||||||
|
"Primary6": "2a0f:fc80::1",
|
||||||
|
"Secondary6": "2a0f:fc81::1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -313,5 +313,13 @@
|
|||||||
"Order": "a083_",
|
"Order": "a083_",
|
||||||
"Type": "Button",
|
"Type": "Button",
|
||||||
"ButtonWidth": "300"
|
"ButtonWidth": "300"
|
||||||
}
|
},
|
||||||
|
"WPFWinUtilSSHServer": {
|
||||||
|
"Content": "Enable OpenSSH Server",
|
||||||
|
"category": "Remote Access",
|
||||||
|
"panel": "2",
|
||||||
|
"Order": "a084_",
|
||||||
|
"Type": "Button",
|
||||||
|
"ButtonWidth": "300"
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
@ -1,81 +1,44 @@
|
|||||||
{
|
{
|
||||||
"_default": {
|
"shared":{
|
||||||
"CustomDialogFontSize": "12",
|
"CustomDialogFontSize": "12",
|
||||||
"CustomDialogFontSizeHeader": "14",
|
"CustomDialogFontSizeHeader": "14",
|
||||||
"CustomDialogIconSize": "25",
|
"CustomDialogIconSize": "25",
|
||||||
"CustomDialogWidth": "400",
|
"CustomDialogWidth": "400",
|
||||||
"CustomDialogHeight": "200",
|
"CustomDialogHeight": "200",
|
||||||
|
|
||||||
"FontSize": "12",
|
"FontSize": "12",
|
||||||
"FontFamily": "Arial",
|
"FontFamily": "Arial",
|
||||||
"FontSizeHeading": "16",
|
"FontSizeHeading": "16",
|
||||||
"HeaderFontFamily": "Consolas, Monaco",
|
"HeaderFontFamily": "Consolas, Monaco",
|
||||||
|
|
||||||
"CheckBoxBulletDecoratorSize": "14",
|
"CheckBoxBulletDecoratorSize": "14",
|
||||||
"CheckBoxMargin": "15,0,0,2",
|
"CheckBoxMargin": "15,0,0,2",
|
||||||
|
|
||||||
"TabContentMargin": "5",
|
"TabContentMargin": "5",
|
||||||
"TabButtonFontSize": "14",
|
"TabButtonFontSize": "14",
|
||||||
"TabButtonWidth": "100",
|
"TabButtonWidth": "110",
|
||||||
"TabButtonHeight": "25",
|
"TabButtonHeight": "26",
|
||||||
"TabRowHeightInPixels": "50",
|
"TabRowHeightInPixels": "50",
|
||||||
"IconFontSize": "14",
|
"IconFontSize": "14",
|
||||||
"IconButtonSize": "35",
|
"IconButtonSize": "35",
|
||||||
"SettingsIconFontSize": "18",
|
"SettingsIconFontSize": "18",
|
||||||
"CloseIconFontSize": "18",
|
"CloseIconFontSize": "18",
|
||||||
|
|
||||||
"MicroWinLogoSize": "10",
|
"MicroWinLogoSize": "10",
|
||||||
"MicrowinCheckBoxMargin": "-10,5,0,0",
|
"MicrowinCheckBoxMargin": "-10,5,0,0",
|
||||||
|
|
||||||
"ProgressBarForegroundColor": "#2e77ff",
|
|
||||||
"ProgressBarBackgroundColor": "Transparent",
|
|
||||||
"ProgressBarTextColor": "#232629",
|
|
||||||
|
|
||||||
"ComboBoxBackgroundColor": "#F7F7F7",
|
|
||||||
"LabelboxForegroundColor": "#232629",
|
|
||||||
"MainForegroundColor": "#232629",
|
|
||||||
"MainBackgroundColor": "#F7F7F7",
|
|
||||||
"LabelBackgroundColor": "#F7F7F7",
|
|
||||||
"LinkForegroundColor": "#232629",
|
|
||||||
"LinkHoverForegroundColor": "#232629",
|
|
||||||
"GroupBorderBackgroundColor": "#232629",
|
"GroupBorderBackgroundColor": "#232629",
|
||||||
"ComboBoxForegroundColor": "#232629",
|
|
||||||
|
|
||||||
"ButtonFontSize": "12",
|
"ButtonFontSize": "12",
|
||||||
"ButtonFontFamily": "Arial",
|
"ButtonFontFamily": "Arial",
|
||||||
"ButtonWidth": "200",
|
"ButtonWidth": "200",
|
||||||
"ButtonHeight": "25",
|
"ButtonHeight": "25",
|
||||||
"ConfigTabButtonFontSize": "16",
|
"ConfigTabButtonFontSize": "16",
|
||||||
|
|
||||||
"SearchBarWidth": "200",
|
"SearchBarWidth": "200",
|
||||||
"SearchBarHeight": "25",
|
"SearchBarHeight": "26",
|
||||||
"SearchBarTextBoxFontSize": "12",
|
"SearchBarTextBoxFontSize": "12",
|
||||||
"SearchBarClearButtonFontSize": "14",
|
"SearchBarClearButtonFontSize": "14",
|
||||||
|
|
||||||
"ButtonInstallBackgroundColor": "#F7F7F7",
|
|
||||||
"ButtonTweaksBackgroundColor": "#F7F7F7",
|
|
||||||
"ButtonConfigBackgroundColor": "#F7F7F7",
|
|
||||||
"ButtonUpdatesBackgroundColor": "#F7F7F7",
|
|
||||||
"ButtonInstallForegroundColor": "#232629",
|
|
||||||
"ButtonTweaksForegroundColor": "#232629",
|
|
||||||
"ButtonConfigForegroundColor": "#232629",
|
|
||||||
"ButtonUpdatesForegroundColor": "#232629",
|
|
||||||
"ButtonBackgroundColor": "#F5F5F5",
|
|
||||||
"ButtonBackgroundPressedColor": "#1A1A1A",
|
|
||||||
"CheckboxMouseOverColor": "#999999",
|
"CheckboxMouseOverColor": "#999999",
|
||||||
"ButtonBackgroundMouseoverColor": "#C2C2C2",
|
|
||||||
"ButtonBackgroundSelectedColor": "#F0F0F0",
|
|
||||||
"ButtonForegroundColor": "#232629",
|
|
||||||
"ToggleButtonOnColor": "#2e77ff",
|
|
||||||
|
|
||||||
"ButtonBorderThickness": "1",
|
"ButtonBorderThickness": "1",
|
||||||
"ButtonMargin": "1",
|
"ButtonMargin": "1",
|
||||||
"ButtonCornerRadius": "2",
|
"ButtonCornerRadius": "2"
|
||||||
"BorderColor": "#232629",
|
|
||||||
"BorderOpacity": "0.2",
|
|
||||||
"ShadowPulse": "Forever"
|
|
||||||
},
|
},
|
||||||
"Classic": {
|
"Light": {
|
||||||
|
"ComboBoxForegroundColor": "#232629",
|
||||||
"ComboBoxBackgroundColor": "#F7F7F7",
|
"ComboBoxBackgroundColor": "#F7F7F7",
|
||||||
"LabelboxForegroundColor": "#232629",
|
"LabelboxForegroundColor": "#232629",
|
||||||
"MainForegroundColor": "#232629",
|
"MainForegroundColor": "#232629",
|
||||||
@ -83,9 +46,13 @@
|
|||||||
"LabelBackgroundColor": "#F7F7F7",
|
"LabelBackgroundColor": "#F7F7F7",
|
||||||
"LinkForegroundColor": "#232629",
|
"LinkForegroundColor": "#232629",
|
||||||
"LinkHoverForegroundColor": "#232629",
|
"LinkHoverForegroundColor": "#232629",
|
||||||
"GroupBorderBackgroundColor": "#232629",
|
"ScrollBarBackgroundColor": "#4A4D52",
|
||||||
"ComboBoxForegroundColor": "#232629",
|
"ScrollBarHoverColor": "#5A5D62",
|
||||||
|
"ScrollBarDraggingColor": "#6A6D72",
|
||||||
|
|
||||||
|
"ProgressBarForegroundColor": "#2e77ff",
|
||||||
|
"ProgressBarBackgroundColor": "Transparent",
|
||||||
|
"ProgressBarTextColor": "#232629",
|
||||||
"ButtonInstallBackgroundColor": "#F7F7F7",
|
"ButtonInstallBackgroundColor": "#F7F7F7",
|
||||||
"ButtonTweaksBackgroundColor": "#F7F7F7",
|
"ButtonTweaksBackgroundColor": "#F7F7F7",
|
||||||
"ButtonConfigBackgroundColor": "#F7F7F7",
|
"ButtonConfigBackgroundColor": "#F7F7F7",
|
||||||
@ -96,26 +63,31 @@
|
|||||||
"ButtonUpdatesForegroundColor": "#232629",
|
"ButtonUpdatesForegroundColor": "#232629",
|
||||||
"ButtonBackgroundColor": "#F5F5F5",
|
"ButtonBackgroundColor": "#F5F5F5",
|
||||||
"ButtonBackgroundPressedColor": "#1A1A1A",
|
"ButtonBackgroundPressedColor": "#1A1A1A",
|
||||||
"CheckboxMouseOverColor": "#999999",
|
|
||||||
"ButtonBackgroundMouseoverColor": "#C2C2C2",
|
"ButtonBackgroundMouseoverColor": "#C2C2C2",
|
||||||
"ButtonBackgroundSelectedColor": "#F0F0F0",
|
"ButtonBackgroundSelectedColor": "#F0F0F0",
|
||||||
"ButtonForegroundColor": "#232629",
|
"ButtonForegroundColor": "#232629",
|
||||||
"ToggleButtonOnColor": "#2e77ff"
|
"ToggleButtonOnColor": "#2e77ff",
|
||||||
|
"ToggleButtonOffColor": "#707070",
|
||||||
|
"BorderColor": "#232629",
|
||||||
|
"BorderOpacity": "0.2"
|
||||||
|
|
||||||
},
|
},
|
||||||
"Matrix": {
|
"Dark": {
|
||||||
"ComboBoxBackgroundColor": "#232629",
|
"ComboBoxForegroundColor": "#F7F7F7",
|
||||||
"LabelboxForegroundColor": "#81a1c1",
|
"ComboBoxBackgroundColor": "#1E3747",
|
||||||
|
"LabelboxForegroundColor": "#0567ff",
|
||||||
"MainForegroundColor": "#F7F7F7",
|
"MainForegroundColor": "#F7F7F7",
|
||||||
"MainBackgroundColor": "#232629",
|
"MainBackgroundColor": "#232629",
|
||||||
"LabelBackgroundColor": "#232629",
|
"LabelBackgroundColor": "#232629",
|
||||||
"LinkForegroundColor": "#add8e6",
|
"LinkForegroundColor": "#add8e6",
|
||||||
"LinkHoverForegroundColor": "#F7F7F7",
|
"LinkHoverForegroundColor": "#F7F7F7",
|
||||||
"ComboBoxForegroundColor": "#81a1c1",
|
"ScrollBarBackgroundColor": "#2E3135",
|
||||||
|
"ScrollBarHoverColor": "#3B4252",
|
||||||
|
"ScrollBarDraggingColor": "#5E81AC",
|
||||||
|
|
||||||
"ProgressBarForegroundColor": "#222222",
|
"ProgressBarForegroundColor": "#222222",
|
||||||
"ProgressBarBackgroundColor": "Transparent",
|
"ProgressBarBackgroundColor": "Transparent",
|
||||||
"ProgressBarTextColor": "#cccccc",
|
"ProgressBarTextColor": "#cccccc",
|
||||||
|
|
||||||
"ButtonInstallBackgroundColor": "#222222",
|
"ButtonInstallBackgroundColor": "#222222",
|
||||||
"ButtonTweaksBackgroundColor": "#333333",
|
"ButtonTweaksBackgroundColor": "#333333",
|
||||||
"ButtonConfigBackgroundColor": "#444444",
|
"ButtonConfigBackgroundColor": "#444444",
|
||||||
@ -130,40 +102,8 @@
|
|||||||
"ButtonBackgroundSelectedColor": "#5E81AC",
|
"ButtonBackgroundSelectedColor": "#5E81AC",
|
||||||
"ButtonForegroundColor": "#F7F7F7",
|
"ButtonForegroundColor": "#F7F7F7",
|
||||||
"ToggleButtonOnColor": "#2e77ff",
|
"ToggleButtonOnColor": "#2e77ff",
|
||||||
|
"ToggleButtonOffColor": "#707070",
|
||||||
"BorderColor": "#0060CC",
|
"BorderColor": "#2F373D",
|
||||||
"BorderOpacity": "0.2",
|
"BorderOpacity": "0.2"
|
||||||
"ShadowPulse": "0:0:3"
|
|
||||||
},
|
|
||||||
"Dark": {
|
|
||||||
"ComboBoxBackgroundColor": "#232629",
|
|
||||||
"LabelboxForegroundColor": "#81a1c1",
|
|
||||||
"MainForegroundColor": "#F7F7F7",
|
|
||||||
"MainBackgroundColor": "#232629",
|
|
||||||
"LabelBackgroundColor": "#232629",
|
|
||||||
"LinkForegroundColor": "#add8e6",
|
|
||||||
"LinkHoverForegroundColor": "#F7F7F7",
|
|
||||||
"ComboBoxForegroundColor": "#81a1c1",
|
|
||||||
|
|
||||||
"ProgressBarForegroundColor": "#222222",
|
|
||||||
"ProgressBarBackgroundColor": "Transparent",
|
|
||||||
"ProgressBarTextColor": "#cccccc",
|
|
||||||
|
|
||||||
"ButtonInstallBackgroundColor": "#222222",
|
|
||||||
"ButtonTweaksBackgroundColor": "#333333",
|
|
||||||
"ButtonConfigBackgroundColor": "#444444",
|
|
||||||
"ButtonUpdatesBackgroundColor": "#555555",
|
|
||||||
"ButtonInstallForegroundColor": "#F7F7F7",
|
|
||||||
"ButtonTweaksForegroundColor": "#F7F7F7",
|
|
||||||
"ButtonConfigForegroundColor": "#F7F7F7",
|
|
||||||
"ButtonUpdatesForegroundColor": "#F7F7F7",
|
|
||||||
"ButtonBackgroundColor": "#1E3747",
|
|
||||||
"ButtonBackgroundPressedColor": "#00CFFF",
|
|
||||||
"ButtonBackgroundMouseoverColor": "#5E81AC",
|
|
||||||
"ButtonBackgroundSelectedColor": "#5E81AC",
|
|
||||||
"ButtonForegroundColor": "#F7F7F7",
|
|
||||||
"ToggleButtonOnColor": "#2e77ff",
|
|
||||||
|
|
||||||
"BorderColor": "#0b1215"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1600,13 +1600,6 @@
|
|||||||
"Value": "0",
|
"Value": "0",
|
||||||
"OriginalValue": "1"
|
"OriginalValue": "1"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
|
|
||||||
"Name": "EdgeEnhanceImagesEnabled",
|
|
||||||
"Type": "DWord",
|
|
||||||
"Value": "0",
|
|
||||||
"OriginalValue": "1"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
|
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
|
||||||
"Name": "PersonalizationReportingEnabled",
|
"Name": "PersonalizationReportingEnabled",
|
||||||
@ -1656,13 +1649,6 @@
|
|||||||
"Value": "0",
|
"Value": "0",
|
||||||
"OriginalValue": "1"
|
"OriginalValue": "1"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
|
|
||||||
"Name": "EdgeFollowEnabled",
|
|
||||||
"Type": "DWord",
|
|
||||||
"Value": "0",
|
|
||||||
"OriginalValue": "1"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
|
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
|
||||||
"Name": "EdgeShoppingAssistantEnabled",
|
"Name": "EdgeShoppingAssistantEnabled",
|
||||||
@ -1726,13 +1712,6 @@
|
|||||||
"Value": "0",
|
"Value": "0",
|
||||||
"OriginalValue": "1"
|
"OriginalValue": "1"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
|
|
||||||
"Name": "ConfigureDoNotTrack",
|
|
||||||
"Type": "DWord",
|
|
||||||
"Value": "1",
|
|
||||||
"OriginalValue": "0"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
|
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
|
||||||
"Name": "WalletDonationEnabled",
|
"Name": "WalletDonationEnabled",
|
||||||
@ -2430,12 +2409,6 @@
|
|||||||
"Order": "a001_",
|
"Order": "a001_",
|
||||||
"InvokeScript": [
|
"InvokeScript": [
|
||||||
"
|
"
|
||||||
# Check if the user has administrative privileges
|
|
||||||
if (-Not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
|
|
||||||
Write-Host \"Please run this script as an administrator.\"
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
# Check if System Restore is enabled for the main drive
|
# Check if System Restore is enabled for the main drive
|
||||||
try {
|
try {
|
||||||
# Try getting restore points to check if System Restore is enabled
|
# Try getting restore points to check if System Restore is enabled
|
||||||
@ -2767,6 +2740,48 @@
|
|||||||
],
|
],
|
||||||
"link": "https://christitustech.github.io/winutil/dev/tweaks/z--Advanced-Tweaks---CAUTION/RemoveOnedrive"
|
"link": "https://christitustech.github.io/winutil/dev/tweaks/z--Advanced-Tweaks---CAUTION/RemoveOnedrive"
|
||||||
},
|
},
|
||||||
|
"WPFTweaksRazerBlock": {
|
||||||
|
"Content": "Block Razer Software Installs",
|
||||||
|
"Description": "Blocks ALL Razer Software installations. The hardware works fine without any software.",
|
||||||
|
"category": "z__Advanced Tweaks - CAUTION",
|
||||||
|
"panel": "1",
|
||||||
|
"Order": "a031_",
|
||||||
|
"registry": [
|
||||||
|
{
|
||||||
|
"Path": "HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\DriverSearching",
|
||||||
|
"Name": "SearchOrderConfig",
|
||||||
|
"Value": "0",
|
||||||
|
"OriginalValue": "1",
|
||||||
|
"Type": "DWord"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Path": "HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Device Installer",
|
||||||
|
"Name": "DisableCoInstallers",
|
||||||
|
"Value": "1",
|
||||||
|
"OriginalValue": "0",
|
||||||
|
"Type": "DWord"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"InvokeScript": [
|
||||||
|
"
|
||||||
|
$RazerPath = \"C:\\Windows\\Installer\\Razer\"
|
||||||
|
Remove-Item $RazerPath -Recurse -Force
|
||||||
|
New-Item -Path \"C:\\Windows\\Installer\\\" -Name \"Razer\" -ItemType \"directory\"
|
||||||
|
$Acl = Get-Acl $RazerPath
|
||||||
|
$Ar = New-Object System.Security.AccessControl.FileSystemAccessRule(\"NT AUTHORITY\\SYSTEM\",\"Write\",\"ContainerInherit,ObjectInherit\",\"None\",\"Deny\")
|
||||||
|
$Acl.SetAccessRule($Ar)
|
||||||
|
Set-Acl $RazerPath $Acl
|
||||||
|
"
|
||||||
|
],
|
||||||
|
"UndoScript": [
|
||||||
|
"
|
||||||
|
$RazerPath = \"C:\\Windows\\Installer\\Razer\"
|
||||||
|
Remove-Item $RazerPath -Recurse -Force
|
||||||
|
New-Item -Path \"C:\\Windows\\Installer\\\" -Name \"Razer\" -ItemType \"directory\"
|
||||||
|
"
|
||||||
|
],
|
||||||
|
"link": "https://christitustech.github.io/winutil/dev/tweaks/Essential-Tweaks/RazerBlock"
|
||||||
|
},
|
||||||
"WPFTweaksDisableNotifications": {
|
"WPFTweaksDisableNotifications": {
|
||||||
"Content": "Disable Notification Tray/Calendar",
|
"Content": "Disable Notification Tray/Calendar",
|
||||||
"Description": "Disables all Notifications INCLUDING Calendar",
|
"Description": "Disables all Notifications INCLUDING Calendar",
|
||||||
@ -3399,7 +3414,7 @@
|
|||||||
"panel": "1",
|
"panel": "1",
|
||||||
"Order": "a040_",
|
"Order": "a040_",
|
||||||
"Type": "Combobox",
|
"Type": "Combobox",
|
||||||
"ComboItems": "Default DHCP Google Cloudflare Cloudflare_Malware Cloudflare_Malware_Adult Open_DNS Quad9 AdGuard_Ads_Trackers AdGuard_Ads_Trackers_Malware_Adult",
|
"ComboItems": "Default DHCP Google Cloudflare Cloudflare_Malware Cloudflare_Malware_Adult Open_DNS Quad9 AdGuard_Ads_Trackers AdGuard_Ads_Trackers_Malware_Adult dns0.eu_Open dns0.eu_ZERO dns0.eu_KIDS",
|
||||||
"link": "https://christitustech.github.io/winutil/dev/tweaks/z--Advanced-Tweaks---CAUTION/changedns"
|
"link": "https://christitustech.github.io/winutil/dev/tweaks/z--Advanced-Tweaks---CAUTION/changedns"
|
||||||
},
|
},
|
||||||
"WPFAddUltPerf": {
|
"WPFAddUltPerf": {
|
||||||
|
@ -1,3 +1,117 @@
|
|||||||
--8<-- ".github/CONTRIBUTING.md"
|
# How to Contribute?
|
||||||
|
|
||||||
<!-- The content is sourced from "CONTRIBUTING.md," located in the root directory of the project. -->
|
## Testing
|
||||||
|
|
||||||
|
* Test the latest changes to WinUtil by running the pre-release and reporting issues you are encountering to help us continually improve WinUtil!
|
||||||
|
|
||||||
|
#### **Run the latest pre-release**
|
||||||
|
```ps1
|
||||||
|
irm christitus.com/windev | iex
|
||||||
|
```
|
||||||
|
|
||||||
|
!!! bug "Keep in mind"
|
||||||
|
|
||||||
|
This is a pre-release and should be treated as such. It exists for developers to test the utility and report or fix bugs before they get added to the stable release. Don't use it in production!
|
||||||
|
|
||||||
|
## Issues
|
||||||
|
|
||||||
|
* If you encounter any challenges or problems with the script, I kindly request that you submit them via the "Issues" tab on the GitHub repository. By filling out the provided template, you can provide specific details about the issue, allowing me (and others in the community) to promptly address any bugs or consider feature requests.
|
||||||
|
|
||||||
|
## Contribute Code
|
||||||
|
|
||||||
|
* Pull requests are now handled directly on the **MAIN branch**. This was done since we can now select specific releases to launch via releases in GitHub.
|
||||||
|
|
||||||
|
* If you're doing code changes, then you can submit a PR to `main` branch, but I am very selective about these.
|
||||||
|
|
||||||
|
!!! warning "Important"
|
||||||
|
|
||||||
|
Do not use a code formatter, make massive amounts of line changes, or make multiple feature changes. EACH FEATURE CHANGE SHOULD BE IT'S OWN PULL REQUEST!
|
||||||
|
|
||||||
|
* When creating pull requests, it is essential to thoroughly document all changes made. This includes, but is not limited to, documenting any additions made to the `tweaks` section and corresponding `undo tweak`, so users are able to remove the newly added tweaks if necessary, and comprehensive documentation is required for all code changes. Document your changes and briefly explain why you made your changes in your Pull Request Description. Failure to adhere to this format may result in the denial of the pull request. Additionally, any code lacking sufficient documentation may also be denied.
|
||||||
|
|
||||||
|
* By following these guidelines, we can maintain a high standard of quality and ensure that the codebase remains organized and well-documented.
|
||||||
|
|
||||||
|
!!! note
|
||||||
|
|
||||||
|
When creating a function, please include "WPF" or "WinUtil" in the file name so it can be loaded into the runspace.
|
||||||
|
|
||||||
|
## Walk through
|
||||||
|
|
||||||
|
* This is a guide for beginners. If you are still having issues, look at the following official GitHub documentation:
|
||||||
|
* [Commit through WEB](https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/about-commits)
|
||||||
|
* [Commit through GitHub Desktop](https://docs.github.com/en/desktop/making-changes-in-a-branch/committing-and-reviewing-changes-to-your-project-in-github-desktop#about-commits)
|
||||||
|
* [Create a Pull Request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request)
|
||||||
|
|
||||||
|
|
||||||
|
### Overview
|
||||||
|
|
||||||
|
``` mermaid
|
||||||
|
%%{init: {"flowchart": {"curve": "cardinal"}} }%%
|
||||||
|
graph TD
|
||||||
|
A[Fork Project] --> B[Clone Repository];
|
||||||
|
B --> C[Create New Branch];
|
||||||
|
C --> D[Make Changes];
|
||||||
|
D --> G[Test Changes];
|
||||||
|
G --> H{Tests Passed?};
|
||||||
|
H -->|Yes| E[Commit Changes];
|
||||||
|
H -->|No| J[Fix Issues];
|
||||||
|
J --> G;
|
||||||
|
E --> F[Push Branch];
|
||||||
|
F --> K[Create Pull Request];
|
||||||
|
K --> L[Fill out PR template];
|
||||||
|
classDef default stroke:#333,stroke-width:4px,font-size:12pt;
|
||||||
|
```
|
||||||
|
!!! info
|
||||||
|
|
||||||
|
This is a diagram to guide you through the process. It may vary depending on the type of change you're making.
|
||||||
|
|
||||||
|
### Fork the Repo
|
||||||
|
* Fork the WinUtil Repository [here](https://github.com/ChrisTitusTech/winutil) to create a copy that will be available in your repository list.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Clone the Fork
|
||||||
|
!!! tip
|
||||||
|
|
||||||
|
While you can make your changes directly through the Web, we recommend cloning the repo to your device using the application GitHub Desktop (available in WinUtil) to test your fork easily.
|
||||||
|
|
||||||
|
* Install GitHub Desktop if it is not already installed.
|
||||||
|
* Log in using the same GitHub account you used to fork WinUtil.
|
||||||
|
* Choose the fork under "Your Repositories" and press "clone {repo name}"
|
||||||
|
* Create a new branch and name it something relatable to your changes.
|
||||||
|
|
||||||
|
* Now you can modify WinUtil to your liking using your preferred text editor.
|
||||||
|
|
||||||
|
|
||||||
|
### Testing your changes
|
||||||
|
|
||||||
|
* To test to see if your changes work as intended run following commands in a powershell teminal as admin:
|
||||||
|
|
||||||
|
* Change the directory where you are running the commands to the forked project.
|
||||||
|
* `cd {path to the folder with the compile.ps1}`
|
||||||
|
* Run the following command to compile and run WinUtil:
|
||||||
|
* `.\Compile.ps1 -run`
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
* After seeing that your changes work properly, feel free to commit the changes to the repository and make a PR. For help on that, follow the documentation below.
|
||||||
|
|
||||||
|
### Committing the changes
|
||||||
|
* Before committing your changes, please discard changes made to the `winutil.ps1` file, like the following:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
* Now, commit your changes once you are happy with the result.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
* Push the changes to upload them to your fork on github.com.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Making a PR
|
||||||
|
* To make a PR on your repo under a new branch linking to the main branch, a button will show and say Preview and Create pull request. Click that button and fill in all the information that is provided on the template. Once all the information is filled in correctly, check your PR to make sure there is not a WinUtil.ps1 file attached to the PR. Once everything is good, make the PR and wait for Chris (the maintainer) to accept or deny your PR. Once it is accepted by Chris, you will be able to see your changes in the "/windev" build.
|
||||||
|
* If you do not see your feature in the main "/win" build, that is fine. All new changes go into the /windev build to make sure everything is working OK before going fully public.
|
||||||
|
* Congratulations! You just submitted your first PR. Thank you so much for contributing to WinUtil.
|
||||||
|
@ -34,8 +34,9 @@
|
|||||||
* By default Winutil will use winget to install/upgrade/remove packages and fallback to Chocolatey. This option reverses the preference.
|
* By default Winutil will use winget to install/upgrade/remove packages and fallback to Chocolatey. This option reverses the preference.
|
||||||
* This preference will be used for all Buttons on the Install page and persist across Winutil restarts
|
* This preference will be used for all Buttons on the Install page and persist across Winutil restarts
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
!!! tip
|
!!! tip
|
||||||
|
|
||||||
If you have trouble finding an application, press `ctrl + f` and search the name of it. Applications will filter depending on your input.
|
If you have trouble finding an application, press `ctrl + f` and search the name of it. Applications will filter depending on your input.
|
||||||
@ -43,8 +44,8 @@
|
|||||||
## Tweaks
|
## Tweaks
|
||||||
---
|
---
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
### Run Tweaks
|
### Run Tweaks
|
||||||
* **Open Tweaks Tab**: Navigate to the 'Tweaks' tab in the application.
|
* **Open Tweaks Tab**: Navigate to the 'Tweaks' tab in the application.
|
||||||
@ -141,6 +142,10 @@ Open old-school Windows panels directly from WinUtil. Following Panels are avail
|
|||||||
* System Properties
|
* System Properties
|
||||||
* User Accounts
|
* User Accounts
|
||||||
|
|
||||||
|
### Remote Access
|
||||||
|
|
||||||
|
Enables OpenSSH server on your windows machine.
|
||||||
|
|
||||||
## Updates
|
## Updates
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -175,8 +180,8 @@ The utility provides three distinct settings for managing Windows updates: Defau
|
|||||||
|
|
||||||
* **MicroWin** lets you customize your Windows 10 and 11 installation images by debloating them however you want.
|
* **MicroWin** lets you customize your Windows 10 and 11 installation images by debloating them however you want.
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
#### Basic usage
|
#### Basic usage
|
||||||
|
|
||||||
@ -234,12 +239,12 @@ With MicroWin, you can also configure your user before proceeding if you don't w
|
|||||||
* Some features are available through automation. This allows you to save your config file, pass it to WinUtil, walk away and come back to a finished system. Here is how you can set it up currently with Winutil >24.01.15
|
* Some features are available through automation. This allows you to save your config file, pass it to WinUtil, walk away and come back to a finished system. Here is how you can set it up currently with Winutil >24.01.15
|
||||||
|
|
||||||
* On the Install Tab, click "Get Installed", this will get all installed apps **supported by Winutil** on the system.
|
* On the Install Tab, click "Get Installed", this will get all installed apps **supported by Winutil** on the system.
|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
* Click on the Settings cog in the upper right corner and choose Export. Choose file file and location; this will export the setting file.
|
* Click on the Settings cog in the upper right corner and choose Export. Choose file file and location; this will export the setting file.
|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
* Copy this file to a USB or somewhere you can use it after Windows installation.
|
* Copy this file to a USB or somewhere you can use it after Windows installation.
|
||||||
|
|
||||||
|
@ -16,136 +16,72 @@ Function Get-WinUtilToggleStatus {
|
|||||||
if($ToggleSwitch -eq "WPFToggleDarkMode") {
|
if($ToggleSwitch -eq "WPFToggleDarkMode") {
|
||||||
$app = (Get-ItemProperty -path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize').AppsUseLightTheme
|
$app = (Get-ItemProperty -path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize').AppsUseLightTheme
|
||||||
$system = (Get-ItemProperty -path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize').SystemUsesLightTheme
|
$system = (Get-ItemProperty -path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize').SystemUsesLightTheme
|
||||||
if($app -eq 0 -and $system -eq 0) {
|
return $app -eq 0 -and $system -eq 0
|
||||||
return $true
|
|
||||||
} else {
|
|
||||||
return $false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if($ToggleSwitch -eq "WPFToggleBingSearch") {
|
if($ToggleSwitch -eq "WPFToggleBingSearch") {
|
||||||
$bingsearch = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Search').BingSearchEnabled
|
$bingsearch = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Search').BingSearchEnabled
|
||||||
if($bingsearch -eq 0) {
|
return $bingsearch -ne 0
|
||||||
return $false
|
|
||||||
} else {
|
|
||||||
return $true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if($ToggleSwitch -eq "WPFToggleNumLock") {
|
if($ToggleSwitch -eq "WPFToggleNumLock") {
|
||||||
$numlockvalue = (Get-ItemProperty -path 'HKCU:\Control Panel\Keyboard').InitialKeyboardIndicators
|
$numlockvalue = (Get-ItemProperty -path 'HKCU:\Control Panel\Keyboard').InitialKeyboardIndicators
|
||||||
if($numlockvalue -eq 2) {
|
return $numlockvalue -eq 2
|
||||||
return $true
|
|
||||||
} else {
|
|
||||||
return $false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if($ToggleSwitch -eq "WPFToggleVerboseLogon") {
|
if($ToggleSwitch -eq "WPFToggleVerboseLogon") {
|
||||||
$VerboseStatusvalue = (Get-ItemProperty -path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System').VerboseStatus
|
$VerboseStatusvalue = (Get-ItemProperty -path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System').VerboseStatus
|
||||||
if($VerboseStatusvalue -eq 1) {
|
return $VerboseStatusvalue -eq 1
|
||||||
return $true
|
|
||||||
} else {
|
|
||||||
return $false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if($ToggleSwitch -eq "WPFToggleShowExt") {
|
if($ToggleSwitch -eq "WPFToggleShowExt") {
|
||||||
$hideextvalue = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').HideFileExt
|
$hideextvalue = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').HideFileExt
|
||||||
if($hideextvalue -eq 0) {
|
return $hideextvalue -eq 0
|
||||||
return $true
|
|
||||||
} else {
|
|
||||||
return $false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if($ToggleSwitch -eq "WPFToggleSnapWindow") {
|
if($ToggleSwitch -eq "WPFToggleSnapWindow") {
|
||||||
$hidesnap = (Get-ItemProperty -path 'HKCU:\Control Panel\Desktop').WindowArrangementActive
|
$hidesnap = (Get-ItemProperty -path 'HKCU:\Control Panel\Desktop').WindowArrangementActive
|
||||||
if($hidesnap -eq 0) {
|
return $hidesnap -ne 0
|
||||||
return $false
|
|
||||||
} else {
|
|
||||||
return $true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if($ToggleSwitch -eq "WPFToggleSnapFlyout") {
|
if($ToggleSwitch -eq "WPFToggleSnapFlyout") {
|
||||||
$hidesnap = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').EnableSnapAssistFlyout
|
$hidesnap = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').EnableSnapAssistFlyout
|
||||||
if($hidesnap -eq 0) {
|
return $hidesnap -ne 0
|
||||||
return $false
|
|
||||||
} else {
|
|
||||||
return $true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if($ToggleSwitch -eq "WPFToggleSnapSuggestion") {
|
if($ToggleSwitch -eq "WPFToggleSnapSuggestion") {
|
||||||
$hidesnap = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').SnapAssist
|
$hidesnap = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').SnapAssist
|
||||||
if($hidesnap -eq 0) {
|
return $hidesnap -ne 0
|
||||||
return $false
|
|
||||||
} else {
|
|
||||||
return $true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if($ToggleSwitch -eq "WPFToggleMouseAcceleration") {
|
if($ToggleSwitch -eq "WPFToggleMouseAcceleration") {
|
||||||
$MouseSpeed = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseSpeed
|
$MouseSpeed = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseSpeed
|
||||||
$MouseThreshold1 = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseThreshold1
|
$MouseThreshold1 = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseThreshold1
|
||||||
$MouseThreshold2 = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseThreshold2
|
$MouseThreshold2 = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseThreshold2
|
||||||
|
|
||||||
if($MouseSpeed -eq 1 -and $MouseThreshold1 -eq 6 -and $MouseThreshold2 -eq 10) {
|
return $MouseSpeed -eq 1 -and $MouseThreshold1 -eq 6 -and $MouseThreshold2 -eq 10
|
||||||
return $true
|
|
||||||
} else {
|
|
||||||
return $false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if($ToggleSwitch -eq "WPFToggleTaskbarSearch") {
|
if($ToggleSwitch -eq "WPFToggleTaskbarSearch") {
|
||||||
$SearchButton = (Get-ItemProperty -path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search").SearchboxTaskbarMode
|
$SearchButton = (Get-ItemProperty -path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search").SearchboxTaskbarMode
|
||||||
if($SearchButton -eq 0) {
|
return $SearchButton -ne 0
|
||||||
return $false
|
|
||||||
} else {
|
|
||||||
return $true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ($ToggleSwitch -eq "WPFToggleStickyKeys") {
|
if ($ToggleSwitch -eq "WPFToggleStickyKeys") {
|
||||||
$StickyKeys = (Get-ItemProperty -path 'HKCU:\Control Panel\Accessibility\StickyKeys').Flags
|
$StickyKeys = (Get-ItemProperty -path 'HKCU:\Control Panel\Accessibility\StickyKeys').Flags
|
||||||
if($StickyKeys -eq 58) {
|
return $StickyKeys -ne 58
|
||||||
return $false
|
|
||||||
} else {
|
|
||||||
return $true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ($ToggleSwitch -eq "WPFToggleTaskView") {
|
if ($ToggleSwitch -eq "WPFToggleTaskView") {
|
||||||
$TaskView = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').ShowTaskViewButton
|
$TaskView = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').ShowTaskViewButton
|
||||||
if($TaskView -eq 0) {
|
return $TaskView -ne 0
|
||||||
return $false
|
|
||||||
} else {
|
|
||||||
return $true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($ToggleSwitch -eq "WPFToggleHiddenFiles") {
|
if ($ToggleSwitch -eq "WPFToggleHiddenFiles") {
|
||||||
$HiddenFiles = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').Hidden
|
$HiddenFiles = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').Hidden
|
||||||
if($HiddenFiles -eq 0) {
|
return $HiddenFiles -ne 0
|
||||||
return $false
|
|
||||||
} else {
|
|
||||||
return $true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($ToggleSwitch -eq "WPFToggleTaskbarWidgets") {
|
if ($ToggleSwitch -eq "WPFToggleTaskbarWidgets") {
|
||||||
$TaskbarWidgets = (Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced").TaskBarDa
|
$TaskbarWidgets = (Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced").TaskBarDa
|
||||||
if($TaskbarWidgets -eq 0) {
|
return $TaskbarWidgets -ne 0
|
||||||
return $false
|
|
||||||
} else {
|
|
||||||
return $true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ($ToggleSwitch -eq "WPFToggleTaskbarAlignment") {
|
if ($ToggleSwitch -eq "WPFToggleTaskbarAlignment") {
|
||||||
$TaskbarAlignment = (Get-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced").TaskbarAl
|
$TaskbarAlignment = (Get-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced").TaskbarAl
|
||||||
if($TaskbarAlignment -eq 0) {
|
return $TaskbarAlignment -ne 0
|
||||||
return $false
|
|
||||||
} else {
|
|
||||||
return $true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ($ToggleSwitch -eq "WPFToggleDetailedBSoD") {
|
if ($ToggleSwitch -eq "WPFToggleDetailedBSoD") {
|
||||||
$DetailedBSoD1 = (Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\CrashControl').DisplayParameters
|
$DetailedBSoD1 = (Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\CrashControl').DisplayParameters
|
||||||
$DetailedBSoD2 = (Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\CrashControl').DisableEmoticon
|
$DetailedBSoD2 = (Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\CrashControl').DisableEmoticon
|
||||||
if (($DetailedBSoD1 -eq 0) -or ($DetailedBSoD2 -eq 0) -or !$DetailedBSoD1 -or !$DetailedBSoD2) {
|
return !(($DetailedBSoD1 -eq 0) -or ($DetailedBSoD2 -eq 0) -or !$DetailedBSoD1 -or !$DetailedBSoD2)
|
||||||
return $false
|
|
||||||
} else {
|
|
||||||
return $true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,10 +13,11 @@ function Install-WinUtilChoco {
|
|||||||
if((Test-WinUtilPackageManager -choco) -eq "installed") {
|
if((Test-WinUtilPackageManager -choco) -eq "installed") {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
# Install logic taken from https://chocolatey.org/install#individual
|
||||||
Write-Host "Seems Chocolatey is not installed, installing now."
|
Write-Host "Seems Chocolatey is not installed, installing now."
|
||||||
Start-Process -FilePath "powershell" -ArgumentList "Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) -ErrorAction Stop" -Wait -NoNewWindow
|
Set-ExecutionPolicy Bypass -Scope Process -Force;
|
||||||
Start-Process -FilePath "powershell" -ArgumentList "choco feature enable -n allowGlobalConfirmation" -Wait -NoNewWindow
|
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;
|
||||||
|
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
|
||||||
|
|
||||||
} catch {
|
} catch {
|
||||||
Write-Host "===========================================" -Foregroundcolor Red
|
Write-Host "===========================================" -Foregroundcolor Red
|
||||||
|
@ -21,6 +21,11 @@ Function Invoke-WinUtilDarkMode {
|
|||||||
$Path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
|
$Path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
|
||||||
Set-ItemProperty -Path $Path -Name AppsUseLightTheme -Value $DarkMoveValue
|
Set-ItemProperty -Path $Path -Name AppsUseLightTheme -Value $DarkMoveValue
|
||||||
Set-ItemProperty -Path $Path -Name SystemUsesLightTheme -Value $DarkMoveValue
|
Set-ItemProperty -Path $Path -Name SystemUsesLightTheme -Value $DarkMoveValue
|
||||||
|
Invoke-WinUtilExplorerRefresh
|
||||||
|
# Update Winutil Theme if the Theme Button shows the Icon for Auto
|
||||||
|
if ($sync.ThemeButton.Content -eq [char]0xF08C) {
|
||||||
|
Invoke-WinutilThemeChange -theme "Auto"
|
||||||
|
}
|
||||||
} catch [System.Security.SecurityException] {
|
} catch [System.Security.SecurityException] {
|
||||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||||
} catch [System.Management.Automation.ItemNotFoundException] {
|
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||||
|
33
functions/private/Invoke-WinUtilExplorerRefresh.ps1
Normal file
33
functions/private/Invoke-WinUtilExplorerRefresh.ps1
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
function Invoke-WinUtilExplorerRefresh {
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Refreshes the Windows Explorer
|
||||||
|
#>
|
||||||
|
|
||||||
|
Invoke-WPFRunspace -DebugPreference $DebugPreference -ScriptBlock {
|
||||||
|
# Send the WM_SETTINGCHANGE message to all windows
|
||||||
|
Add-Type -TypeDefinition @"
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
public class Win32 {
|
||||||
|
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)]
|
||||||
|
public static extern IntPtr SendMessageTimeout(
|
||||||
|
IntPtr hWnd,
|
||||||
|
uint Msg,
|
||||||
|
IntPtr wParam,
|
||||||
|
string lParam,
|
||||||
|
uint fuFlags,
|
||||||
|
uint uTimeout,
|
||||||
|
out IntPtr lpdwResult);
|
||||||
|
}
|
||||||
|
"@
|
||||||
|
|
||||||
|
$HWND_BROADCAST = [IntPtr]0xffff
|
||||||
|
$WM_SETTINGCHANGE = 0x1A
|
||||||
|
$SMTO_ABORTIFHUNG = 0x2
|
||||||
|
$timeout = 100
|
||||||
|
|
||||||
|
# Send the broadcast message to all windows
|
||||||
|
[Win32]::SendMessageTimeout($HWND_BROADCAST, $WM_SETTINGCHANGE, [IntPtr]::Zero, "ImmersiveColorSet", $SMTO_ABORTIFHUNG, $timeout, [ref]([IntPtr]::Zero))
|
||||||
|
}
|
||||||
|
}
|
@ -25,6 +25,56 @@ function Test-CompatibleImage() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Get-FidoLangFromCulture {
|
||||||
|
|
||||||
|
param (
|
||||||
|
[Parameter(Mandatory, Position = 0)] [string]$langName
|
||||||
|
)
|
||||||
|
|
||||||
|
switch -Wildcard ($langName)
|
||||||
|
{
|
||||||
|
"ar*" { return "Arabic" }
|
||||||
|
"pt-BR" { return "Brazilian Portuguese" }
|
||||||
|
"bg*" { return "Bulgarian" }
|
||||||
|
{($_ -eq "zh-CH") -or ($_ -like "zh-Hans*") -or ($_ -eq "zh-SG") -or ($_ -eq "zh-CHS")} { return "Chinese (Simplified)" }
|
||||||
|
{($_ -eq "zh") -or ($_ -eq "zh-Hant") -or ($_ -eq "zh-HK") -or ($_ -eq "zh-MO") -or ($_ -eq "zh-TW") -or ($_ -eq "zh-CHT")} { return "Chinese (Traditional)" }
|
||||||
|
"hr*" { return "Croatian" }
|
||||||
|
"cs*" { return "Czech" }
|
||||||
|
"da*" { return "Danish" }
|
||||||
|
"nl*" { return "Dutch" }
|
||||||
|
"en-US" { return "English" }
|
||||||
|
{($_ -like "en*") -and ($_ -ne "en-US")} { return "English International" }
|
||||||
|
"et*" { return "Estonian" }
|
||||||
|
"fi*" { return "Finnish" }
|
||||||
|
{($_ -like "fr*") -and ($_ -ne "fr-CA")} { return "French" }
|
||||||
|
"fr-CA" { return "French Canadian" }
|
||||||
|
"de*" { return "German" }
|
||||||
|
"el*" { return "Greek" }
|
||||||
|
"he*" { return "Hebrew" }
|
||||||
|
"hu*" { return "Hungarian" }
|
||||||
|
"it*" { return "Italian" }
|
||||||
|
"ja*" { return "Japanese" }
|
||||||
|
"ko*" { return "Korean" }
|
||||||
|
"lv*" { return "Latvian" }
|
||||||
|
"lt*" { return "Lituanian" }
|
||||||
|
"nb*" { return "Norwegian" }
|
||||||
|
"pl*" { return "Polish" }
|
||||||
|
{($_ -like "pt*") -and ($_ -ne "pt-BR")} { return "Portuguese" }
|
||||||
|
"ro*" { return "Romanian" }
|
||||||
|
"ru*" { return "Russian" }
|
||||||
|
"sr-Latn*" { return "Serbian Latin" }
|
||||||
|
"sk*" { return "Slovak" }
|
||||||
|
"sl*" { return "Slovenian" }
|
||||||
|
{($_ -like "es*") -and ($_ -ne "es-MX")} { return "Spanish" }
|
||||||
|
"es-MX" { return "Spanish (Mexico)" }
|
||||||
|
"sv*" { return "Swedish" }
|
||||||
|
"th*" { return "Thai" }
|
||||||
|
"tr*" { return "Turkish" }
|
||||||
|
"uk*" { return "Ukrainian" }
|
||||||
|
default { return "English" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function Remove-Features() {
|
function Remove-Features() {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
@ -47,6 +97,7 @@ function Remove-Features() {
|
|||||||
$_.FeatureName -NotLike "*NetFx*" -AND
|
$_.FeatureName -NotLike "*NetFx*" -AND
|
||||||
$_.FeatureName -NotLike "*Media*" -AND
|
$_.FeatureName -NotLike "*Media*" -AND
|
||||||
$_.FeatureName -NotLike "*NFS*" -AND
|
$_.FeatureName -NotLike "*NFS*" -AND
|
||||||
|
$_.FeatureName -NotLike "*SearchEngine*" -AND
|
||||||
$_.State -ne "Disabled"
|
$_.State -ne "Disabled"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,6 +145,7 @@ function Remove-Packages {
|
|||||||
$_ -NotLike "*ParentalControls*" -AND
|
$_ -NotLike "*ParentalControls*" -AND
|
||||||
$_ -NotLike "*Win32WebViewHost*" -AND
|
$_ -NotLike "*Win32WebViewHost*" -AND
|
||||||
$_ -NotLike "*InputApp*" -AND
|
$_ -NotLike "*InputApp*" -AND
|
||||||
|
$_ -NotLike "*DirectPlay*" -AND
|
||||||
$_ -NotLike "*AccountsControl*" -AND
|
$_ -NotLike "*AccountsControl*" -AND
|
||||||
$_ -NotLike "*AsyncTextService*" -AND
|
$_ -NotLike "*AsyncTextService*" -AND
|
||||||
$_ -NotLike "*CapturePicker*" -AND
|
$_ -NotLike "*CapturePicker*" -AND
|
||||||
@ -165,7 +217,8 @@ function Remove-ProvisionedPackages() {
|
|||||||
$_.PackageName -NotLike "*Paint*" -and
|
$_.PackageName -NotLike "*Paint*" -and
|
||||||
$_.PackageName -NotLike "*Gaming*" -and
|
$_.PackageName -NotLike "*Gaming*" -and
|
||||||
$_.PackageName -NotLike "*Extension*" -and
|
$_.PackageName -NotLike "*Extension*" -and
|
||||||
$_.PackageName -NotLike "*SecHealthUI*"
|
$_.PackageName -NotLike "*SecHealthUI*" -and
|
||||||
|
$_.PackageName -NotLike "*ScreenSketch*"
|
||||||
}
|
}
|
||||||
|
|
||||||
$counter = 0
|
$counter = 0
|
||||||
|
81
functions/private/Invoke-WinUtilSSHServer.ps1
Normal file
81
functions/private/Invoke-WinUtilSSHServer.ps1
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
function Invoke-WinUtilSSHServer {
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Enables OpenSSH server to remote into your windows device
|
||||||
|
#>
|
||||||
|
|
||||||
|
# Get the latest version of OpenSSH Server
|
||||||
|
$FeatureName = Get-WindowsCapability -Online | Where-Object { $_.Name -like "OpenSSH.Server*" }
|
||||||
|
|
||||||
|
# Install the OpenSSH Server feature if not already installed
|
||||||
|
if ($FeatureName.State -ne "Installed") {
|
||||||
|
Write-Host "Enabling OpenSSH Server"
|
||||||
|
Add-WindowsCapability -Online -Name $FeatureName.Name
|
||||||
|
}
|
||||||
|
|
||||||
|
# Sets up the OpenSSH Server service
|
||||||
|
Write-Host "Starting the services"
|
||||||
|
Start-Service -Name sshd
|
||||||
|
Set-Service -Name sshd -StartupType Automatic
|
||||||
|
|
||||||
|
# Sets up the ssh-agent service
|
||||||
|
Start-Service 'ssh-agent'
|
||||||
|
Set-Service -Name 'ssh-agent' -StartupType 'Automatic'
|
||||||
|
|
||||||
|
# Confirm the required services are running
|
||||||
|
$SSHDaemonService = Get-Service -Name sshd
|
||||||
|
$SSHAgentService = Get-Service -Name 'ssh-agent'
|
||||||
|
|
||||||
|
if ($SSHDaemonService.Status -eq 'Running') {
|
||||||
|
Write-Host "OpenSSH Server is running."
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
Write-Host "OpenSSH Server is not running. Attempting to restart..."
|
||||||
|
Restart-Service -Name sshd -Force
|
||||||
|
Write-Host "OpenSSH Server has been restarted successfully."
|
||||||
|
} catch {
|
||||||
|
Write-Host "Failed to restart OpenSSH Server: $_"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($SSHAgentService.Status -eq 'Running') {
|
||||||
|
Write-Host "ssh-agent is running."
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
Write-Host "ssh-agent is not running. Attempting to restart..."
|
||||||
|
Restart-Service -Name sshd -Force
|
||||||
|
Write-Host "ssh-agent has been restarted successfully."
|
||||||
|
} catch {
|
||||||
|
Write-Host "Failed to restart ssh-agent : $_"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Adding Firewall rule for port 22
|
||||||
|
Write-Host "Setting up firewall rules"
|
||||||
|
$firewallRule = (Get-NetFirewallRule -Name 'sshd').Enabled
|
||||||
|
if ($firewallRule) {
|
||||||
|
Write-Host "Firewall rule for OpenSSH Server (sshd) already exists."
|
||||||
|
} else {
|
||||||
|
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
|
||||||
|
Write-Host "Firewall rule for OpenSSH Server created and enabled."
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check for the authorized_keys file
|
||||||
|
$sshFolderPath = "$env:HOMEDRIVE\$env:HOMEPATH\.ssh"
|
||||||
|
$authorizedKeysPath = "$sshFolderPath\authorized_keys"
|
||||||
|
|
||||||
|
if (-not (Test-Path -Path $sshFolderPath)) {
|
||||||
|
Write-Host "Creating ssh directory..."
|
||||||
|
New-Item -Path $sshFolderPath -ItemType Directory -Force
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not (Test-Path -Path $authorizedKeysPath)) {
|
||||||
|
Write-Host "Creating authorized_keys file..."
|
||||||
|
New-Item -Path $authorizedKeysPath -ItemType File -Force
|
||||||
|
Write-Host "authorized_keys file created at $authorizedKeysPath."
|
||||||
|
} else {
|
||||||
|
Write-Host "authorized_keys file already exists at $authorizedKeysPath."
|
||||||
|
}
|
||||||
|
Write-Host "OpenSSH server was successfully enabled."
|
||||||
|
Write-Host "The config file can be located at C:\ProgramData\ssh\sshd_config "
|
||||||
|
Write-Host "Add your public keys to this file -> $authorizedKeysPath"
|
||||||
|
}
|
180
functions/private/Invoke-WinutilThemeChange.ps1
Normal file
180
functions/private/Invoke-WinutilThemeChange.ps1
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
function Invoke-WinutilThemeChange {
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Toggles between light and dark themes for a Windows utility application.
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
This function toggles the theme of the user interface between 'Light' and 'Dark' modes,
|
||||||
|
modifying various UI elements such as colors, margins, corner radii, font families, etc.
|
||||||
|
If the '-init' switch is used, it initializes the theme based on the system's current dark mode setting.
|
||||||
|
|
||||||
|
.PARAMETER init
|
||||||
|
A switch parameter. If set to $true, the function initializes the theme based on the system’s current dark mode setting.
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
Invoke-WinutilThemeChange
|
||||||
|
# Toggles the theme between 'Light' and 'Dark'.
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
Invoke-WinutilThemeChange -init
|
||||||
|
# Initializes the theme based on the system's dark mode and applies the shared theme.
|
||||||
|
#>
|
||||||
|
param (
|
||||||
|
[switch]$init = $false,
|
||||||
|
[string]$theme
|
||||||
|
)
|
||||||
|
|
||||||
|
function Set-WinutilTheme {
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Applies the specified theme to the application's user interface.
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
This internal function applies the given theme by setting the relevant properties
|
||||||
|
like colors, font families, corner radii, etc., in the UI. It uses the
|
||||||
|
'Set-ThemeResourceProperty' helper function to modify the application's resources.
|
||||||
|
|
||||||
|
.PARAMETER currentTheme
|
||||||
|
The name of the theme to be applied. Common values are "Light", "Dark", or "shared".
|
||||||
|
#>
|
||||||
|
param (
|
||||||
|
[string]$currentTheme
|
||||||
|
)
|
||||||
|
|
||||||
|
function Set-ThemeResourceProperty {
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Sets a specific UI property in the application's resources.
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
This helper function sets a property (e.g., color, margin, corner radius) in the
|
||||||
|
application's resources, based on the provided type and value. It includes
|
||||||
|
error handling to manage potential issues while setting a property.
|
||||||
|
|
||||||
|
.PARAMETER Name
|
||||||
|
The name of the resource property to modify (e.g., "MainBackgroundColor", "ButtonBackgroundMouseoverColor").
|
||||||
|
|
||||||
|
.PARAMETER Value
|
||||||
|
The value to assign to the resource property (e.g., "#FFFFFF" for a color).
|
||||||
|
|
||||||
|
.PARAMETER Type
|
||||||
|
The type of the resource, such as "ColorBrush", "CornerRadius", "GridLength", or "FontFamily".
|
||||||
|
#>
|
||||||
|
param($Name, $Value, $Type)
|
||||||
|
try {
|
||||||
|
# Set the resource property based on its type
|
||||||
|
$sync.Form.Resources[$Name] = switch ($Type) {
|
||||||
|
"ColorBrush" { [Windows.Media.SolidColorBrush]::new($Value) }
|
||||||
|
"Color" {
|
||||||
|
# Convert hex string to RGB values
|
||||||
|
$hexColor = $Value.TrimStart("#")
|
||||||
|
$r = [Convert]::ToInt32($hexColor.Substring(0,2), 16)
|
||||||
|
$g = [Convert]::ToInt32($hexColor.Substring(2,2), 16)
|
||||||
|
$b = [Convert]::ToInt32($hexColor.Substring(4,2), 16)
|
||||||
|
[Windows.Media.Color]::FromRgb($r, $g, $b)
|
||||||
|
}
|
||||||
|
"CornerRadius" { [System.Windows.CornerRadius]::new($Value) }
|
||||||
|
"GridLength" { [System.Windows.GridLength]::new($Value) }
|
||||||
|
"Thickness" {
|
||||||
|
# Parse the Thickness value (supports 1, 2, or 4 inputs)
|
||||||
|
$values = $Value -split ","
|
||||||
|
switch ($values.Count) {
|
||||||
|
1 { [System.Windows.Thickness]::new([double]$values[0]) }
|
||||||
|
2 { [System.Windows.Thickness]::new([double]$values[0], [double]$values[1]) }
|
||||||
|
4 { [System.Windows.Thickness]::new([double]$values[0], [double]$values[1], [double]$values[2], [double]$values[3]) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"FontFamily" { [Windows.Media.FontFamily]::new($Value) }
|
||||||
|
"Double" { [double]$Value }
|
||||||
|
default { $Value }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
# Log a warning if there's an issue setting the property
|
||||||
|
Write-Warning "Failed to set property $($Name): $_"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Retrieve all theme properties from the theme configuration
|
||||||
|
$themeProperties = $sync.configs.themes.$currentTheme.PSObject.Properties
|
||||||
|
foreach ($_ in $themeProperties) {
|
||||||
|
# Apply properties that deal with colors
|
||||||
|
if ($_.Name -like "*color*") {
|
||||||
|
Set-ThemeResourceProperty -Name $_.Name -Value $_.Value -Type "ColorBrush"
|
||||||
|
# For certain color properties, also set complementary values (e.g., BorderColor -> CBorderColor) This is required because e.g DropShadowEffect requires a <Color> and not a <SolidColorBrush> object
|
||||||
|
if ($_.Name -in @("BorderColor", "ButtonBackgroundMouseoverColor")) {
|
||||||
|
Set-ThemeResourceProperty -Name "C$($_.Name)" -Value $_.Value -Type "Color"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# Apply corner radius properties
|
||||||
|
elseif ($_.Name -like "*Radius*") {
|
||||||
|
Set-ThemeResourceProperty -Name $_.Name -Value $_.Value -Type "CornerRadius"
|
||||||
|
}
|
||||||
|
# Apply row height properties
|
||||||
|
elseif ($_.Name -like "*RowHeight*") {
|
||||||
|
Set-ThemeResourceProperty -Name $_.Name -Value $_.Value -Type "GridLength"
|
||||||
|
}
|
||||||
|
# Apply thickness or margin properties
|
||||||
|
elseif (($_.Name -like "*Thickness*") -or ($_.Name -like "*margin")) {
|
||||||
|
Set-ThemeResourceProperty -Name $_.Name -Value $_.Value -Type "Thickness"
|
||||||
|
}
|
||||||
|
# Apply font family properties
|
||||||
|
elseif ($_.Name -like "*FontFamily*") {
|
||||||
|
Set-ThemeResourceProperty -Name $_.Name -Value $_.Value -Type "FontFamily"
|
||||||
|
}
|
||||||
|
# Apply any other properties as doubles (numerical values)
|
||||||
|
else {
|
||||||
|
Set-ThemeResourceProperty -Name $_.Name -Value $_.Value -Type "Double"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$LightPreferencePath = "$env:LOCALAPPDATA\winutil\LightTheme.ini"
|
||||||
|
$DarkPreferencePath = "$env:LOCALAPPDATA\winutil\DarkTheme.ini"
|
||||||
|
|
||||||
|
if ($init) {
|
||||||
|
Set-WinutilTheme -currentTheme "shared"
|
||||||
|
if (Test-Path $LightPreferencePath) {
|
||||||
|
$theme = "Light"
|
||||||
|
}
|
||||||
|
elseif (Test-Path $DarkPreferencePath) {
|
||||||
|
$theme = "Dark"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$theme = "Auto"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($theme) {
|
||||||
|
"Auto" {
|
||||||
|
$systemUsesDarkMode = Get-WinUtilToggleStatus WPFToggleDarkMode
|
||||||
|
if ($systemUsesDarkMode) {
|
||||||
|
Set-WinutilTheme -currentTheme "Dark"
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
Set-WinutilTheme -currentTheme "Light"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$themeButtonIcon = [char]0xF08C
|
||||||
|
Remove-Item $LightPreferencePath -Force -ErrorAction SilentlyContinue
|
||||||
|
Remove-Item $DarkPreferencePath -Force -ErrorAction SilentlyContinue
|
||||||
|
}
|
||||||
|
"Dark" {
|
||||||
|
Set-WinutilTheme -currentTheme $theme
|
||||||
|
$themeButtonIcon = [char]0xE708
|
||||||
|
$null = New-Item $DarkPreferencePath -Force
|
||||||
|
Remove-Item $LightPreferencePath -Force -ErrorAction SilentlyContinue
|
||||||
|
}
|
||||||
|
"Light" {
|
||||||
|
Set-WinutilTheme -currentTheme $theme
|
||||||
|
$themeButtonIcon = [char]0xE706
|
||||||
|
$null = New-Item $LightPreferencePath -Force
|
||||||
|
Remove-Item $DarkPreferencePath -Force -ErrorAction SilentlyContinue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Update the theme selector button with the appropriate icon
|
||||||
|
$ThemeButton = $sync.Form.FindName("ThemeButton")
|
||||||
|
$ThemeButton.Content = [string]$themeButtonIcon
|
||||||
|
}
|
@ -36,7 +36,12 @@ function Set-WinUtilRegistry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Write-Host "Set $Path\$Name to $Value"
|
Write-Host "Set $Path\$Name to $Value"
|
||||||
|
if ($Value -ne "<RemoveEntry>"){
|
||||||
Set-ItemProperty -Path $Path -Name $Name -Type $Type -Value $Value -Force -ErrorAction Stop | Out-Null
|
Set-ItemProperty -Path $Path -Name $Name -Type $Type -Value $Value -Force -ErrorAction Stop | Out-Null
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
Remove-ItemProperty -Path $Path -Name $Name -Force -ErrorAction Stop | Out-Null
|
||||||
|
}
|
||||||
} catch [System.Security.SecurityException] {
|
} catch [System.Security.SecurityException] {
|
||||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||||
} catch [System.Management.Automation.ItemNotFoundException] {
|
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||||
|
@ -1,83 +0,0 @@
|
|||||||
function Set-WinUtilUITheme {
|
|
||||||
<#
|
|
||||||
.SYNOPSIS
|
|
||||||
Sets the theme of the XAML file
|
|
||||||
|
|
||||||
.PARAMETER inputXML
|
|
||||||
A string representing the XAML object to modify
|
|
||||||
|
|
||||||
.PARAMETER customThemeName
|
|
||||||
The name of the custom theme to set the XAML to. Defaults to 'matrix'
|
|
||||||
|
|
||||||
.PARAMETER defaultThemeName
|
|
||||||
The name of the default theme to use when setting the XAML. Defaults to '_default'
|
|
||||||
|
|
||||||
.EXAMPLE
|
|
||||||
$returnVal = Set-WinUtilUITheme -inputXAML $inputXAML
|
|
||||||
if ($returnVal[0] -eq "") {
|
|
||||||
Write-Host "Failed to process inputXML"
|
|
||||||
} else {
|
|
||||||
$inputXML = $returnVal[0]
|
|
||||||
}
|
|
||||||
# to know which theme this function has used, access the second item in returned value.
|
|
||||||
Write-Host "Theme used in processing: $($returnVal[1])"
|
|
||||||
#>
|
|
||||||
|
|
||||||
param (
|
|
||||||
[Parameter(Mandatory, position=0)]
|
|
||||||
[string]$inputXML,
|
|
||||||
|
|
||||||
[Parameter(position=1)]
|
|
||||||
[string]$customThemeName = 'matrix',
|
|
||||||
|
|
||||||
[Parameter(position=2)]
|
|
||||||
[string]$defaultThemeName = '_default'
|
|
||||||
)
|
|
||||||
|
|
||||||
try {
|
|
||||||
# Note:
|
|
||||||
# Reason behind not caching the '$sync.configs.themes` object into a variable,
|
|
||||||
# because this code can modify the themes object.. meaning it's better to access it
|
|
||||||
# using the more verbose way, rather than introduce possible bugs into the code, just for the sake of readability.
|
|
||||||
#
|
|
||||||
if (-NOT $sync.configs.themes) {
|
|
||||||
throw [GenericException]::new("[Set-WinUtilTheme] Did not find 'config.themes' inside `$sync variable.")
|
|
||||||
}
|
|
||||||
|
|
||||||
if (-NOT $sync.configs.themes.$defaultThemeName) {
|
|
||||||
throw [GenericException]::new("[Set-WinUtilTheme] Did not find '$defaultThemeName' theme in the themes config file.")
|
|
||||||
}
|
|
||||||
|
|
||||||
$themeToUse = $customThemeName
|
|
||||||
if ($sync.configs.themes.$themeToUse) {
|
|
||||||
# Loop through every default theme option, and modify the custom theme in $sync variable,
|
|
||||||
# so that it has full options available for other functions to use.
|
|
||||||
foreach ($option in $sync.configs.themes.$defaultThemeName.PSObject.Properties) {
|
|
||||||
$optionName = $option.Name
|
|
||||||
$optionValue = $option.Value
|
|
||||||
if (-NOT $sync.configs.themes.$themeToUse.$optionName) {
|
|
||||||
$sync.configs.themes.$themeToUse | Add-Member -MemberType NoteProperty -Name $optionName -Value $optionValue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Write-Debug "[Set-WinUtilTheme] Theme '$customThemeName' was not found, using '$defaultThemeName' instead."
|
|
||||||
$themeToUse = $defaultThemeName
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($property in $sync.configs.themes.$themeToUse.PSObject.Properties) {
|
|
||||||
$key = $property.Name
|
|
||||||
$value = $property.Value
|
|
||||||
# Add curly braces around the key
|
|
||||||
$formattedKey = "{$key}"
|
|
||||||
# Replace the key with the value in the input XML
|
|
||||||
$inputXML = $inputXML.Replace($formattedKey, $value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
Write-Host "[Set-WinUtilTheme] Unable to apply theme" -ForegroundColor Red
|
|
||||||
Write-Host "$($psitem.Exception.Message)" -ForegroundColor Red
|
|
||||||
$inputXML = "" # Make inputXML equal an empty string, indicating something went wrong to the function caller.
|
|
||||||
}
|
|
||||||
|
|
||||||
return @($inputXML, $themeToUse);
|
|
||||||
}
|
|
@ -33,25 +33,25 @@ function Show-CustomDialog {
|
|||||||
#>
|
#>
|
||||||
param(
|
param(
|
||||||
[string]$Message,
|
[string]$Message,
|
||||||
[int]$Width = 300,
|
[int]$Width = $sync.Form.Resources.CustomDialogWidth,
|
||||||
[int]$Height = 200,
|
[int]$Height = $sync.Form.Resources.CustomDialogHeight,
|
||||||
[int]$FontSize = 10,
|
[int]$FontSize = $sync.Form.Resources.CustomDialogFontSize,
|
||||||
[int]$HeaderFontSize = 14,
|
[int]$HeaderFontSize = $sync.Form.Resources.CustomDialogFontSizeHeader,
|
||||||
[int]$IconSize = 25,
|
[int]$IconSize = $sync.Form.Resources.CustomDialogLogoSize,
|
||||||
[bool]$EnableScroll = $false
|
[bool]$EnableScroll = $false
|
||||||
)
|
)
|
||||||
|
|
||||||
Add-Type -AssemblyName PresentationFramework
|
Add-Type -AssemblyName PresentationFramework
|
||||||
|
|
||||||
# Define theme colors
|
# Define theme colors
|
||||||
$foregroundColor = $sync.configs.themes.$ctttheme.MainForegroundColor
|
$foregroundColor = $sync.Form.Resources.MainForegroundColor
|
||||||
$backgroundColor = $sync.configs.themes.$ctttheme.MainBackgroundColor
|
$backgroundColor = $sync.Form.Resources.MainBackgroundColor
|
||||||
$font = New-Object Windows.Media.FontFamily("Consolas")
|
$font = New-Object Windows.Media.FontFamily("Consolas")
|
||||||
$borderColor = $sync.configs.themes.$ctttheme.BorderColor # ButtonInstallBackgroundColor
|
$borderColor = $sync.Form.Resources.BorderColor # ButtonInstallBackgroundColor
|
||||||
$buttonBackgroundColor = $sync.configs.themes.$ctttheme.ButtonInstallBackgroundColor
|
$buttonBackgroundColor = $sync.Form.Resources.ButtonInstallBackgroundColor
|
||||||
$buttonForegroundColor = $sync.configs.themes.$ctttheme.ButtonInstallForegroundColor
|
$buttonForegroundColor = $sync.Form.Resources.ButtonInstallForegroundColor
|
||||||
$shadowColor = [Windows.Media.ColorConverter]::ConvertFromString("#AAAAAAAA")
|
$shadowColor = [Windows.Media.ColorConverter]::ConvertFromString("#AAAAAAAA")
|
||||||
$logocolor = $sync.configs.themes.$ctttheme.LabelboxForegroundColor
|
$logocolor = $sync.Form.Resources.LabelboxForegroundColor
|
||||||
|
|
||||||
# Create a custom dialog window
|
# Create a custom dialog window
|
||||||
$dialog = New-Object Windows.Window
|
$dialog = New-Object Windows.Window
|
||||||
@ -162,7 +162,7 @@ function Show-CustomDialog {
|
|||||||
$hyperlink.NavigateUri = New-Object System.Uri($match.Groups[1].Value)
|
$hyperlink.NavigateUri = New-Object System.Uri($match.Groups[1].Value)
|
||||||
$hyperlink.Inlines.Add($match.Groups[2].Value)
|
$hyperlink.Inlines.Add($match.Groups[2].Value)
|
||||||
$hyperlink.TextDecorations = [Windows.TextDecorations]::None # Remove underline
|
$hyperlink.TextDecorations = [Windows.TextDecorations]::None # Remove underline
|
||||||
$hyperlink.Foreground = $sync.configs.themes.$ctttheme.LinkForegroundColor
|
$hyperlink.Foreground = $sync.Form.Resources.LinkForegroundColor
|
||||||
|
|
||||||
$hyperlink.Add_Click({
|
$hyperlink.Add_Click({
|
||||||
param($sender, $args)
|
param($sender, $args)
|
||||||
@ -170,11 +170,11 @@ function Show-CustomDialog {
|
|||||||
})
|
})
|
||||||
$hyperlink.Add_MouseEnter({
|
$hyperlink.Add_MouseEnter({
|
||||||
param($sender, $args)
|
param($sender, $args)
|
||||||
$sender.Foreground = $sync.configs.themes.$ctttheme.LinkHoverForegroundColor
|
$sender.Foreground = $sync.Form.Resources.LinkHoverForegroundColor
|
||||||
})
|
})
|
||||||
$hyperlink.Add_MouseLeave({
|
$hyperlink.Add_MouseLeave({
|
||||||
param($sender, $args)
|
param($sender, $args)
|
||||||
$sender.Foreground = $sync.configs.themes.$ctttheme.LinkForegroundColor
|
$sender.Foreground = $sync.Form.Resources.LinkForegroundColor
|
||||||
})
|
})
|
||||||
|
|
||||||
$messageTextBlock.Inlines.Add($hyperlink)
|
$messageTextBlock.Inlines.Add($hyperlink)
|
||||||
|
@ -19,7 +19,6 @@ function Invoke-WPFButton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Switch -Wildcard ($Button) {
|
Switch -Wildcard ($Button) {
|
||||||
|
|
||||||
"WPFTab?BT" {Invoke-WPFTab $Button}
|
"WPFTab?BT" {Invoke-WPFTab $Button}
|
||||||
"WPFInstall" {Invoke-WPFInstall}
|
"WPFInstall" {Invoke-WPFInstall}
|
||||||
"WPFUninstall" {Invoke-WPFUnInstall}
|
"WPFUninstall" {Invoke-WPFUnInstall}
|
||||||
@ -59,5 +58,6 @@ function Invoke-WPFButton {
|
|||||||
"WPFCloseButton" {Invoke-WPFCloseButton}
|
"WPFCloseButton" {Invoke-WPFCloseButton}
|
||||||
"MicrowinScratchDirBT" {Invoke-ScratchDialog}
|
"MicrowinScratchDirBT" {Invoke-ScratchDialog}
|
||||||
"WPFWinUtilPSProfile" {Invoke-WinUtilpsProfile}
|
"WPFWinUtilPSProfile" {Invoke-WinUtilpsProfile}
|
||||||
|
"WPFWinUtilSSHServer" {Invoke-WinUtilSSHServer}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,6 +62,8 @@ function Invoke-WPFGetIso {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($sync["ISOmanual"].IsChecked) {
|
||||||
|
# Open file dialog to let user choose the ISO file
|
||||||
[System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null
|
[System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null
|
||||||
$openFileDialog = New-Object System.Windows.Forms.OpenFileDialog
|
$openFileDialog = New-Object System.Windows.Forms.OpenFileDialog
|
||||||
$openFileDialog.initialDirectory = $initialDirectory
|
$openFileDialog.initialDirectory = $initialDirectory
|
||||||
@ -74,6 +76,66 @@ function Invoke-WPFGetIso {
|
|||||||
$sync.BusyMessage.Visibility="Hidden"
|
$sync.BusyMessage.Visibility="Hidden"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
} elseif ($sync["ISOdownloader"].IsChecked) {
|
||||||
|
# Create folder browsers for user-specified locations
|
||||||
|
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
|
||||||
|
$isoDownloaderFBD = New-Object System.Windows.Forms.FolderBrowserDialog
|
||||||
|
$isoDownloaderFBD.Description = "Please specify the path to download the ISO file to:"
|
||||||
|
$isoDownloaderFBD.ShowNewFolderButton = $true
|
||||||
|
if ($isoDownloaderFBD.ShowDialog() -ne [System.Windows.Forms.DialogResult]::OK)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
# Grab the location of the selected path
|
||||||
|
$targetFolder = $isoDownloaderFBD.SelectedPath
|
||||||
|
|
||||||
|
# Auto download newest ISO
|
||||||
|
# Credit: https://github.com/pbatard/Fido
|
||||||
|
$fidopath = "$env:temp\Fido.ps1"
|
||||||
|
$originalLocation = $PSScriptRoot
|
||||||
|
|
||||||
|
Invoke-WebRequest "https://github.com/pbatard/Fido/raw/master/Fido.ps1" -OutFile $fidopath
|
||||||
|
|
||||||
|
Set-Location -Path $env:temp
|
||||||
|
# Detect if the first option ("System language") has been selected and get a Fido-approved language from the current culture
|
||||||
|
$lang = if ($sync["ISOLanguage"].SelectedIndex -eq 0) {
|
||||||
|
Get-FidoLangFromCulture -langName (Get-Culture).Name
|
||||||
|
} else {
|
||||||
|
$sync["ISOLanguage"].SelectedItem
|
||||||
|
}
|
||||||
|
|
||||||
|
& $fidopath -Win 'Windows 11' -Rel $sync["ISORelease"].SelectedItem -Arch "x64" -Lang $lang -Ed "Windows 11 Home/Pro/Edu"
|
||||||
|
if (-not $?)
|
||||||
|
{
|
||||||
|
Write-Host "Could not download the ISO file. Look at the output of the console for more information."
|
||||||
|
$msg = "The ISO file could not be downloaded"
|
||||||
|
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Error)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
Set-Location $originalLocation
|
||||||
|
# Use the FullName property to only grab the file names. Using this property is necessary as, without it, you're passing the usual output of Get-ChildItem
|
||||||
|
# to the variable, and let's be honest, that does NOT exist in the file system
|
||||||
|
$filePath = (Get-ChildItem -Path "$env:temp" -Filter "Win11*.iso").FullName | Sort-Object LastWriteTime -Descending | Select-Object -First 1
|
||||||
|
$fileName = [IO.Path]::GetFileName("$filePath")
|
||||||
|
|
||||||
|
if (($targetFolder -ne "") -and (Test-Path "$targetFolder"))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
# "Let it download to $env:TEMP and then we **move** it to the file path." - CodingWonders
|
||||||
|
$destinationFilePath = "$targetFolder\$fileName"
|
||||||
|
Write-Host "Moving ISO file. Please wait..."
|
||||||
|
Move-Item -Path "$filePath" -Destination "$destinationFilePath" -Force
|
||||||
|
$filePath = $destinationFilePath
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
Write-Host "Unable to move the ISO file to the location you specified. The downloaded ISO is in the `"$env:TEMP`" folder"
|
||||||
|
Write-Host "Error information: $($_.Exception.Message)" -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Write-Host "File path $($filePath)"
|
Write-Host "File path $($filePath)"
|
||||||
if (-not (Test-Path -Path "$filePath" -PathType Leaf)) {
|
if (-not (Test-Path -Path "$filePath" -PathType Leaf)) {
|
||||||
|
@ -19,45 +19,59 @@ function Invoke-WPFImpex {
|
|||||||
$Config = $null
|
$Config = $null
|
||||||
)
|
)
|
||||||
|
|
||||||
if ($type -eq "export") {
|
function ConfigDialog {
|
||||||
$FileBrowser = New-Object System.Windows.Forms.SaveFileDialog
|
if (!$Config) {
|
||||||
|
switch ($type) {
|
||||||
|
"export" { $FileBrowser = New-Object System.Windows.Forms.SaveFileDialog }
|
||||||
|
"import" { $FileBrowser = New-Object System.Windows.Forms.OpenFileDialog }
|
||||||
}
|
}
|
||||||
if ($type -eq "import") {
|
|
||||||
$FileBrowser = New-Object System.Windows.Forms.OpenFileDialog
|
|
||||||
}
|
|
||||||
|
|
||||||
if (-not $Config) {
|
|
||||||
$FileBrowser.InitialDirectory = [Environment]::GetFolderPath('Desktop')
|
$FileBrowser.InitialDirectory = [Environment]::GetFolderPath('Desktop')
|
||||||
$FileBrowser.Filter = "JSON Files (*.json)|*.json"
|
$FileBrowser.Filter = "JSON Files (*.json)|*.json"
|
||||||
$FileBrowser.ShowDialog() | Out-Null
|
$FileBrowser.ShowDialog() | Out-Null
|
||||||
|
|
||||||
if($FileBrowser.FileName -eq "") {
|
if ($FileBrowser.FileName -eq "") {
|
||||||
return
|
return $null
|
||||||
} else {
|
} else {
|
||||||
$Config = $FileBrowser.FileName
|
return $FileBrowser.FileName
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return $Config
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($type -eq "export") {
|
switch ($type) {
|
||||||
$jsonFile = Get-WinUtilCheckBoxes -unCheck $false
|
"export" {
|
||||||
$jsonFile | ConvertTo-Json | Out-File $FileBrowser.FileName -Force
|
try {
|
||||||
$runscript = "iex ""& { `$(irm christitus.com/win) } -Config '$($FileBrowser.FileName)'"""
|
$Config = ConfigDialog
|
||||||
$runscript | Set-Clipboard
|
if ($Config) {
|
||||||
|
$jsonFile = Get-WinUtilCheckBoxes -unCheck $false | ConvertTo-Json
|
||||||
|
$jsonFile | Out-File $Config -Force
|
||||||
|
"iex ""& { `$(irm christitus.com/win) } -Config '$Config'""" | Set-Clipboard
|
||||||
}
|
}
|
||||||
if ($type -eq "import") {
|
} catch {
|
||||||
|
Write-Error "An error occurred while exporting: $_"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"import" {
|
||||||
|
try {
|
||||||
|
$Config = ConfigDialog
|
||||||
|
if ($Config) {
|
||||||
|
try {
|
||||||
|
if ($Config -match '^https?://') {
|
||||||
|
$jsonFile = (Invoke-WebRequest "$Config").Content | ConvertFrom-Json
|
||||||
|
} else {
|
||||||
$jsonFile = Get-Content $Config | ConvertFrom-Json
|
$jsonFile = Get-Content $Config | ConvertFrom-Json
|
||||||
|
|
||||||
$flattenedJson = @()
|
|
||||||
$jsonFile.PSObject.Properties | ForEach-Object {
|
|
||||||
$category = $_.Name
|
|
||||||
foreach ($checkboxName in $_.Value) {
|
|
||||||
if ($category -ne "Install") {
|
|
||||||
$flattenedJson += $checkboxName
|
|
||||||
}
|
}
|
||||||
|
} catch {
|
||||||
|
Write-Error "Failed to load the JSON file from the specified path or URL: $_"
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
$flattenedJson = $jsonFile.PSObject.Properties.Where({ $_.Name -ne "Install" }).ForEach({ $_.Value })
|
||||||
|
|
||||||
$flattenedJson = [string]$flattenedJson
|
|
||||||
Invoke-WPFPresets -preset $flattenedJson -imported $true
|
Invoke-WPFPresets -preset $flattenedJson -imported $true
|
||||||
}
|
}
|
||||||
|
} catch {
|
||||||
|
Write-Error "An error occurred while importing: $_"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ function Invoke-WPFInstall {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
$ChocoPreference = $($sync.WPFpreferChocolatey.IsChecked)
|
$ChocoPreference = $($sync.WPFpreferChocolatey.IsChecked)
|
||||||
Invoke-WPFRunspace -ArgumentList $PackagesToInstall,$ChocoPreference -DebugPreference $DebugPreference -ScriptBlock {
|
$installHandle = Invoke-WPFRunspace -ParameterList @(("PackagesToInstall", $PackagesToInstall),("ChocoPreference", $ChocoPreference)) -DebugPreference $DebugPreference -ScriptBlock {
|
||||||
param($PackagesToInstall, $ChocoPreference, $DebugPreference)
|
param($PackagesToInstall, $ChocoPreference, $DebugPreference)
|
||||||
if ($PackagesToInstall.count -eq 1) {
|
if ($PackagesToInstall.count -eq 1) {
|
||||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" })
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" })
|
||||||
|
@ -17,7 +17,7 @@ function Invoke-WPFPresets {
|
|||||||
|
|
||||||
param (
|
param (
|
||||||
[Parameter(position=0)]
|
[Parameter(position=0)]
|
||||||
[string]$preset = "",
|
[Array]$preset = "",
|
||||||
|
|
||||||
[Parameter(position=1)]
|
[Parameter(position=1)]
|
||||||
[bool]$imported = $false,
|
[bool]$imported = $false,
|
||||||
@ -51,7 +51,7 @@ function Invoke-WPFPresets {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Check if the checkbox name exists in the flattened JSON hashtable
|
# Check if the checkbox name exists in the flattened JSON hashtable
|
||||||
if ($CheckBoxesToCheck.Contains($checkboxName)) {
|
if ($CheckBoxesToCheck -contains $checkboxName) {
|
||||||
# If it exists, set IsChecked to true
|
# If it exists, set IsChecked to true
|
||||||
$sync.$checkboxName.IsChecked = $true
|
$sync.$checkboxName.IsChecked = $true
|
||||||
Write-Debug "$checkboxName is checked"
|
Write-Debug "$checkboxName is checked"
|
||||||
|
@ -11,17 +11,23 @@ function Invoke-WPFRunspace {
|
|||||||
.PARAMETER ArgumentList
|
.PARAMETER ArgumentList
|
||||||
A list of arguments to pass to the runspace
|
A list of arguments to pass to the runspace
|
||||||
|
|
||||||
|
.PARAMETER ParameterList
|
||||||
|
A list of named parameters that should be provided.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Invoke-WPFRunspace `
|
Invoke-WPFRunspace `
|
||||||
-ScriptBlock $sync.ScriptsInstallPrograms `
|
-ScriptBlock $sync.ScriptsInstallPrograms `
|
||||||
-ArgumentList "Installadvancedip,Installbitwarden" `
|
-ArgumentList "Installadvancedip,Installbitwarden" `
|
||||||
|
|
||||||
|
Invoke-WPFRunspace`
|
||||||
|
-ScriptBlock $sync.ScriptsInstallPrograms `
|
||||||
|
-ParameterList @(("PackagesToInstall", @("Installadvancedip,Installbitwarden")),("ChocoPreference", $true))
|
||||||
#>
|
#>
|
||||||
|
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
Param (
|
Param (
|
||||||
$ScriptBlock,
|
$ScriptBlock,
|
||||||
$ArgumentList,
|
$ArgumentList,
|
||||||
|
$ParameterList,
|
||||||
$DebugPreference
|
$DebugPreference
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -30,8 +36,10 @@ function Invoke-WPFRunspace {
|
|||||||
|
|
||||||
# Add Scriptblock and Arguments to runspace
|
# Add Scriptblock and Arguments to runspace
|
||||||
$script:powershell.AddScript($ScriptBlock)
|
$script:powershell.AddScript($ScriptBlock)
|
||||||
foreach ($Argument in $ArgumentList) {
|
$script:powershell.AddArgument($ArgumentList)
|
||||||
$script:powershell.AddArgument($Argument)
|
|
||||||
|
foreach ($parameter in $ParameterList) {
|
||||||
|
$script:powershell.AddParameter($parameter[0], $parameter[1])
|
||||||
}
|
}
|
||||||
$script:powershell.AddArgument($DebugPreference) # Pass DebugPreference to the script block
|
$script:powershell.AddArgument($DebugPreference) # Pass DebugPreference to the script block
|
||||||
$script:powershell.RunspacePool = $sync.runspace
|
$script:powershell.RunspacePool = $sync.runspace
|
||||||
@ -47,4 +55,6 @@ function Invoke-WPFRunspace {
|
|||||||
$sync.runspace.Close()
|
$sync.runspace.Close()
|
||||||
[System.GC]::Collect()
|
[System.GC]::Collect()
|
||||||
}
|
}
|
||||||
|
# Return the handle
|
||||||
|
return $handle
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ function Invoke-WPFUIElements {
|
|||||||
|
|
||||||
$window = $sync["Form"]
|
$window = $sync["Form"]
|
||||||
|
|
||||||
$theme = $sync.configs.themes.$ctttheme
|
$theme = $sync.Form.Resources
|
||||||
$borderstyle = $window.FindResource("BorderStyle")
|
$borderstyle = $window.FindResource("BorderStyle")
|
||||||
$HoverTextBlockStyle = $window.FindResource("HoverTextBlockStyle")
|
$HoverTextBlockStyle = $window.FindResource("HoverTextBlockStyle")
|
||||||
$ColorfulToggleSwitchStyle = $window.FindResource("ColorfulToggleSwitchStyle")
|
$ColorfulToggleSwitchStyle = $window.FindResource("ColorfulToggleSwitchStyle")
|
||||||
@ -186,7 +186,7 @@ function Invoke-WPFUIElements {
|
|||||||
$label.ToolTip = $entryInfo.Description
|
$label.ToolTip = $entryInfo.Description
|
||||||
$label.HorizontalAlignment = "Left"
|
$label.HorizontalAlignment = "Left"
|
||||||
$label.FontSize = $theme.FontSize
|
$label.FontSize = $theme.FontSize
|
||||||
$label.Foreground = $theme.MainForegroundColor
|
$label.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "MainForegroundColor")
|
||||||
$dockPanel.Children.Add($label) | Out-Null
|
$dockPanel.Children.Add($label) | Out-Null
|
||||||
$stackPanel.Children.Add($dockPanel) | Out-Null
|
$stackPanel.Children.Add($dockPanel) | Out-Null
|
||||||
|
|
||||||
@ -207,14 +207,14 @@ function Invoke-WPFUIElements {
|
|||||||
$toggleButton.HorizontalAlignment = "Left"
|
$toggleButton.HorizontalAlignment = "Left"
|
||||||
$toggleButton.Height = $theme.TabButtonHeight
|
$toggleButton.Height = $theme.TabButtonHeight
|
||||||
$toggleButton.Width = $theme.TabButtonWidth
|
$toggleButton.Width = $theme.TabButtonWidth
|
||||||
$toggleButton.Background = $theme.ButtonInstallBackgroundColor
|
$toggleButton.SetResourceReference([Windows.Controls.Control]::BackgroundProperty, "ButtonInstallBackgroundColor")
|
||||||
$toggleButton.Foreground = [Windows.Media.Brushes]::White
|
$toggleButton.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "MainForegroundColor")
|
||||||
$toggleButton.FontWeight = [Windows.FontWeights]::Bold
|
$toggleButton.FontWeight = [Windows.FontWeights]::Bold
|
||||||
|
|
||||||
$textBlock = New-Object Windows.Controls.TextBlock
|
$textBlock = New-Object Windows.Controls.TextBlock
|
||||||
$textBlock.FontSize = $theme.TabButtonFontSize
|
$textBlock.FontSize = $theme.TabButtonFontSize
|
||||||
$textBlock.Background = [Windows.Media.Brushes]::Transparent
|
$textBlock.Background = [Windows.Media.Brushes]::Transparent
|
||||||
$textBlock.Foreground = $theme.ButtonInstallForegroundColor
|
$textBlock.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "ButtonInstallForegroundColor")
|
||||||
|
|
||||||
$underline = New-Object Windows.Documents.Underline
|
$underline = New-Object Windows.Documents.Underline
|
||||||
$underline.Inlines.Add($entryInfo.name -replace "(.).*", "`$1")
|
$underline.Inlines.Add($entryInfo.name -replace "(.).*", "`$1")
|
||||||
@ -292,7 +292,7 @@ function Invoke-WPFUIElements {
|
|||||||
$checkBox.FontSize = $theme.FontSize
|
$checkBox.FontSize = $theme.FontSize
|
||||||
$checkBox.ToolTip = $entryInfo.Description
|
$checkBox.ToolTip = $entryInfo.Description
|
||||||
$checkBox.Margin = $theme.CheckBoxMargin
|
$checkBox.Margin = $theme.CheckBoxMargin
|
||||||
if ($entryInfo.Checked) {
|
if ($entryInfo.Checked -eq $true) {
|
||||||
$checkBox.IsChecked = $entryInfo.Checked
|
$checkBox.IsChecked = $entryInfo.Checked
|
||||||
}
|
}
|
||||||
$horizontalStackPanel.Children.Add($checkBox) | Out-Null
|
$horizontalStackPanel.Children.Add($checkBox) | Out-Null
|
||||||
|
@ -50,14 +50,14 @@ Function Invoke-WPFUltimatePerformance {
|
|||||||
|
|
||||||
} elseif ($State -eq "Disable") {
|
} elseif ($State -eq "Disable") {
|
||||||
# Check if the Ultimate Performance plan is installed by GUID
|
# Check if the Ultimate Performance plan is installed by GUID
|
||||||
$installedPlan = powercfg -list | Select-String -Pattern $ultimateGUID
|
$installedPlan = (powercfg -list | Select-String -Pattern "ChrisTitus - Ultimate Power Plan").Line.Split()[3]
|
||||||
|
|
||||||
if ($installedPlan) {
|
if ($installedPlan) {
|
||||||
# Extract the GUID of the installed Ultimate Performance plan
|
# Extract the GUID of the installed Ultimate Performance plan
|
||||||
$ultimatePlanGUID = $installedPlan.Line.Split()[3]
|
$ultimatePlanGUID = $installedPlan.Line.Split()[3]
|
||||||
|
|
||||||
# Set a different power plan as active before deleting the Ultimate Performance plan
|
# Set a different power plan as active before deleting the Ultimate Performance plan
|
||||||
$balancedPlanGUID = (powercfg -list | Select-String -Pattern "Balanced").Line.Split()[3]
|
$balancedPlanGUID = 381b4222-f694-41f0-9685-ff5bb260df2e
|
||||||
powercfg -setactive $balancedPlanGUID
|
powercfg -setactive $balancedPlanGUID
|
||||||
|
|
||||||
# Delete the Ultimate Performance plan by GUID
|
# Delete the Ultimate Performance plan by GUID
|
||||||
|
@ -30,7 +30,7 @@ function Invoke-WPFUnInstall {
|
|||||||
if($confirm -eq "No") {return}
|
if($confirm -eq "No") {return}
|
||||||
$ChocoPreference = $($sync.WPFpreferChocolatey.IsChecked)
|
$ChocoPreference = $($sync.WPFpreferChocolatey.IsChecked)
|
||||||
|
|
||||||
Invoke-WPFRunspace -ArgumentList $PackagesToInstall, $ChocoPreference -DebugPreference $DebugPreference -ScriptBlock {
|
Invoke-WPFRunspace -ArgumentList @(("PackagesToInstall", $PackagesToInstall),("ChocoPreference", $ChocoPreference)) -DebugPreference $DebugPreference -ScriptBlock {
|
||||||
param($PackagesToInstall, $ChocoPreference, $DebugPreference)
|
param($PackagesToInstall, $ChocoPreference, $DebugPreference)
|
||||||
if ($PackagesToInstall.count -eq 1) {
|
if ($PackagesToInstall.count -eq 1) {
|
||||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" })
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" })
|
||||||
|
@ -24,8 +24,12 @@ function Invoke-WPFtweaksbutton {
|
|||||||
|
|
||||||
Write-Debug "Number of tweaks to process: $($Tweaks.Count)"
|
Write-Debug "Number of tweaks to process: $($Tweaks.Count)"
|
||||||
|
|
||||||
Invoke-WPFRunspace -ArgumentList $Tweaks -DebugPreference $DebugPreference -ScriptBlock {
|
# The leading "," in the ParameterList is nessecary because we only provide one argument and powershell cannot be convinced that we want a nested loop with only one argument otherwise
|
||||||
param($Tweaks, $DebugPreference)
|
$tweaksHandle = Invoke-WPFRunspace -ParameterList @(,("tweaks",$tweaks)) -DebugPreference $DebugPreference -ScriptBlock {
|
||||||
|
param(
|
||||||
|
$tweaks,
|
||||||
|
$DebugPreference
|
||||||
|
)
|
||||||
Write-Debug "Inside Number of tweaks to process: $($Tweaks.Count)"
|
Write-Debug "Inside Number of tweaks to process: $($Tweaks.Count)"
|
||||||
|
|
||||||
$sync.ProcessRunning = $true
|
$sync.ProcessRunning = $true
|
||||||
@ -38,8 +42,9 @@ function Invoke-WPFtweaksbutton {
|
|||||||
# Execute other selected tweaks
|
# Execute other selected tweaks
|
||||||
|
|
||||||
for ($i = 0; $i -lt $Tweaks.Count; $i++) {
|
for ($i = 0; $i -lt $Tweaks.Count; $i++) {
|
||||||
Set-WinUtilProgressBar -Label "Applying $($tweaks[$i])" -Percent ($i / $Tweaks.Count * 100)
|
Set-WinUtilProgressBar -Label "Applying $($tweaks[$i])" -Percent ($i / $tweaks.Count * 100)
|
||||||
Invoke-WinUtilTweaks $tweaks[$i]$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($i/$Tweaks.Count) })
|
Invoke-WinUtilTweaks $tweaks[$i]
|
||||||
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($i/$Tweaks.Count) })
|
||||||
}
|
}
|
||||||
Set-WinUtilProgressBar -Label "Tweaks finished" -Percent 100
|
Set-WinUtilProgressBar -Label "Tweaks finished" -Percent 100
|
||||||
$sync.ProcessRunning = $false
|
$sync.ProcessRunning = $false
|
||||||
|
165
scripts/main.ps1
165
scripts/main.ps1
@ -52,29 +52,6 @@ $sync.runspace.Open()
|
|||||||
|
|
||||||
$inputXML = $inputXML -replace 'mc:Ignorable="d"', '' -replace "x:N", 'N' -replace '^<Win.*', '<Window'
|
$inputXML = $inputXML -replace 'mc:Ignorable="d"', '' -replace "x:N", 'N' -replace '^<Win.*', '<Window'
|
||||||
|
|
||||||
$defaulttheme = '_default'
|
|
||||||
if ((Get-WinUtilToggleStatus WPFToggleDarkMode) -eq $True) {
|
|
||||||
if (Invoke-WinUtilGPU -eq $True) {
|
|
||||||
$ctttheme = 'Matrix'
|
|
||||||
} else {
|
|
||||||
$ctttheme = 'Dark'
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$ctttheme = 'Classic'
|
|
||||||
}
|
|
||||||
|
|
||||||
$returnVal = Set-WinUtilUITheme -inputXML $inputXML -customThemeName $ctttheme -defaultThemeName $defaulttheme
|
|
||||||
if ($returnVal[0] -eq "") {
|
|
||||||
Write-Host "Failed to statically apply theming to xaml content using Set-WinUtilTheme, please check previous Error/Warning messages." -ForegroundColor Red
|
|
||||||
Write-Host "Quitting winutil..." -ForegroundColor Red
|
|
||||||
$sync.runspace.Dispose()
|
|
||||||
$sync.runspace.Close()
|
|
||||||
[System.GC]::Collect()
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
$inputXML = $returnVal[0]
|
|
||||||
$ctttheme = $returnVal[1]
|
|
||||||
|
|
||||||
[void][System.Reflection.Assembly]::LoadWithPartialName('presentationframework')
|
[void][System.Reflection.Assembly]::LoadWithPartialName('presentationframework')
|
||||||
[xml]$XAML = $inputXML
|
[xml]$XAML = $inputXML
|
||||||
|
|
||||||
@ -104,6 +81,35 @@ if (-NOT ($readerOperationSuccessful)) {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Setup the Window to follow listen for windows Theme Change events and update the winutil theme
|
||||||
|
# throttle logic needed, because windows seems to send more than one theme change event per change
|
||||||
|
$lastThemeChangeTime = [datetime]::MinValue
|
||||||
|
$debounceInterval = [timespan]::FromSeconds(2)
|
||||||
|
$sync.Form.Add_Loaded({
|
||||||
|
$interopHelper = New-Object System.Windows.Interop.WindowInteropHelper $sync.Form
|
||||||
|
$hwndSource = [System.Windows.Interop.HwndSource]::FromHwnd($interopHelper.Handle)
|
||||||
|
$hwndSource.AddHook({
|
||||||
|
param (
|
||||||
|
[System.IntPtr]$hwnd,
|
||||||
|
[int]$msg,
|
||||||
|
[System.IntPtr]$wParam,
|
||||||
|
[System.IntPtr]$lParam,
|
||||||
|
[ref]$handled
|
||||||
|
)
|
||||||
|
# Check for the Event WM_SETTINGCHANGE (0x1001A) and validate that Button shows the icon for "Auto" => [char]0xF08C
|
||||||
|
if (($msg -eq 0x001A) -and $sync.ThemeButton.Content -eq [char]0xF08C) {
|
||||||
|
$currentTime = [datetime]::Now
|
||||||
|
if ($currentTime - $lastThemeChangeTime -gt $debounceInterval) {
|
||||||
|
Invoke-WinutilThemeChange -theme "Auto"
|
||||||
|
$script:lastThemeChangeTime = $currentTime
|
||||||
|
$handled = $true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
Invoke-WinutilThemeChange -init $true
|
||||||
# Load the configuration files
|
# Load the configuration files
|
||||||
#Invoke-WPFUIElements -configVariable $sync.configs.nav -targetGridName "WPFMainGrid"
|
#Invoke-WPFUIElements -configVariable $sync.configs.nav -targetGridName "WPFMainGrid"
|
||||||
Invoke-WPFUIElements -configVariable $sync.configs.applications -targetGridName "appspanel" -columncount 5
|
Invoke-WPFUIElements -configVariable $sync.configs.applications -targetGridName "appspanel" -columncount 5
|
||||||
@ -248,24 +254,34 @@ $commonKeyEvents = {
|
|||||||
$sync["Form"].Add_PreViewKeyDown($commonKeyEvents)
|
$sync["Form"].Add_PreViewKeyDown($commonKeyEvents)
|
||||||
|
|
||||||
$sync["Form"].Add_MouseLeftButtonDown({
|
$sync["Form"].Add_MouseLeftButtonDown({
|
||||||
if ($sync["SettingsPopup"].IsOpen) {
|
# Hide Settings and Theme Popup on click anywhere else
|
||||||
$sync["SettingsPopup"].IsOpen = $false
|
if ($sync.SettingsButton.IsOpen -or
|
||||||
|
$sync.ThemePopup.IsOpen) {
|
||||||
|
$sync.SettingsPopup.IsOpen = $false
|
||||||
|
$sync.ThemePopup.IsOpen = $false
|
||||||
}
|
}
|
||||||
$sync["Form"].DragMove()
|
$sync["Form"].DragMove()
|
||||||
})
|
})
|
||||||
|
|
||||||
$sync["Form"].Add_MouseDoubleClick({
|
$sync["Form"].Add_MouseDoubleClick({
|
||||||
|
if ($_.OriginalSource -is [System.Windows.Controls.Grid] -or
|
||||||
|
$_.OriginalSource -is [System.Windows.Controls.StackPanel]) {
|
||||||
if ($sync["Form"].WindowState -eq [Windows.WindowState]::Normal) {
|
if ($sync["Form"].WindowState -eq [Windows.WindowState]::Normal) {
|
||||||
$sync["Form"].WindowState = [Windows.WindowState]::Maximized;
|
$sync["Form"].WindowState = [Windows.WindowState]::Maximized
|
||||||
} else {
|
}
|
||||||
$sync["Form"].WindowState = [Windows.WindowState]::Normal;
|
else{
|
||||||
|
$sync["Form"].WindowState = [Windows.WindowState]::Normal
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
$sync["Form"].Add_Deactivated({
|
$sync["Form"].Add_Deactivated({
|
||||||
Write-Debug "WinUtil lost focus"
|
Write-Debug "WinUtil lost focus"
|
||||||
if ($sync["SettingsPopup"].IsOpen) {
|
# Hide Settings and Theme Popup on Winutil Focus Loss
|
||||||
$sync["SettingsPopup"].IsOpen = $false
|
if ($sync.SettingsButton.IsOpen -or
|
||||||
|
$sync.ThemePopup.IsOpen) {
|
||||||
|
$sync.SettingsPopup.IsOpen = $false
|
||||||
|
$sync.ThemePopup.IsOpen = $false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -383,6 +399,35 @@ Add-Type @"
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
# Add event handlers for the RadioButtons
|
||||||
|
$sync["ISOdownloader"].add_Checked({
|
||||||
|
$sync["ISORelease"].Visibility = [System.Windows.Visibility]::Visible
|
||||||
|
$sync["ISOLanguage"].Visibility = [System.Windows.Visibility]::Visible
|
||||||
|
})
|
||||||
|
|
||||||
|
$sync["ISOmanual"].add_Checked({
|
||||||
|
$sync["ISORelease"].Visibility = [System.Windows.Visibility]::Collapsed
|
||||||
|
$sync["ISOLanguage"].Visibility = [System.Windows.Visibility]::Collapsed
|
||||||
|
})
|
||||||
|
|
||||||
|
$sync["ISORelease"].Items.Add("23H2") | Out-Null
|
||||||
|
$sync["ISORelease"].Items.Add("22H2") | Out-Null
|
||||||
|
$sync["ISORelease"].Items.Add("21H2") | Out-Null
|
||||||
|
$sync["ISORelease"].SelectedItem = "23H2"
|
||||||
|
|
||||||
|
$sync["ISOLanguage"].Items.Add("System Language ($(Get-FidoLangFromCulture -langName $((Get-Culture).Name)))") | Out-Null
|
||||||
|
if ($currentCulture -ne "English International") {
|
||||||
|
$sync["ISOLanguage"].Items.Add("English International") | Out-Null
|
||||||
|
}
|
||||||
|
if ($currentCulture -ne "English") {
|
||||||
|
$sync["ISOLanguage"].Items.Add("English") | Out-Null
|
||||||
|
}
|
||||||
|
if ($sync["ISOLanguage"].Items.Count -eq 1) {
|
||||||
|
$sync["ISOLanguage"].IsEnabled = $false
|
||||||
|
}
|
||||||
|
$sync["ISOLanguage"].SelectedIndex = 0
|
||||||
|
|
||||||
|
|
||||||
# Load Checkboxes and Labels outside of the Filter function only once on startup for performance reasons
|
# Load Checkboxes and Labels outside of the Filter function only once on startup for performance reasons
|
||||||
$filter = Get-WinUtilVariables -Type CheckBox
|
$filter = Get-WinUtilVariables -Type CheckBox
|
||||||
$CheckBoxes = ($sync.GetEnumerator()).where{ $psitem.Key -in $filter }
|
$CheckBoxes = ($sync.GetEnumerator()).where{ $psitem.Key -in $filter }
|
||||||
@ -405,8 +450,8 @@ $sync["SearchBar"].Add_TextChanged({
|
|||||||
$textToSearch = $sync.SearchBar.Text.ToLower()
|
$textToSearch = $sync.SearchBar.Text.ToLower()
|
||||||
|
|
||||||
foreach ($CheckBox in $CheckBoxes) {
|
foreach ($CheckBox in $CheckBoxes) {
|
||||||
# Check if the checkbox is null or if it doesn't have content
|
# Skip if the checkbox is null, it doesn't have content or it is the prefer Choco checkbox
|
||||||
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 -or $CheckBox.Name -eq "WPFpreferChocolatey") {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -478,15 +523,47 @@ Set-WinUtilTaskbaritem -overlay "logo"
|
|||||||
$sync["Form"].Add_Activated({
|
$sync["Form"].Add_Activated({
|
||||||
Set-WinUtilTaskbaritem -overlay "logo"
|
Set-WinUtilTaskbaritem -overlay "logo"
|
||||||
})
|
})
|
||||||
|
# Define event handler for ThemeButton click
|
||||||
|
$sync["ThemeButton"].Add_Click({
|
||||||
|
if ($sync.ThemePopup.IsOpen) {
|
||||||
|
$sync.ThemePopup.IsOpen = $false
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$sync.ThemePopup.IsOpen = $true
|
||||||
|
}
|
||||||
|
$sync.SettingsPopup.IsOpen = $false
|
||||||
|
})
|
||||||
|
|
||||||
|
# Define event handlers for menu items
|
||||||
|
$sync["AutoThemeMenuItem"].Add_Click({
|
||||||
|
$sync.ThemePopup.IsOpen = $false
|
||||||
|
Invoke-WinutilThemeChange -theme "Auto"
|
||||||
|
$_.Handled = $false
|
||||||
|
})
|
||||||
|
# Define event handlers for menu items
|
||||||
|
$sync["DarkThemeMenuItem"].Add_Click({
|
||||||
|
$sync.ThemePopup.IsOpen = $false
|
||||||
|
Invoke-WinutilThemeChange -theme "Dark"
|
||||||
|
$_.Handled = $false
|
||||||
|
})
|
||||||
|
# Define event handlers for menu items
|
||||||
|
$sync["LightThemeMenuItem"].Add_Click({
|
||||||
|
$sync.ThemePopup.IsOpen = $false
|
||||||
|
Invoke-WinutilThemeChange -theme "Light"
|
||||||
|
$_.Handled = $false
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
# Define event handler for button click
|
# Define event handler for button click
|
||||||
$sync["SettingsButton"].Add_Click({
|
$sync["SettingsButton"].Add_Click({
|
||||||
Write-Debug "SettingsButton clicked"
|
Write-Debug "SettingsButton clicked"
|
||||||
if ($sync["SettingsPopup"].IsOpen) {
|
if ($sync.SettingsPopup.IsOpen) {
|
||||||
$sync["SettingsPopup"].IsOpen = $false
|
$sync.SettingsPopup.IsOpen = $false
|
||||||
} else {
|
|
||||||
$sync["SettingsPopup"].IsOpen = $true
|
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
$sync.SettingsPopup.IsOpen = $true
|
||||||
|
}
|
||||||
|
$sync.ThemePopup.IsOpen = $false
|
||||||
$_.Handled = $false
|
$_.Handled = $false
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -518,12 +595,8 @@ MicroWin : <a href="https://github.com/KonTy">@KonTy</a>
|
|||||||
GitHub : <a href="https://github.com/ChrisTitusTech/winutil">ChrisTitusTech/winutil</a>
|
GitHub : <a href="https://github.com/ChrisTitusTech/winutil">ChrisTitusTech/winutil</a>
|
||||||
Version : <a href="https://github.com/ChrisTitusTech/winutil/releases/tag/$($sync.version)">$($sync.version)</a>
|
Version : <a href="https://github.com/ChrisTitusTech/winutil/releases/tag/$($sync.version)">$($sync.version)</a>
|
||||||
"@
|
"@
|
||||||
$FontSize = $sync.configs.themes.$ctttheme.CustomDialogFontSize
|
|
||||||
$HeaderFontSize = $sync.configs.themes.$ctttheme.CustomDialogFontSizeHeader
|
Show-CustomDialog -Message $authorInfo -LogoSize $LogoSize
|
||||||
$LogoSize = $sync.configs.themes.$ctttheme.CustomDialogLogoSize
|
|
||||||
$Width = $sync.configs.themes.$ctttheme.CustomDialogWidth
|
|
||||||
$Height = $sync.configs.themes.$ctttheme.CustomDialogHeight
|
|
||||||
Show-CustomDialog -Message $authorInfo -Width $Width -Height $Height -FontSize $FontSize -HeaderFontSize $HeaderFontSize -LogoSize $LogoSize
|
|
||||||
})
|
})
|
||||||
|
|
||||||
$sync["SponsorMenuItem"].Add_Click({
|
$sync["SponsorMenuItem"].Add_Click({
|
||||||
@ -544,12 +617,8 @@ $sync["SponsorMenuItem"].Add_Click({
|
|||||||
$authorInfo += "An error occurred while fetching or processing the sponsors: $_`n"
|
$authorInfo += "An error occurred while fetching or processing the sponsors: $_`n"
|
||||||
}
|
}
|
||||||
|
|
||||||
$FontSize = $sync.configs.themes.$ctttheme.CustomDialogFontSize
|
Show-CustomDialog -Message $authorInfo -EnableScroll $true
|
||||||
$HeaderFontSize = $sync.configs.themes.$ctttheme.CustomDialogFontSizeHeader
|
|
||||||
$LogoSize = $sync.configs.themes.$ctttheme.CustomDialogLogoSize
|
|
||||||
$Width = $sync.configs.themes.$ctttheme.CustomDialogWidth
|
|
||||||
$Height = $sync.configs.themes.$ctttheme.CustomDialogHeight
|
|
||||||
Show-CustomDialog -Message $authorInfo -Width $Width -Height $Height -FontSize $FontSize -HeaderFontSize $HeaderFontSize -LogoSize $LogoSize -EnableScroll $true
|
|
||||||
})
|
})
|
||||||
|
|
||||||
$sync["Form"].ShowDialog() | out-null
|
$sync["Form"].ShowDialog() | out-null
|
||||||
Stop-Transcript
|
Stop-Transcript
|
||||||
|
@ -72,80 +72,45 @@ function Invoke-Preprocessing {
|
|||||||
throw "[Invoke-Preprocessing] Invalid Paramter Value for 'WorkingDir', passed value: '$WorkingDir'. Either the path is a File or Non-Existing/Invlid, please double check your code."
|
throw "[Invoke-Preprocessing] Invalid Paramter Value for 'WorkingDir', passed value: '$WorkingDir'. Either the path is a File or Non-Existing/Invlid, please double check your code."
|
||||||
}
|
}
|
||||||
|
|
||||||
$count = $ExcludedFiles.Count
|
$InternalExcludedFiles = [System.Collections.Generic.List[string]]::new($ExcludedFiles.Count)
|
||||||
|
ForEach ($excludedFile in $ExcludedFiles) {
|
||||||
# Make sure there's a * at the end of folders in ExcludedFiles list
|
$InternalExcludedFiles.Add($excludedFile) | Out-Null
|
||||||
for ($i = 0; $i -lt $count; $i++) {
|
|
||||||
$excludedFile = $ExcludedFiles[$i]
|
|
||||||
$isFolder = ($excludedFile) -match '\\$'
|
|
||||||
if ($isFolder) { $ExcludedFiles[$i] = $excludedFile + '*' }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Validate the ExcludedFiles List before continuing on,
|
# Validate the ExcludedItems List before continuing on,
|
||||||
# that's if there's a list in the first place, and '-SkipExcludedFilesValidation' was not provided.
|
# that's if there's a list in the first place, and '-SkipInternalExcludedFilesValidation' was not provided.
|
||||||
if (-not $SkipExcludedFilesValidation) {
|
if ($ExcludedFiles.Count -gt 0) {
|
||||||
for ($i = 0; $i -lt $count; $i++) {
|
ForEach ($excludedFile in $ExcludedFiles) {
|
||||||
$excludedFile = $ExcludedFiles[$i]
|
|
||||||
$filePath = "$(($WorkingDir -replace ('\\$', '')) + '\' + ($excludedFile -replace ('\.\\', '')))"
|
$filePath = "$(($WorkingDir -replace ('\\$', '')) + '\' + ($excludedFile -replace ('\.\\', '')))"
|
||||||
|
$files = Get-ChildItem -Recurse -Path "$filePath" -File -Force
|
||||||
# Handle paths with wildcards in a different implementation
|
if ($files.Count -gt 0) {
|
||||||
$matches = ($filePath) -match '^.*?\*'
|
ForEach ($file in $files) {
|
||||||
|
$InternalExcludedFiles.Add("$($file.FullName)") | Out-Null
|
||||||
if ($matches) {
|
|
||||||
if (-NOT (Get-ChildItem -Recurse -Path "$filePath" -File -Force)) {
|
|
||||||
$failedFilesList += "'$filePath', "
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (-NOT (Test-Path -Path "$filePath")) {
|
|
||||||
$failedFilesList += "'$filePath', "
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
} else { $failedFilesList += "'$filePath', " }
|
||||||
}
|
}
|
||||||
$failedFilesList = $failedFilesList -replace (',\s*$', '')
|
$failedFilesList = $failedFilesList -replace (',\s*$', '')
|
||||||
if (-NOT $failedFilesList -eq "") {
|
if ((-not $failedFilesList -eq "") -and (-not $SkipExcludedFilesValidation)) {
|
||||||
throw "[Invoke-Preprocessing] One or more File Paths and/or File Patterns were not found, you can use '-SkipExcludedFilesValidation' switch to skip this check, the failed to validate are: $failedFilesList"
|
throw "[Invoke-Preprocessing] One or more File Paths and/or File Patterns were not found, you can use '-SkipExcludedFilesValidation' switch to skip this check, the failed to validate are: $failedFilesList"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get Files List
|
# Get Files List
|
||||||
[System.Collections.ArrayList]$files = Get-ChildItem $WorkingDir -Recurse -Exclude $ExcludedFiles -File -Force
|
[System.Collections.ArrayList]$files = Get-ChildItem -LiteralPath $WorkingDir -Recurse -Exclude $InternalExcludedFiles -File -Force
|
||||||
$numOfFiles = $files.Count
|
|
||||||
|
|
||||||
# Only keep the 'FullName' Property for every entry in the list
|
# Only keep the 'FullName' Property for every entry in the list
|
||||||
for ($i = 0; $i -lt $numOfFiles; $i++) {
|
for ($i = 0; $i -lt $files.Count; $i++) {
|
||||||
$file = $files[$i]
|
$file = $files[$i]
|
||||||
$files[$i] = $file.FullName
|
$files[$i] = $file.FullName
|
||||||
}
|
}
|
||||||
|
|
||||||
# If a file(s) are found in Exclude List,
|
# If a file(s) are found in Exclude List,
|
||||||
# Remove the file from files list.
|
# Remove the file from files list.
|
||||||
for ($j = 0; $j -lt $excludedFiles.Count; $j++) {
|
ForEach ($excludedFile in $InternalExcludedFiles) {
|
||||||
# Prepare some variables
|
$index = $files.IndexOf("$excludedFile")
|
||||||
$excluded = $excludedFiles[$j]
|
|
||||||
$pathToFind = ($excluded) -replace ('^\.\\', '')
|
|
||||||
$pathToFind = $WorkingDir + '\' + $pathToFind
|
|
||||||
$index = -1 # reset index on every iteration
|
|
||||||
|
|
||||||
# Handle paths with wildcards in a different implementation
|
|
||||||
$matches = ($pathToFind) -match '^.*?\*'
|
|
||||||
|
|
||||||
if ($matches) {
|
|
||||||
$filesToCheck = Get-ChildItem -Recurse -Path "$pathToFind" -File -Force
|
|
||||||
if ($filesToCheck) {
|
|
||||||
for ($k = 0; $k -lt $filesToCheck.Count; $k++) {
|
|
||||||
$fileToCheck = $filesToCheck[$k]
|
|
||||||
$index = $files.IndexOf("$fileToCheck")
|
|
||||||
if ($index -ge 0) { $files.RemoveAt($index) }
|
if ($index -ge 0) { $files.RemoveAt($index) }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$index = $files.IndexOf("$pathToFind")
|
|
||||||
if ($index -ge 0) { $files.RemoveAt($index) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Make sure 'numOfFiles' is synced with the actual Number of Files found in '$files'
|
|
||||||
# This's done because previous may or may not edit the files list, so we should update it
|
|
||||||
$numOfFiles = $files.Count
|
$numOfFiles = $files.Count
|
||||||
|
|
||||||
if ($numOfFiles -eq 0) {
|
if ($numOfFiles -eq 0) {
|
||||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user