diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md new file mode 100644 index 0000000000..b030c80ab5 --- /dev/null +++ b/.github/CODE_OF_CONDUCT.md @@ -0,0 +1,128 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +contact@christitus.com. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index d0ae5a1de3..122ac29eed 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,7 +1,9 @@ # Pull Request + + ## Title -[Provide a succinct and descriptive title for the pull request.] + ## Type of Change - [ ] New feature @@ -13,20 +15,20 @@ - [ ] UI/UX improvement ## Description -[Provide a detailed explanation of the changes you have made. Include the reasons behind these changes and any relevant context. Link any related issues.] + ## Testing -[Detail the testing you have performed to ensure that these changes function as intended. Include information about any added tests.] + ## Impact -[Discuss the impact of your changes on the project. This might include effects on performance, new dependencies, or changes in behaviour.] + ## Issue related to PR -[What issue/discussion is related to this PR (if any)] + - Resolves # ## Additional Information -[Any additional information that reviewers should be aware of.] + ## Checklist - [ ] My code adheres to the coding and style guidelines of the project. diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000000..66014bf890 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,58 @@ +name-template: '$RESOLVED_VERSION' +tag-template: '$RESOLVED_VERSION' +tag-prefix: "" +categories: + - title: '🚀 Features' + labels: + - 'feature' + - 'enhancement' + - title: '🐛 Bug Fixes' + labels: + - 'fix' + - 'bugfix' + - 'bug' + - title: '📚 Documentation' + label: 'documentation' + - title: '🔒 Security' + label: 'security' +change-template: '- $TITLE @$AUTHOR (#$NUMBER)' +template: | + ## Changes + + $CHANGES + + ## Contributors + + $CONTRIBUTORS + +change-title-escapes: '\<*_&"''' +autolabeler: + - label: 'documentation' + files: + - '*.md' + branch: + - '/docs{0,1}\/.+/' + - label: 'bug' + branch: + - '/fix\/.+/' + title: + - '/fix/i' + - label: 'enhancement' + branch: + - '/feature\/.+/' + body: + - '/[A-Z]+-[0-9]+/' + - label: 'documentation' + files: + - '**/*.md' + - 'docs/**/*' + - label: 'security' + branch: + - '/security\/.+/' +replacers: + - search: /"/g + replace: '' + - search: /'/g + replace: '' +exclude-labels: + - 'skip-changelog' diff --git a/.github/workflows/close-old-issues.yaml b/.github/workflows/close-old-issues.yaml index ace4bb3444..43ef794e2a 100644 --- a/.github/workflows/close-old-issues.yaml +++ b/.github/workflows/close-old-issues.yaml @@ -22,8 +22,8 @@ jobs: exempt-issue-labels: "Keep Issue Open" # Split it into two weeks, after one week the issue will be marked as stale, # after another week have pasted without any update.. the issue will then be closed. - days-before-issue-stale: 7 - days-before-issue-close: 7 + days-before-issue-stale: 90 + days-before-issue-close: 365 # NEVER mark PRs as Stale or Close + this workflow should never have write permissions on PRs, EVER! days-before-pr-stale: -1 days-before-pr-close: -1 diff --git a/.github/workflows/github-pages.yaml b/.github/workflows/github-pages.yaml index f4d0ebb3c3..7544820925 100644 --- a/.github/workflows/github-pages.yaml +++ b/.github/workflows/github-pages.yaml @@ -7,6 +7,7 @@ on: - '.github/requirements.txt' - 'docs/**' - 'overrides/**' + - '.github/CONTRIBUTING.md' workflow_dispatch: jobs: diff --git a/.github/workflows/pre-release.yaml b/.github/workflows/pre-release.yaml index d6bf6912d5..c8c0eda9a2 100644 --- a/.github/workflows/pre-release.yaml +++ b/.github/workflows/pre-release.yaml @@ -74,16 +74,27 @@ jobs: name: winutil path: ./winutil.ps1 + - name: Generate Release Notes + id: generate_notes + uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + config-name: release-drafter.yml + version: ${{ env.version }} + - name: Create and Upload Release id: create_release uses: softprops/action-gh-release@v2 with: - tag_name: ${{ env.VERSION }} - name: Pre-Release ${{ env.VERSION }} - body: "![GitHub Downloads (specific asset, specific tag)](https://img.shields.io/github/downloads/ChrisTitusTech/winutil/${{ env.VERSION }}/winutil.ps1)" + tag_name: ${{ env.version }} + name: Pre-Release ${{ env.version }} + body: | + ${{ steps.generate_notes.outputs.body }} + + ![GitHub Downloads (specific asset, specific tag)](https://img.shields.io/github/downloads/ChrisTitusTech/winutil/${{ env.VERSION }}/winutil.ps1) append_body: false files: ./winutil.ps1 prerelease: true - generate_release_notes: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Compile.ps1 b/Compile.ps1 index 07e57b0215..75998956b2 100644 --- a/Compile.ps1 +++ b/Compile.ps1 @@ -1,7 +1,8 @@ param ( [switch]$Debug, [switch]$Run, - [switch]$SkipPreprocessing + [switch]$SkipPreprocessing, + [string]$Arguments ) $OFS = "`r`n" $scriptname = "winutil.ps1" @@ -120,11 +121,13 @@ try { Write-Progress -Activity "Validating" -Completed if ($run) { - try { - Start-Process -FilePath "pwsh" -ArgumentList "$scriptname" - } catch { - Start-Process -FilePath "powershell" -ArgumentList "$scriptname" - } + $script = "& '$workingdir\$scriptname' $Arguments" + + $powershellcmd = if (Get-Command pwsh -ErrorAction SilentlyContinue) { "pwsh" } else { "powershell" } + $processCmd = if (Get-Command wt.exe -ErrorAction SilentlyContinue) { "wt.exe" } else { $powershellcmd } + + Start-Process $processCmd -ArgumentList "$powershellcmd -NoProfile -Command $script" + break } Pop-Location diff --git a/.github/LICENSE b/LICENSE similarity index 96% rename from .github/LICENSE rename to LICENSE index 72d5f72e25..be8a1a82bc 100644 --- a/.github/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2022 Chris Titus +Copyright (c) 2022 CT Tech Group LLC Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index b0820dedb8..adb2ab9b7f 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ If you have Issues, refer to [Known Issues](https://christitustech.github.io/win These are the sponsors that help keep this project alive with monthly contributions. -Yusuke SaitoTriHyderaMark AmosJason A. DiegmuellerwyattStefanthaddlPaulDave JonesAnthony MendezMichael WozniakxPandakuClaudemodsHalil KolatanTimothy Cook +Yusuke SaitoTriHyderaMark AmosJason A. DiegmuellerwyattStefanthaddlPaulDave JonesAnthony MendezMichael WozniakxPandakuClaudemodsHalil KolatanTimothy Cook ## 🏅 Thanks to all Contributors Thanks a lot for spending your time helping Winutil grow. Thanks a lot! Keep rocking 🍻. diff --git a/config/themes.json b/config/themes.json index efada878a7..eedb2f83e5 100644 --- a/config/themes.json +++ b/config/themes.json @@ -6,7 +6,7 @@ "CustomDialogWidth": "400", "CustomDialogHeight": "200", - "FontSize": "14", + "FontSize": "12", "FontFamily": "Arial", "FontSizeHeading": "16", "HeaderFontFamily": "Consolas, Monaco", @@ -26,6 +26,7 @@ "CloseIconFontSize": "18", "MicroWinLogoSize": "10", + "MicrowinCheckBoxMargin": "-10,5,0,0", "ProgressBarForegroundColor": "#FFAC1C", "ProgressBarBackgroundColor": "Transparent", diff --git a/config/tweaks.json b/config/tweaks.json index 104a70ce30..3e3a54da42 100644 --- a/config/tweaks.json +++ b/config/tweaks.json @@ -2713,6 +2713,9 @@ reg delete \"HKEY_USERS\\Default\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\" /v \"OneDriveSetup\" /f reg unload \"hku\\Default\" + Write-Host \"Removing autostart key\" + reg delete \"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\" /v \"OneDrive\" /f + Write-Host \"Removing startmenu entry\" Remove-Item -Force -ErrorAction SilentlyContinue \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\OneDrive.lnk\" @@ -3399,22 +3402,6 @@ "ComboItems": "Default DHCP Google Cloudflare Cloudflare_Malware Cloudflare_Malware_Adult Open_DNS Quad9 AdGuard_Ads_Trackers AdGuard_Ads_Trackers_Malware_Adult", "link": "https://christitustech.github.io/winutil/dev/tweaks/z--Advanced-Tweaks---CAUTION/changedns" }, - "WPFTweaksbutton": { - "Content": "Run Tweaks", - "category": "z__Advanced Tweaks - CAUTION", - "panel": "1", - "Order": "a041_", - "Type": "Button", - "link": "https://christitustech.github.io/winutil/dev/tweaks/z--Advanced-Tweaks---CAUTION/button" - }, - "WPFUndoall": { - "Content": "Undo Selected Tweaks", - "category": "z__Advanced Tweaks - CAUTION", - "panel": "1", - "Order": "a042_", - "Type": "Button", - "link": "https://christitustech.github.io/winutil/dev/tweaks/z--Advanced-Tweaks---CAUTION/Undoall" - }, "WPFAddUltPerf": { "Content": "Add and Activate Ultimate Performance Profile", "category": "Performance Plans", diff --git a/functions/private/Invoke-WinUtilGPU.ps1 b/functions/private/Invoke-WinUtilGPU.ps1 index 926f27944d..2bcbb01b00 100644 --- a/functions/private/Invoke-WinUtilGPU.ps1 +++ b/functions/private/Invoke-WinUtilGPU.ps1 @@ -7,7 +7,9 @@ function Invoke-WinUtilGPU { "*NVIDIA GeForce*Laptop*", "*NVIDIA GeForce*GT*", "*AMD Radeon(TM)*", + "*Intel(R) HD Graphics*", "*UHD*" + ) foreach ($gpu in $gpuInfo) { @@ -18,4 +20,4 @@ function Invoke-WinUtilGPU { } } return $true -} +} \ No newline at end of file diff --git a/functions/private/Invoke-WinUtilMicroWin-Helper.ps1 b/functions/private/Invoke-WinUtilMicroWin-Helper.ps1 index f3ffbd9c5b..d1061d67f3 100644 --- a/functions/private/Invoke-WinUtilMicroWin-Helper.ps1 +++ b/functions/private/Invoke-WinUtilMicroWin-Helper.ps1 @@ -59,6 +59,7 @@ function Remove-Features() { Write-Host "You can re-enable the disabled features at any time, using either Windows Update or the SxS folder in \Sources." } catch { Write-Host "Unable to get information about the features. MicroWin processing will continue, but features will not be processed" + Write-Host "Error information: $($_.Exception.Message)" -ForegroundColor Yellow } } @@ -106,6 +107,8 @@ function Remove-Packages { $_ -NotLike "*Wifi*" } + $failedCount = 0 + foreach ($pkg in $pkglist) { try { $status = "Removing $pkg" @@ -114,12 +117,18 @@ function Remove-Packages { } catch { # This can happen if the package that is being removed is a permanent one, like FodMetadata Write-Host "Could not remove OS package $($pkg)" + $failedCount += 1 continue } } Write-Progress -Activity "Removing Apps" -Status "Ready" -Completed + if ($failedCount -gt 0) + { + Write-Host "Some packages could not be removed. Do not worry: your image will still work fine. This can happen if the package is permanent or has been superseded by a newer one." + } } catch { Write-Host "Unable to get information about the packages. MicroWin processing will continue, but packages will not be processed" + Write-Host "Error information: $($_.Exception.Message)" -ForegroundColor Yellow } } @@ -175,6 +184,7 @@ function Remove-ProvisionedPackages() { { # This can happen if getting AppX packages fails Write-Host "Unable to get information about the AppX packages. MicroWin processing will continue, but AppX packages will not be processed" + Write-Host "Error information: $($_.Exception.Message)" -ForegroundColor Yellow } } diff --git a/functions/private/Update-WinUtilProgramWinget.ps1 b/functions/private/Update-WinUtilProgramWinget.ps1 index 0784657d22..7f50d35e6c 100644 --- a/functions/private/Update-WinUtilProgramWinget.ps1 +++ b/functions/private/Update-WinUtilProgramWinget.ps1 @@ -11,7 +11,7 @@ Function Update-WinUtilProgramWinget { $host.ui.RawUI.WindowTitle = """Winget Install""" - Start-Transcript $ENV:TEMP\winget-update.log -Append + Start-Transcript "$logdir\winget-update_$dateTime.log" -Append winget upgrade --all --accept-source-agreements --accept-package-agreements --scope=machine --silent } diff --git a/functions/public/Invoke-WPFButton.ps1 b/functions/public/Invoke-WPFButton.ps1 index ac5b2f8cdb..e3015f09e0 100644 --- a/functions/public/Invoke-WPFButton.ps1 +++ b/functions/public/Invoke-WPFButton.ps1 @@ -21,13 +21,13 @@ function Invoke-WPFButton { Switch -Wildcard ($Button) { "WPFTab?BT" {Invoke-WPFTab $Button} - "WPFinstall" {Invoke-WPFInstall} - "WPFuninstall" {Invoke-WPFUnInstall} + "WPFInstall" {Invoke-WPFInstall} + "WPFUninstall" {Invoke-WPFUnInstall} "WPFInstallUpgrade" {Invoke-WPFInstallUpgrade} - "WPFstandard" {Invoke-WPFPresets "Standard"} - "WPFminimal" {Invoke-WPFPresets "Minimal"} - "WPFclear" {Invoke-WPFPresets -preset $null -imported $true} - "WPFclearWinget" {Invoke-WPFPresets -preset $null -imported $true -CheckBox "WPFInstall"} + "WPFStandard" {Invoke-WPFPresets "Standard" -checkboxfilterpattern "WPFTweak*"} + "WPFMinimal" {Invoke-WPFPresets "Minimal" -checkboxfilterpattern "WPFTweak*"} + "WPFClearTweaksSelection" {Invoke-WPFPresets -imported $true -checkboxfilterpattern "WPFTweak*"} + "WPFClearInstallSelection" {Invoke-WPFPresets -imported $true -checkboxfilterpattern "WPFInstall*"} "WPFtweaksbutton" {Invoke-WPFtweaksbutton} "WPFOOSUbutton" {Invoke-WPFOOSU} "WPFAddUltPerf" {Invoke-WPFUltimatePerformance -State "Enable"} diff --git a/functions/public/Invoke-WPFImpex.ps1 b/functions/public/Invoke-WPFImpex.ps1 index 9b03cc13fc..43d835de95 100644 --- a/functions/public/Invoke-WPFImpex.ps1 +++ b/functions/public/Invoke-WPFImpex.ps1 @@ -41,6 +41,8 @@ function Invoke-WPFImpex { if ($type -eq "export") { $jsonFile = Get-WinUtilCheckBoxes -unCheck $false $jsonFile | ConvertTo-Json | Out-File $FileBrowser.FileName -Force + $runscript = "iex ""& { `$(irm christitus.com/win) } -Config '$($FileBrowser.FileName)'""" + $runscript | Set-Clipboard } if ($type -eq "import") { $jsonFile = Get-Content $Config | ConvertFrom-Json diff --git a/functions/public/Invoke-WPFPresets.ps1 b/functions/public/Invoke-WPFPresets.ps1 index 1595a8f103..90493899c7 100644 --- a/functions/public/Invoke-WPFPresets.ps1 +++ b/functions/public/Invoke-WPFPresets.ps1 @@ -10,29 +10,36 @@ function Invoke-WPFPresets { .PARAMETER imported If the preset is imported from a file, defaults to false - .PARAMETER checkbox - The checkbox to set the options to, defaults to 'WPFTweaks' + .PARAMETER checkboxfilterpattern + The Pattern to use when filtering through CheckBoxes, defaults to "**" #> - param( - $preset, - [bool]$imported = $false + param ( + [Parameter(position=0)] + [string]$preset = "", + + [Parameter(position=1)] + [bool]$imported = $false, + + [Parameter(position=2)] + [string]$checkboxfilterpattern = "**" ) - if($imported -eq $true) { + if ($imported -eq $true) { $CheckBoxesToCheck = $preset } else { $CheckBoxesToCheck = $sync.configs.preset.$preset } - $CheckBoxes = $sync.GetEnumerator() | Where-Object { $_.Value -is [System.Windows.Controls.CheckBox] -and $_.Name -notlike "WPFToggle*" } - Write-Debug "Getting checkboxes to set $($CheckBoxes.Count)" + $CheckBoxes = ($sync.GetEnumerator()).where{ $_.Value -is [System.Windows.Controls.CheckBox] -and $_.Name -notlike "WPFToggle*" -and $_.Name -like "$checkboxfilterpattern"} + Write-Debug "Getting checkboxes to set, number of checkboxes: $($CheckBoxes.Count)" - $CheckBoxesToCheck | ForEach-Object { - if ($_ -ne $null) { - Write-Debug $_ - } + if ($CheckBoxesToCheck -ne "") { + $debugMsg = "CheckBoxes to Check are: " + $CheckBoxesToCheck | ForEach-Object { $debugMsg += "$_, " } + $debugMsg = $debugMsg -replace (',\s*$', '') + Write-Debug "$debugMsg" } foreach ($CheckBox in $CheckBoxes) { diff --git a/functions/public/Invoke-WPFUIElements.ps1 b/functions/public/Invoke-WPFUIElements.ps1 index 2319d6fe5a..f8e9c7ba00 100644 --- a/functions/public/Invoke-WPFUIElements.ps1 +++ b/functions/public/Invoke-WPFUIElements.ps1 @@ -186,6 +186,7 @@ function Invoke-WPFUIElements { $label.ToolTip = $entryInfo.Description $label.HorizontalAlignment = "Left" $label.FontSize = $theme.FontSize + $label.Foreground = $theme.MainForegroundColor $dockPanel.Children.Add($label) | Out-Null $stackPanel.Children.Add($dockPanel) | Out-Null diff --git a/overrides/main.html b/overrides/main.html index f5f0eb399f..bf27a2c652 100644 --- a/overrides/main.html +++ b/overrides/main.html @@ -1,5 +1,12 @@ {% extends "base.html" %} +{% block header %} + {{ super() }} +
+ Announcement: We are currently not adding any applications to WinUtil and any apps that will be added through a PR will be declined by the maintainer. +
+{% endblock %} + {% block footer %} {# Empty block to override the footer #} {% endblock %} diff --git a/scripts/main.ps1 b/scripts/main.ps1 index 17606b5d55..bcc209b2d6 100644 --- a/scripts/main.ps1 +++ b/scripts/main.ps1 @@ -439,6 +439,12 @@ $sync["SearchBar"].Add_TextChanged({ } }) +$sync["Form"].Add_Loaded({ + param($e) + $sync["Form"].MaxWidth = [Double]::PositiveInfinity + $sync["Form"].MaxHeight = [Double]::PositiveInfinity +}) + # Initialize the hashtable $winutildir = @{} diff --git a/scripts/start.ps1 b/scripts/start.ps1 index 06e53b69d2..c289709c49 100644 --- a/scripts/start.ps1 +++ b/scripts/start.ps1 @@ -5,6 +5,7 @@ GitHub : https://github.com/ChrisTitusTech Version : #{replaceme} #> + param ( [switch]$Debug, [string]$Config, @@ -27,12 +28,6 @@ if ($Run) { $PARAM_RUN = $true } -if (!(Test-Path -Path $ENV:TEMP)) { - New-Item -ItemType Directory -Force -Path $ENV:TEMP -} - -Start-Transcript $ENV:TEMP\Winutil.log -Append - # Load DLLs Add-Type -AssemblyName PresentationFramework Add-Type -AssemblyName System.Windows.Forms @@ -46,8 +41,22 @@ $sync.ProcessRunning = $false if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { Write-Output "Winutil needs to be run as Administrator. Attempting to relaunch." + $argList = @() + + $PSBoundParameters.GetEnumerator() | ForEach-Object { + $argList += if ($_.Value -is [switch] -and $_.Value) { + "-$($_.Key)" + } elseif ($_.Value) { + "-$($_.Key) `"$($_.Value)`"" + } + } + + $script = if ($MyInvocation.MyCommand.Path) { + "& { & '$($MyInvocation.MyCommand.Path)' $argList }" + } else { + "iex '& { $(irm https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1) } $argList'" + } - $script = if ($MyInvocation.MyCommand.Path) { "& '" + $MyInvocation.MyCommand.Path + "'" } else { "irm 'https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1' | iex"} $powershellcmd = if (Get-Command pwsh -ErrorAction SilentlyContinue) { "pwsh" } else { "powershell" } $processCmd = if (Get-Command wt.exe -ErrorAction SilentlyContinue) { "wt.exe" } else { $powershellcmd } @@ -56,6 +65,12 @@ if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]: break } +$dateTime = Get-Date -Format "yyyy-MM-dd_HH-mm-ss" + +$logdir = "$env:localappdata\winutil\logs" +[System.IO.Directory]::CreateDirectory("$logdir") | Out-Null +Start-Transcript -Path "$logdir\winutil_$dateTime.log" -Append -NoClobber | Out-Null + # Set PowerShell window title $Host.UI.RawUI.WindowTitle = $myInvocation.MyCommand.Definition + "(Admin)" clear-host diff --git a/windev.ps1 b/windev.ps1 index 5bba017d12..b735efca6c 100644 --- a/windev.ps1 +++ b/windev.ps1 @@ -14,8 +14,15 @@ if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { Write-Output "Winutil needs to be run as Administrator. Attempting to relaunch." + # Capture all the arguments passed to the script + $argList = $args -join ' ' + + $script = if ($MyInvocation.MyCommand.Path) { + "& { & '$($MyInvocation.MyCommand.Path)' $argList }" + } else { + "iex '& { $(irm https://github.com/ChrisTitusTech/winutil/raw/main/windev.ps1) } $argList'" + } - $script = if ($MyInvocation.MyCommand.Path) { "& '" + $MyInvocation.MyCommand.Path + "'" } else { "irm 'https://github.com/ChrisTitusTech/winutil/raw/main/windev.ps1' | iex"} $powershellcmd = if (Get-Command pwsh -ErrorAction SilentlyContinue) { "pwsh" } else { "powershell" } $processCmd = if (Get-Command wt.exe -ErrorAction SilentlyContinue) { "wt.exe" } else { $powershellcmd } @@ -46,9 +53,9 @@ function RedirectToLatestPreRelease { Write-Host "Using latest Full Release" $url = "https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1" } - Invoke-RestMethod $url | Invoke-Expression + + iex "& { $(irm $url) } $argList" } # Call the redirect function - RedirectToLatestPreRelease diff --git a/xaml/inputXML.xaml b/xaml/inputXML.xaml index db4be1a9bf..8094af4a28 100644 --- a/xaml/inputXML.xaml +++ b/xaml/inputXML.xaml @@ -9,7 +9,11 @@ WindowStartupLocation="CenterScreen" UseLayoutRounding="True" WindowStyle="None" - Title="Chris Titus Tech's Windows Utility" Height="800" Width="1280"> + Width="Auto" + Height="Auto" + MaxWidth="1280" + MaxHeight="800" + Title="Chris Titus Tech's Windows Utility"> @@ -315,7 +319,7 @@ Margin="2" SnapsToDevicePixels="True"/> @@ -427,7 +431,11 @@ Width="34" Height="17"> + HorizontalAlignment="Left" Width="10.8" + RenderTransformOrigin="0.5, 0.5"> + + + @@ -438,12 +446,35 @@ + + + + + + + + + + + + + + + + - - - + + @@ -662,10 +693,10 @@ - - - - + + + +