mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-11-12 21:55:52 -06:00
efe37b2f3f
* Increase performance during loading. (#1348) * Increase performance during loading. Add a clear button to the search box. Add link and description attributes to the applications JSON. Use the link for linking to the app website. Use the description as a tooltip for each app. Add a clickable link to the website for each application (this took a long time; don't kick me if I got some wrong). Pressing Escape now clears the filter box. Pressing Alt-P prints your PID. * Fix for services that are being stopped * Compile winutil * Adding new Get-LocalizedYesNo based on choice.exe which is faster and more reliable, thank you @dtm-r for implementing it and testing it on English, German, Dutch, French, Italian, Spansich and Russian. Incredible work by @dtm-r, all cridit and props go to him. See this thread for details https://github.com/ChrisTitusTech/winutil/issues/1324 * Added error-checking logic for mounting ISOs and also created a wiki page that explains some of the errors. --------- Co-authored-by: KonTy <KonTy@github.com> * Compile Winutil * Custom save targets for MicroWin ISOs (#1346) * Workaround for Explorer freezes Some people have reported that setting the Event Log service to Automatic and starting it can (temporarily) fix Explorer freezes. This change detects whether the next service in the list is "EventLog" and skips it * Allow user to save MicroWin ISOs anywhere Adds a SaveFileDialog component to let the user specify the location of the MicroWin ISO and uses it during creation with oscdimg. (It uses a Process object from System.Diagnostics because I couldn't get it to work with Start-Process) * Removed temporary workaround Removed my version of the workaround in favor of the version from @KonTy (merge PR #1348 first) --------- Co-authored-by: Chris Titus <contact@christitus.com> * Highly anticipated fix for small screens (#1358) * Increase performance during loading. Add a clear button to the search box. Add link and description attributes to the applications JSON. Use the link for linking to the app website. Use the description as a tooltip for each app. Add a clickable link to the website for each application (this took a long time; don't kick me if I got some wrong). Pressing Escape now clears the filter box. Pressing Alt-P prints your PID. * Fix for services that are being stopped * Compile winutil * Adding new Get-LocalizedYesNo based on choice.exe which is faster and more reliable, thank you @dtm-r for implementing it and testing it on English, German, Dutch, French, Italian, Spansich and Russian. Incredible work by @dtm-r, all cridit and props go to him. See this thread for details https://github.com/ChrisTitusTech/winutil/issues/1324 * Added error-checking logic for mounting ISOs and also created a wiki page that explains some of the errors. * Highly anticipated fix for small screen computers --------- Co-authored-by: KonTy <KonTy@github.com> * Compile Winutil * Winutil take a long time to create iso file and goes to sleep, this fixes that issue #1343 (#1371) Co-authored-by: KonTy <KonTy@github.com> * Compile Winutil * Create .gitattributes * Update .gitattributes * add winget ventoy package (#1374) * add winget ventoy package * convert applications.json to utf-8 * update applications.json again * Compile Winutil * Update applications.json fix encoding * Compile Winutil * Fix Encoding and Bad Symbols * Compile Winutil * feat: Add more software choices (#1379) * Compile Winutil * Update configs.Tests.ps1 * Update winutil.Tests.ps1 * Update applications.json * Compile Winutil * Update applications.json * Compile Winutil * Update applications.json * Compile Winutil * fix functions for unit tests * Compile Winutil * Update Invoke-MicroWin-Helper.ps1 * Compile Winutil * fix name WPF Close Button * Update inputXML.xaml * Compile Winutil * my bad that wasnt it * modify unit test for stop on error * Compile Winutil * Update unittests.yaml * Create test * Update unittests.yaml * Update unittests.yaml * Update unittests.yaml * Update unittests.yaml * Update unittests.yaml * Update unittests.yaml * Update unittests.yaml * Update unittests.yaml * Compile Winutil * Make restore points optional, enabled by default (#1380) * Make restore points optional, enabled by default * Tweaks order fix if restorepoint is checked * Compile Winutil * update unit tests * Compile Winutil * Update unittests.yaml * Update unittests.yaml * Update winutil.Tests.ps1 * tests * Compile Winutil * Update unittests.yaml * Update unittests.yaml * Update unittests.yaml * fix unit test * Update winutil.Tests.ps1 * rewrite all pester test for winutil * Compile Winutil * fix handle is invalid error * final unit test --------- Co-authored-by: KonTy <9524513+KonTy@users.noreply.github.com> Co-authored-by: KonTy <KonTy@github.com> Co-authored-by: ChrisTitusTech <ChrisTitusTech@users.noreply.github.com> Co-authored-by: CodingWonders <101426328+CodingWonders@users.noreply.github.com> Co-authored-by: Munkk <152475628+munkk01@users.noreply.github.com> Co-authored-by: Kiril Vasilev <Kiril.v92@gmail.com>
87 lines
2.9 KiB
PowerShell
87 lines
2.9 KiB
PowerShell
function Get-LocalizedYesNo {
|
|
<#
|
|
.SYNOPSIS
|
|
This function runs choice.exe and captures its output to extract yes no in a localized Windows
|
|
|
|
.DESCRIPTION
|
|
The function retrieves the output of the command 'cmd /c "choice <nul 2>nul"' and converts the default output for Yes and No
|
|
in the localized format, such as "Yes=<first character>, No=<second character>".
|
|
|
|
.EXAMPLE
|
|
$yesNoArray = Get-LocalizedYesNo
|
|
Write-Host "Yes=$($yesNoArray[0]), No=$($yesNoArray[1])"
|
|
#>
|
|
|
|
# Run choice and capture its options as output
|
|
# The output shows the options for Yes and No as "[Y,N]?" in the (partitially) localized format.
|
|
# eg. English: [Y,N]?
|
|
# Dutch: [Y,N]?
|
|
# German: [J,N]?
|
|
# French: [O,N]?
|
|
# Spanish: [S,N]?
|
|
# Italian: [S,N]?
|
|
# Russian: [Y,N]?
|
|
|
|
$line = cmd /c "choice <nul 2>nul"
|
|
$charactersArray = @()
|
|
$regexPattern = '([a-zA-Z])'
|
|
$charactersArray = [regex]::Matches($line, $regexPattern) | ForEach-Object { $_.Groups[1].Value }
|
|
|
|
Write-Debug "According to takeown.exe local Yes is $charactersArray[0]"
|
|
# Return the array of characters
|
|
return $charactersArray
|
|
}
|
|
|
|
|
|
function Get-LocalizedYesNoTakeown {
|
|
<#
|
|
.SYNOPSIS
|
|
This function runs takeown.exe and captures its output to extract yes no in a localized Windows
|
|
|
|
.DESCRIPTION
|
|
The function retrieves lines from the output of takeown.exe until there are at least 2 characters
|
|
captured in a specific format, such as "Yes=<first character>, No=<second character>".
|
|
|
|
.EXAMPLE
|
|
$yesNoArray = Get-LocalizedYesNo
|
|
Write-Host "Yes=$($yesNoArray[0]), No=$($yesNoArray[1])"
|
|
#>
|
|
|
|
# Run takeown.exe and capture its output
|
|
$takeownOutput = & takeown.exe /? | Out-String
|
|
|
|
# Parse the output and retrieve lines until there are at least 2 characters in the array
|
|
$found = $false
|
|
$charactersArray = @()
|
|
foreach ($line in $takeownOutput -split "`r`n")
|
|
{
|
|
# skip everything before /D flag help
|
|
if ($found)
|
|
{
|
|
# now that /D is found start looking for a single character in double quotes
|
|
# in help text there is another string in double quotes but it is not a single character
|
|
$regexPattern = '"([a-zA-Z])"'
|
|
|
|
$charactersArray = [regex]::Matches($line, $regexPattern) | ForEach-Object { $_.Groups[1].Value }
|
|
|
|
# if ($charactersArray.Count -gt 0) {
|
|
# Write-Output "Extracted symbols: $($matches -join ', ')"
|
|
# } else {
|
|
# Write-Output "No matches found."
|
|
# }
|
|
|
|
if ($charactersArray.Count -ge 2)
|
|
{
|
|
break
|
|
}
|
|
}
|
|
elseif ($line -match "/D ")
|
|
{
|
|
$found = $true
|
|
}
|
|
}
|
|
|
|
Write-Debug "According to takeown.exe local Yes is $charactersArray[0]"
|
|
# Return the array of characters
|
|
return $charactersArray
|
|
} |