├── .DS_Store ├── .gitignore ├── .vscode ├── launch.json ├── settings.json └── tasks.json ├── CLRCLI.dll ├── License.txt ├── SandBox ├── GetFonts.ps1 ├── MainWindow.xaml ├── NewNames.md ├── Obsolete │ ├── test-encoding.ps1 │ ├── test.ps1 │ ├── test1.ps1 │ ├── test2.ps1 │ └── test3.ps1 ├── REsources │ ├── winget_de.resw │ ├── winget_en.resw │ ├── winget_es.resw │ ├── winget_fr.resw │ ├── winget_it.resw │ ├── winget_jp.resw │ ├── winget_ko.resw │ ├── winget_pt.resw │ └── winget_ru.resw ├── True ├── WGConfig.json ├── WinGum.ps1 ├── banner.ps1 ├── chatGPTtest.ps1 ├── classes.ps1 ├── core.ps1 ├── experiment.ps1 ├── getwingetpackages.ps1 ├── gum.exe ├── input.ps1 ├── installScoop.ps1 ├── menu.ps1 ├── params.json ├── params.json.old ├── result.txt ├── scoop_help.txt ├── screen.ps1 ├── sleep.ps1 ├── test.csv ├── test.txt ├── testGum.ps1 ├── testWG.ps1 ├── testcolor.ps1 ├── teststream.ps1 ├── testutf.ps1 ├── tools.ps1 ├── tools │ ├── GetResuorces.ps1 │ └── install.ps1 ├── updateconfig.ps1 ├── visuals.ps1 ├── wgGUI.ps1 ├── widths.txt ├── wingetposh.ps1 ├── wingetposh_old.ps1 └── wingettui.psm1 ├── WGGui ├── ProjectGroup1.groupproj ├── ProjectGroup1.groupproj.local ├── WGGui.dpr ├── WGGui.dproj ├── WGGui.dproj.local ├── WGGui.identcache ├── WGGui.res ├── WGGui_Icon.ico ├── WGGui_Icon1.ico ├── WGGui_Icon2.ico ├── WingetGUI.groupproj ├── WingetGUI.groupproj.local ├── WingetGUI_prjgroup.tvsconfig ├── WingetPoshGui.dpr ├── WingetPoshGui.dproj ├── WingetPoshGui.dproj.local ├── WingetPoshGui.identcache ├── WingetPoshGui.res ├── images │ ├── bouton-carre-croix.png │ ├── icons8-delete-24.png │ ├── icons8-update-64.png │ ├── marque-de-croix (1).png │ ├── marque-de-croix (2).png │ └── marque-de-croix.png ├── uBaseFrame.dfm ├── uBaseFrame.pas ├── uConsts.pas ├── uDM.dfm ├── uDM.pas ├── uFrmConfig.dfm ├── uFrmConfig.pas ├── uFrmList.dfm ├── uFrmList.pas ├── uFrmSearch.dfm ├── uFrmSearch.pas ├── uFrmSplash.dfm ├── uFrmSplash.pas ├── uMain.dfm ├── uMain.pas ├── uOldMain.dfm ├── uOldMain.pas ├── usearchPackage.dfm └── usearchPackage.pas ├── Winget-posh ├── License.txt ├── WingetPoshGui.exe ├── icon.ico ├── image0.jpeg ├── tools │ └── install.ps1 ├── visuals.ps1 ├── wingetposh.ico ├── wingetposh.psd1 ├── wingetposh.psm1 └── wingetposh2.ico ├── alpha ├── A_01.png ├── A_02.png ├── A_03.png ├── A_04.png ├── A_05.png ├── A_06.png ├── A_07.png ├── A_08.png └── A_09.png ├── demo.md ├── history.md ├── images ├── 001.png ├── 002-2.png ├── 002.png ├── 003.png ├── 004.png ├── 005.png ├── 006-1.png ├── 006-2.png ├── 006-3.png ├── 006-4.png ├── 006-5.png ├── 006.png ├── 007.png ├── 008.png ├── 009.png ├── 010.png ├── 011.png ├── 012.png ├── 013.png ├── 014.png ├── A_01.png ├── A_02.png ├── A_03.png ├── A_04.png ├── A_05.png ├── A_06.png ├── A_07.png ├── A_08.png ├── A_09.png ├── Miniature.png ├── Wingetposh (2).png ├── Wingetposh.png ├── WingetposhLogo.png ├── img1-0.png ├── img1.png ├── img10.png ├── img11.png ├── img2.png ├── img3.png ├── img4.png ├── img5.png ├── img6.png ├── img7.png ├── img8-1.png ├── img8-2.png ├── img8-3.png ├── img8-4.png ├── img8.png └── img9.png ├── publish.ps1 └── readme.md /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Notes.txt 2 | Notes.txt 3 | WGGui/__history/* 4 | WGGui/Win64/* 5 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | 8 | { 9 | "name": "PowerShell: Launch Current File", 10 | "type": "PowerShell", 11 | "request": "launch", 12 | "script": "${file}", 13 | "args": [] 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "crosshair.enabled": true, 3 | "githubPullRequests.ignoredPullRequestBranches": [ 4 | "master" 5 | ] 6 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "build", 6 | "command": "dotnet", 7 | "type": "process", 8 | "args": [ 9 | "build", 10 | "${workspaceFolder}/GUI/WingetGUI/WingetGUI.csproj", 11 | "/property:GenerateFullPaths=true", 12 | "/consoleloggerparameters:NoSummary" 13 | ], 14 | "problemMatcher": "$msCompile" 15 | }, 16 | { 17 | "label": "publish", 18 | "command": "dotnet", 19 | "type": "process", 20 | "args": [ 21 | "publish", 22 | "${workspaceFolder}/GUI/WingetGUI/WingetGUI.csproj", 23 | "/property:GenerateFullPaths=true", 24 | "/consoleloggerparameters:NoSummary" 25 | ], 26 | "problemMatcher": "$msCompile" 27 | }, 28 | { 29 | "label": "watch", 30 | "command": "dotnet", 31 | "type": "process", 32 | "args": [ 33 | "watch", 34 | "run", 35 | "--project", 36 | "${workspaceFolder}/GUI/WingetGUI/WingetGUI.csproj" 37 | ], 38 | "problemMatcher": "$msCompile" 39 | } 40 | ] 41 | } -------------------------------------------------------------------------------- /CLRCLI.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/CLRCLI.dll -------------------------------------------------------------------------------- /License.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Yves Godart 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /SandBox/GetFonts.ps1: -------------------------------------------------------------------------------- 1 | Invoke-WebRequest -Uri https://github.com/ryanoasis/nerd-fonts/releases/download/v2.2.2/Meslo.zip -OutFile Meslo.zip -------------------------------------------------------------------------------- /SandBox/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /SandBox/NewNames.md: -------------------------------------------------------------------------------- 1 | Select-WingetList 2 | Search-WingetPackage 3 | Select-WingetPackageUpdate 4 | Install-WingetPackage 5 | Remove-WingetPackage 6 | 7 | Select-WGList 8 | Search-WGPackage 9 | Select-WGPackageUpdate 10 | Install-WGPackage 11 | Remove-WGPackage -------------------------------------------------------------------------------- /SandBox/Obsolete/test-encoding.ps1: -------------------------------------------------------------------------------- 1 | # Define a string that contains Kanji characters mixed with normal text 2 | $string = "QQ小程序开发者工具 The" 3 | $string2 = "MusicLake The" 4 | $string3 = "MusicLâke The" 5 | 6 | $i = 0 7 | $count = 0 8 | 9 | while ($count -lt 22) { 10 | [char]$char = $string[$i] 11 | $bytes = [text.Encoding]::UTF8.GetByteCount($char) 12 | if ($bytes -gt 1) { 13 | $count += ($bytes -1) 14 | } else { 15 | $count += $bytes 16 | } 17 | $i++ 18 | } 19 | 20 | "i : $($i) count : $($count)" 21 | $string[$i] -------------------------------------------------------------------------------- /SandBox/Obsolete/test.ps1: -------------------------------------------------------------------------------- 1 | function LoadModule ($m) { 2 | if (Get-Module | Where-Object { $_.Name -eq $m }) { 3 | Write-Host "Module $m is already imported." 4 | } 5 | else { 6 | if (Get-Module -ListAvailable | Where-Object { $_.Name -eq $m }) { 7 | Import-Module $m -Verbose 8 | } 9 | else { 10 | if (Find-Module -Name $m | Where-Object { $_.Name -eq $m }) { 11 | Install-Module -Name $m -Force -Verbose -Scope CurrentUser 12 | Import-Module $m -Verbose 13 | } 14 | else { 15 | Write-Host "Module $m not imported, not available and not in an online gallery, exiting." 16 | EXIT 1 17 | } 18 | } 19 | } 20 | } 21 | 22 | LoadModule "Microsoft.PowerShell.ConsoleGuiTools" 23 | $module = (Get-Module Microsoft.PowerShell.ConsoleGuiTools -List).ModuleBase 24 | Add-Type -Path (Join-Path $module Terminal.Gui.dll) 25 | 26 | [Terminal.Gui.Application]::Init() 27 | 28 | $Window = [Terminal.Gui.Window]::new() 29 | $Window.Title = "Hello, World" 30 | [Terminal.Gui.Application]::Top.Add($Window) 31 | 32 | $Button = [Terminal.Gui.Button]::new() 33 | $Button.Text = "Button" 34 | $Button.X = 5 35 | $Button.Y = 5 36 | $Button.add_Clicked({ [Terminal.Gui.MessageBox]::Query("Clicked!", "") }) 37 | $Window.Add($Button) 38 | 39 | $listview = [Terminal.Gui.ListView]::new() 40 | # $ListView.SetSource(@("Item1", "Item2", "Item3")) 41 | $ListView.SetSource(@({ 42 | BackgroundColor = "Black" 43 | ForegroundColor = "White" 44 | }, { 45 | BackgroundColor = "Black" 46 | ForegroundColor = "White" 47 | }, { 48 | BackgroundColor = "Black" 49 | ForegroundColor = "White" 50 | })) 51 | $ListView.Width = [Terminal.Gui.Dim]::Fill() 52 | $ListView.Height = [Terminal.Gui.Dim]::Fill() 53 | 54 | $Window.Add($ListView) 55 | 56 | $Label = [Terminal.Gui.Label]::new() 57 | $Label.Width = 10 58 | $Label.Height = 1 59 | $Label.y = 10 60 | $Label.x = 10 61 | $Window.Add($Label) 62 | 63 | $Window.add_KeyPress({ 64 | param($arg) $sKey = $arg.KeyEvent.Key.ToString() 65 | 66 | $Label.Text = $sKey 67 | if ($sKey -eq 'q') { 68 | [Terminal.Gui.Application]::RequestStop() 69 | } 70 | }) 71 | 72 | [Terminal.Gui.Application]::Run() 73 | [Terminal.Gui.Application]::Shutdown() -------------------------------------------------------------------------------- /SandBox/Obsolete/test1.ps1: -------------------------------------------------------------------------------- 1 | # Create a synchronized hashtable 2 | $StateData = [System.Collections.Hashtable]::Synchronized([System.Collections.Hashtable]::new()) 3 | 4 | $Stop = $False 5 | # Add some data to the hashtable (creates new property) 6 | $StateData.HasData = $False 7 | 8 | # Set up our runspace 9 | $Runspace = [runspacefactory]::CreateRunspace() 10 | $Runspace.Open() 11 | # Passing in the hashtable 12 | $Runspace.SessionStateProxy.SetVariable("StateData",$StateData) 13 | 14 | # Capture process data in a runspace 15 | $Sb = { 16 | while($True) { 17 | # We pause here for 2 seconds between captures, how do we keep the UI available? 18 | Start-Sleep -Seconds 2 19 | 20 | # Get new data 21 | $StateData.Data = Get-Process | Sort-Object -Property 'CPU' -Descending ` 22 | | Select-Object -First 10 ` 23 | | Out-String 24 | 25 | # Alert outer process that new data has arrived 26 | $StateData.HasData = $True 27 | } 28 | } 29 | $Session = [PowerShell]::Create() 30 | $Session.Runspace = $Runspace 31 | $null = $Session.AddScript($Sb) 32 | $Handle = $Session.BeginInvoke() 33 | 34 | $Stop = $False 35 | Clear-Host 36 | while(-not $Stop) { 37 | [Console]::CursorVisible = $False 38 | # Reset the cursor to the top left corner 39 | $host.UI.RawUI.CursorPosition = @{X=0;Y=0} 40 | # Draw spaces over the data that is already there (based on the number of 41 | # lines displayed * the width of the window) 42 | $blanks = ' '.PadRight(12 * ($host.UI.RawUI.WindowSize.Width)) 43 | [Console]::Write($blanks) 44 | # Reset the cursor again 45 | $host.UI.RawUI.CursorPosition = @{X=0;Y=0} 46 | # Finally send the output to the screen 47 | [Console]::Write($StateData.Data) 48 | [Console]::CursorVisible = $True 49 | if ( -not $StateData.Data ) { 50 | Write-Host "Waiting for data..." 51 | } 52 | Write-Host "Press 'q' to quit" -NoNewLine 53 | 54 | while(-not $StateData.HasData) { 55 | if($global:Host.UI.RawUI.KeyAvailable) { 56 | # THIS BLOCKS! 57 | $key = $($global:Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyUp")).character 58 | if ( $key -eq 'q' ) { 59 | $Stop = $True 60 | # Clean up! 61 | $Session.Stop() 62 | $Runspace.Dispose() 63 | } 64 | break 65 | } 66 | Start-Sleep -Milliseconds 10 67 | } 68 | # Reset the "HasData" flag so we can wait for more data 69 | $StateData.HasData = $False 70 | } 71 | -------------------------------------------------------------------------------- /SandBox/Obsolete/test2.ps1: -------------------------------------------------------------------------------- 1 | Import-Module Microsoft.PowerShell.ConsoleGuiTools 2 | $module = (Get-Module Microsoft.PowerShell.ConsoleGuiTools -List).ModuleBase 3 | Add-Type -Path (Join-Path $module Terminal.Gui.dll) 4 | 5 | [Terminal.Gui.Application]::Init() 6 | 7 | $Window = [Terminal.Gui.Window]::new() 8 | $Window.Title = "Hello, World" 9 | [Terminal.Gui.Application]::Top.Add($Window) 10 | 11 | $Label = [Terminal.Gui.Label]::new() 12 | $Label.Text = "0" 13 | $Label.Height = 1 14 | $Label.Width = 20 15 | $Window.Add($Label) 16 | 17 | $Button = [Terminal.Gui.Button]::new() 18 | $Button.X = [Terminal.Gui.Pos]::Right($Label) 19 | $Button.Text = "Start Job" 20 | $Button.add_Clicked({ 21 | Start-ThreadJob { 22 | $bgLabel = $args[0] 23 | 1..100 | ForEach-Object { 24 | $Item = $_ 25 | [Terminal.Gui.Application]::MainLoop.Invoke({ $bgLabel.Text = $Item.ToString() }) 26 | Start-Sleep -Milliseconds 1000 27 | } 28 | 29 | } -ArgumentList $Label 30 | }) 31 | 32 | $Window.Add($Button) 33 | 34 | $Button2 = [Terminal.Gui.Button]::new() 35 | $Button2.X = [Terminal.Gui.Pos]::Right($Button) 36 | $Button2.Text = "Do I work?" 37 | $Button2.add_Clicked({ 38 | [Terminal.Gui.MessageBox]::Query("Still workin'", "") 39 | }) 40 | 41 | $Window.Add($Button2) 42 | 43 | -------------------------------------------------------------------------------- /SandBox/Obsolete/test3.ps1: -------------------------------------------------------------------------------- 1 | Import-Module Microsoft.PowerShell.ConsoleGuiTools 2 | $module = (Get-Module Microsoft.PowerShell.ConsoleGuiTools -List).ModuleBase 3 | Add-Type -Path (Join-Path $module Terminal.Gui.dll) 4 | 5 | [Terminal.Gui.Application]::Init() 6 | 7 | $Window = [Terminal.Gui.Window]::new() 8 | $Window.Title = "Hello, World" 9 | [Terminal.Gui.Application]::Top.Add($Window) 10 | 11 | $Button = [Terminal.Gui.Button]::new() 12 | $Button.Text = "Button" 13 | $Window.Add($Button) 14 | 15 | $Label = [Terminal.Gui.Label]::new() 16 | $Label.Width = 10 17 | $Label.Height = 1 18 | $Label.x = 10 19 | $Window.Add($Label) 20 | 21 | $Label = [Terminal.Gui.Label]::new() 22 | $Label.Width = 10 23 | $Label.Height = 1 24 | $Window.Add($Label) 25 | 26 | $Window.add_KeyPress({ 27 | param($arg) $sKey = $arg.KeyEvent.Key.ToString() 28 | 29 | $Label.Text = $sKey 30 | if ($sKey -eq 'q') { 31 | [Terminal.Gui.Application]::RequestStop() 32 | } 33 | 34 | }) 35 | 36 | [Terminal.Gui.Application]::Run() 37 | [Terminal.Gui.Application]::Shutdown() 38 | -------------------------------------------------------------------------------- /SandBox/WGConfig.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Selected": true, 4 | "Name": "7-Zip 23.01 (x64) ", 5 | "Id": "7zip.7zip ", 6 | "Version": "23.01 ", 7 | "Source": "winget ", 8 | "Available": " " 9 | }, 10 | { 11 | "Selected": true, 12 | "Name": "Ubuntu ", 13 | "Id": "Canonical.Ubuntu.2204 ", 14 | "Version": "2204.2.33.0 ", 15 | "Source": "winget ", 16 | "Available": " " 17 | }, 18 | { 19 | "Selected": true, 20 | "Name": "GitHub Desktop ", 21 | "Id": "GitHub.GitHubDesktop ", 22 | "Version": "3.3.3 ", 23 | "Source": "winget ", 24 | "Available": "3.3.4 " 25 | }, 26 | { 27 | "Selected": true, 28 | "Name": "Git ", 29 | "Id": "Git.Git ", 30 | "Version": "2.42.0.2 ", 31 | "Source": "winget ", 32 | "Available": " " 33 | }, 34 | { 35 | "Selected": true, 36 | "Name": "Microsoft Edge ", 37 | "Id": "Microsoft.Edge ", 38 | "Version": "118.0.2088.46 ", 39 | "Source": "winget ", 40 | "Available": " " 41 | }, 42 | { 43 | "Selected": true, 44 | "Name": "Microsoft Edge WebView2 Runtime ", 45 | "Id": "Microsoft.EdgeWebView2Runtime ", 46 | "Version": "118.0.2088.46 ", 47 | "Source": "winget ", 48 | "Available": " " 49 | } 50 | ] 51 | -------------------------------------------------------------------------------- /SandBox/WinGum.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/SandBox/WinGum.ps1 -------------------------------------------------------------------------------- /SandBox/banner.ps1: -------------------------------------------------------------------------------- 1 | Clear-Host 2 | $params = @{ 3 | Message = " Wingetposh " 4 | Font = "banner3-D" 5 | } 6 | Write-Figlet @params 7 | Write-Figlet -Message " 0.9.8-alpha " -Font bigchief -Background darkred -ColorChars yellow -------------------------------------------------------------------------------- /SandBox/chatGPTtest.ps1: -------------------------------------------------------------------------------- 1 | # Define the command to execute 2 | $command = "powershell" 3 | #$arguments = "example.com" 4 | 5 | # Create a new process start info object 6 | $processStartInfo = New-Object System.Diagnostics.ProcessStartInfo 7 | $processStartInfo.FileName = $command 8 | $processStartInfo.Arguments = $arguments 9 | $processStartInfo.RedirectStandardOutput = $true 10 | $processStartInfo.RedirectStandardError = $true 11 | $processStartInfo.RedirectStandardInput = $true 12 | $processStartInfo.UseShellExecute = $false 13 | $processStartInfo.CreateNoWindow = $true 14 | $processStartInfo.StandardOutputEncoding = [System.Text.Encoding]::UTF8 15 | $processStartInfo.StandardErrorEncoding = [System.Text.Encoding]::UTF8 16 | 17 | # Create a new process object 18 | $process = New-Object System.Diagnostics.Process 19 | $process.StartInfo = $processStartInfo 20 | 21 | # Register an event handler for the output data received event 22 | Register-ObjectEvent -InputObject $process -EventName "OutputDataReceived" -Action { 23 | if (-not [string]::IsNullOrEmpty($eventArgs.Data)) { 24 | #Write-Host "# $($eventArgs.Data)" 25 | } 26 | } 27 | 28 | # Register an event handler for the error data received event 29 | Register-ObjectEvent -InputObject $process -EventName "ErrorDataReceived" -Action { 30 | if (-not [string]::IsNullOrEmpty($eventArgs.Data)) { 31 | Write-Error $eventArgs.Data 32 | } 33 | } 34 | 35 | # Start the process 36 | if (-not $process.Start()) { 37 | throw "Failed to start process" 38 | } 39 | 40 | # Begin asynchronous reading of output and error streams 41 | $process.BeginOutputReadLine() 42 | $process.BeginErrorReadLine() 43 | 44 | # Send input to the process asynchronously 45 | $inputData = @" 46 | Write-Host "Hello, World!" 47 | winget search code 48 | exit 0`n 49 | "@ 50 | $process.StandardInput.WriteAsync($inputData) 51 | 52 | # Wait asynchronously for the process to exit 53 | $waitHandle = $process.WaitForExitAsync() 54 | 55 | # Do other work asynchronously while waiting for the process to exit 56 | while (-not $waitHandle.IsCompleted) { 57 | # Do something asynchronously 58 | } 59 | 60 | # Close the process 61 | $process.Close() 62 | -------------------------------------------------------------------------------- /SandBox/classes.ps1: -------------------------------------------------------------------------------- 1 | class column { 2 | [string]$FieldName 3 | [string]$Label 4 | [int]$Width #Percentage 5 | 6 | column( 7 | [string]$FieldName, 8 | [string]$Label, 9 | [int]$Width 10 | ) { 11 | $this.FieldName = $FieldName 12 | $this.Label = $Label 13 | $this.Width = $Width 14 | } 15 | } 16 | 17 | class package { 18 | [string]$Name 19 | [string]$Id 20 | [string[]]$AvailableVersions 21 | [string]$Source 22 | [bool]$IsUpdateAvailable 23 | [string]$InstalledVersion 24 | [string]$Available 25 | 26 | package( 27 | [string]$Name, 28 | [string]$Id, 29 | [string[]]$AvailableVersions, 30 | [string]$Source, 31 | [bool]$IsUpdateAvailable, 32 | [string]$InstalledVersion 33 | ) { 34 | $this.Name = $Name 35 | $this.Id = $Id 36 | $this.AvailableVersions = $AvailableVersions 37 | $this.Source = $Source 38 | $this.IsUpdateAvailable = $IsUpdateAvailable 39 | $this.InstalledVersion = $InstalledVersion 40 | $this.Available = $AvailableVersions[0] 41 | } 42 | 43 | package( 44 | [string]$Name, 45 | [string]$Id, 46 | [string]$InstalledVersion 47 | ) { 48 | $this.Name = $Name 49 | $this.Id = $Id 50 | $this.InstalledVersion = $InstalledVersion 51 | } 52 | 53 | package( 54 | [string]$Name, 55 | [string]$Id, 56 | [string]$InstalledVersion, 57 | [string]$Available 58 | ) { 59 | $this.Name = $Name 60 | $this.Id = $Id 61 | $this.InstalledVersion = $InstalledVersion 62 | $this.Available = $Available 63 | } 64 | } 65 | 66 | $Theme = @{ 67 | "background" = "#272935" 68 | "black" = "#272935" 69 | "blue" = "#BD93F9" 70 | "brightBlack" = "#555555" 71 | "brightBlue" = "#BD93F9" 72 | "brightCyan" = "#8BE9FD" 73 | "brightGreen" = "#50FA7B" 74 | "brightPurple" = "#FF79C6" 75 | "brightRed" = "#FF5555" 76 | "brightWhite" = "#FFFFFF" 77 | "brightYellow" = "#F1FA8C" 78 | "cyan" = "#6272A4" 79 | "foreground" = "#F8F8F2" 80 | "green" = "#50FA7B" 81 | "purple" = "#6272A4" 82 | "red" = "#FF5555" 83 | "white" = "#F8F8F2" 84 | "yellow" = "#FFB86C" 85 | } 86 | -------------------------------------------------------------------------------- /SandBox/core.ps1: -------------------------------------------------------------------------------- 1 | $include = [System.IO.Path]::GetDirectoryName($myInvocation.MyCommand.Definition) 2 | 3 | . "$include\visuals.ps1" 4 | . "$include\classes.ps1" 5 | . "$include\tools.ps1" 6 | 7 | $script:fields = Get-Content $env:USERPROFILE\.config\.wingetposh\locals.json | ConvertFrom-Json 8 | 9 | [System.Console]::OutputEncoding = [System.Text.Encoding]::UTF8 10 | 11 | $env:GUM_CHOOSE_SELECTED_BACKGROUND = "22" 12 | $env:GUM_CHOOSE_SELECTED_FOREGROUND = "#ffffff" 13 | 14 | 15 | $sources = @{ 16 | "winget" = "winget" 17 | "scoop" = "scoop" 18 | } 19 | 20 | function Get-FieldBAseNAme { 21 | param( 22 | [string]$name 23 | ) 24 | $base = $script:fields.psobject.Properties | Where-Object { $_.Value -eq $name } 25 | if ($base.count -eq 1) { 26 | $BaseName = $base.Name 27 | } 28 | else { 29 | $BaseName = ($base | Where-Object { $_.Name.StartsWith("Search") }).Name 30 | } 31 | 32 | return $baseFields[$BaseName] 33 | } 34 | 35 | function Get-FieldLength { 36 | param( 37 | [string]$buffer 38 | ) 39 | $i = 0 40 | $buffer.ToCharArray() | ForEach-Object { 41 | $l = [Text.Encoding]::UTF8.GetByteCount($_) 42 | if ($l -ge 2) { 43 | $l = $l - 1 44 | } 45 | $i += $l 46 | } 47 | return $i 48 | } 49 | 50 | function Get-WGPackage { 51 | param( 52 | [string]$source = $null, 53 | [switch]$update = $false, 54 | [switch]$uninstall = $false 55 | ) 56 | $GetParams = @{} 57 | if ($source) { 58 | $GetParams.Add("source", $source) 59 | } 60 | 61 | if ($update -and $uninstall) { 62 | # TODO: make error message a generic function 63 | [System.Console]::setcursorposition(0, $Y) 64 | $Title = gum style " ERROR " --background $($Theme["red"]) --foreground $($Theme["white"]) --bold 65 | $buffer = gum style "$($Title)`n'-update' & '-uninstall' cannot be used at the same time" --border "rounded" --width ($Host.UI.RawUI.BufferSize.Width - 2) --foreground $($Theme["yellow"]) 66 | $buffer | ForEach-Object { 67 | [System.Console]::write($_) 68 | } 69 | return $null 70 | } 71 | 72 | $Session, $runspace = Open-Spinner -label "Loading Packages List" -type "Dots" 73 | 74 | $packages = Get-WinGetPackage | Where-Object { $_.Source -eq $source } 75 | 76 | 77 | # if ($interactive) { 78 | [column[]]$cols = @() 79 | $cols += [column]::new("Name", "Name", 40) 80 | $cols += [column]::new("Id", "Id", 40) 81 | $cols += [column]::new("InstalledVersion", "Version", 20) 82 | [package[]]$InstalledPackages = @() 83 | $packages | ForEach-Object { 84 | $InstalledPackages += [package]::new($_.Name, $_.Id, $_.AvailableVersions, $_.Source, $_.IsUpdateAvailable, $_.InstalledVersion) 85 | } 86 | $choices = makeLines -columns $cols -items $InstalledPackages 87 | $width = $Host.UI.RawUI.BufferSize.Width - 2 88 | $height = $Host.UI.RawUI.BufferSize.Height - 7 89 | $title = makeTitle -title "List of Installed Packages" -width $width 90 | $header = makeHeader -columns $cols 91 | Close-Spinner -session $Session -runspace $runspace 92 | gum style --border "rounded" --width $width "$title`n$header" --border-foreground $($Theme["purple"]) 93 | $c = $choices | gum filter --no-limit --height $height --indicator "👉 " --placeholder "Search in the list" --prompt.foreground $($Theme["yellow"]) --prompt "🔎 " 94 | $choices2 = @() 95 | ($choices -split '\n') | ForEach-Object { 96 | $temp = $_ -replace [char]27,"@" 97 | if ($temp -match '@[\[][\d1,3;]*m') { 98 | $temp = $temp -replace '@[\[][\d1,3;]*m', "" 99 | } 100 | $choices2 += $temp 101 | } 102 | $packages = @() 103 | if ($c) { 104 | $c | ForEach-Object { 105 | $index = $choices2.IndexOf($_) 106 | $packages += $InstalledPackages[$index] | Select-Object -Property * -ExcludeProperty Available 107 | } 108 | } 109 | Clear-Host 110 | # } 111 | if ($session) { 112 | Close-Spinner -session $Session -runspace $runspace 113 | } 114 | return $packages 115 | } 116 | 117 | function Update-WGPackage { 118 | param( 119 | [string]$source = $null, 120 | [switch]$interactive = $false 121 | ) 122 | $GetParams = @{} 123 | if ($source) { 124 | $GetParams.Add("source", $source) 125 | } 126 | 127 | $Session, $runspace = Open-Spinner -label "Loading Packages List" -type "Dots" 128 | 129 | $packages = Get-WinGetPackage | Where-Object { $_.IsUpdateAvailable } 130 | 131 | Close-Spinner -session $Session -runspace $runspace 132 | if ($interactive) { 133 | [column[]]$cols = @() 134 | $cols += [column]::new("Name", "Name", 35) 135 | $cols += [column]::new("Id", "Id", 35) 136 | $cols += [column]::new("InstalledVersion", "Version", 15) 137 | $cols += [column]::new("Available", "Available", 15) 138 | [package[]]$InstalledPackages = @() 139 | $packages | ForEach-Object { 140 | $InstalledPackages += [package]::new($_.Name, $_.Id, $_.InstalledVersion, $_.AvailableVersions[0]) 141 | } 142 | $choices = makeLines -columns $cols -items $InstalledPackages 143 | $height = $Host.UI.RawUI.BufferSize.Height - 6 144 | $width = $Host.UI.RawUI.BufferSize.Width - 2 145 | $title = makeTitle -title "Choose a package to update" -width $width 146 | $header = makeHeader -columns $cols 147 | gum style --border "rounded" --width $width "$title`n$header" --border-foreground $($Theme["purple"]) 148 | $c = $choices | gum choose --selected-prefix "✔️" --no-limit --cursor "👉 " --height $height 149 | $packages = @() 150 | if ($c) { 151 | $c | ForEach-Object { 152 | $index = ($choices -split '\n').IndexOf($_) 153 | $packages += $InstalledPackages[$index] 154 | } 155 | } 156 | # Clear-Host 157 | } 158 | return $packages 159 | } 160 | 161 | function Find-WGPackage { 162 | param( 163 | [string]$query = $null, 164 | [string]$source = $null, 165 | [switch]$interactive = $false 166 | ) 167 | 168 | $SearchParams = @{} 169 | $Y = $host.ui.rawui.CursorPosition.Y 170 | $buffer = gum style "Enter search query" --border "rounded" --width ($Host.UI.RawUI.BufferSize.Width - 2) 171 | $buffer | ForEach-Object { 172 | [System.Console]::write($_) 173 | } 174 | 175 | if (-not $query) { 176 | $query = gum input --placeholder "Search for a package" 177 | $SearchParams.Add("query", $query) 178 | } 179 | 180 | if ($source) { 181 | $SearchParams.Add("source", $source) 182 | } 183 | else { 184 | $source = gum style "every sources" --foreground "#FF0000" 185 | } 186 | if ($query) { 187 | $title = gum style $query --foreground "#00FF00" --bold 188 | $Session, $runspace = Open-Spinner -label "Searching for $title in $source" -type "Dots" 189 | $queries = $query.Split(",") 190 | $packages = @() 191 | $queries | ForEach-Object { 192 | $SearchParams["query"] = [string]$_.Trim() 193 | $packs = Find-WinGetPackage @SearchParams 194 | $packs | ForEach-Object { 195 | $packages += $_ 196 | } 197 | } 198 | [System.Console]::setcursorposition(0, $Y) 199 | } 200 | else { 201 | [System.Console]::setcursorposition(0, $Y) 202 | $buffer = gum style "No query specified" --border "rounded" --width ($Host.UI.RawUI.BufferSize.Width - 2) --foreground "#FF0000" 203 | $buffer | ForEach-Object { 204 | [System.Console]::write($_) 205 | } 206 | return $null 207 | } 208 | if ($packages -and $interactive) { 209 | # Clear-Host 210 | [column[]]$cols = @() 211 | $cols += [column]::new("Name", "Name", 40) 212 | $cols += [column]::new("Id", "Id", 40) 213 | $cols += [column]::new("Available", "Version", 20) 214 | [package[]]$InstalledPackages = @() 215 | $packages | ForEach-Object { 216 | $InstalledPackages += [package]::new($_.Name, $_.Id, $_.AvailableVersions, $_.Source, $_.IsUpdateAvailable, $_.InstalledVersion) 217 | } 218 | $choices = makeLines -columns $cols -items $InstalledPackages 219 | Close-Spinner -session $Session -runspace $runspace 220 | $width = $Host.UI.RawUI.BufferSize.Width - 2 221 | $height = $Host.UI.RawUI.BufferSize.Height - 6 222 | [System.Console]::setcursorposition(0, $Y) 223 | $title = makeTitle -title "Choose Packages to Install" -width $width 224 | $header = makeHeader -columns $cols 225 | gum style --border "rounded" --width $width "$title`n$header" --border-foreground $($Theme["purple"]) 226 | # $c = $choices | gum choose --selected-prefix "✔️" --no-limit --cursor "👉 " --height $height 227 | $c = $choices | gum filter --no-limit --height $height --indicator "👉 " --placeholder "Search in the list" --prompt.foreground $($Theme["yellow"]) --prompt "🔎 " 228 | $packages = @() 229 | if ($c) { 230 | $c | ForEach-Object { 231 | $index = ($choices -split '\n').IndexOf($_) 232 | $packages += $InstalledPackages[$index] 233 | } 234 | } 235 | Clear-Host 236 | } 237 | else { 238 | Close-Spinner -session $Session -runspace $runspace 239 | } 240 | return $packages 241 | } 242 | 243 | function isGumInstalled { 244 | $gum = Get-Command -CommandType Application -Name gum -ErrorAction SilentlyContinue 245 | if ($gum) { 246 | return $true 247 | } 248 | return $false 249 | } 250 | 251 | function installGum { 252 | $command = "winget install --id charmbracelet.gum" 253 | Invoke-Expression $command | Out-Null 254 | $env:path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") 255 | } 256 | 257 | Find-WGPackage -interactive -source "winget" 258 | # Get-WGPackage -source "winget" -update 259 | #Update-WGPackage -interactive -------------------------------------------------------------------------------- /SandBox/experiment.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/SandBox/experiment.ps1 -------------------------------------------------------------------------------- /SandBox/getwingetpackages.ps1: -------------------------------------------------------------------------------- 1 | $packages = Get-WingetPackage -Source winget 2 | # $packages 3 | # Remove-Item -Path .\test.csv -ErrorAction SilentlyContinue -Force 4 | # New-Item -Path .\test.csv -ItemType File -Force | Out-Null 5 | $csv = "Name,Id,Version,Available,Source" 6 | $widths = @(35,35,10,5,15) 7 | $w = $Host.UI.RawUI.BufferSize.Width 8 | $widths_relatives = @() 9 | $widths | ForEach-Object { 10 | $widths_relatives += [Math]::Floor(($_ / 100) * $w) 11 | } 12 | $updates = @(" ✔️ "," ♻️ ") 13 | # "Name,Id,Version,Available,Source" | Add-Content -Path .\test.csv 14 | $packages | Where-Object { $_.Source -like "winget" } | ForEach-Object { 15 | if ($_.IsUpdateAvailable) { 16 | $IsUpdateAvailable = $updates[0] 17 | } 18 | else { 19 | $IsUpdateAvailable = $updates[1] 20 | } 21 | $line = "$($_.Name.PadRight($widths_relatives[0]," "))$($_.Id.PadRight($widths_relatives[1]," "))$($_.InstalledVersion.PadRight($widths_relatives[2]," "))$($IsUpdateAvailable.PadRight($widths_relatives[3]," "))$($_.Source.PadRight($widths_relatives[4]," "))" 22 | # Add-Content .\test.csv -Value $line 23 | $csv += "`n$line" 24 | } 25 | $csv -------------------------------------------------------------------------------- /SandBox/gum.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/SandBox/gum.exe -------------------------------------------------------------------------------- /SandBox/input.ps1: -------------------------------------------------------------------------------- 1 | class Frame { 2 | [char]$UL 3 | [char]$UR 4 | [char]$TOP 5 | [char]$LEFT 6 | [char]$RIGHT 7 | [char]$BL 8 | [char]$BR 9 | [char]$BOTTOM 10 | [char]$LEFTSPLIT 11 | [char]$RIGHTSPLIT 12 | 13 | Frame ( 14 | [bool]$Double 15 | ) { 16 | if ($Double) { 17 | $this.UL = "╔" 18 | $this.UR = "╗" 19 | $this.TOP = "═" 20 | $this.LEFT = "║" 21 | $this.RIGHT = "║" 22 | $this.BL = "╚" 23 | $this.BR = "╝" 24 | $this.BOTTOM = "═" 25 | $this.LEFTSPLIT = "⊫" 26 | } 27 | else { 28 | #$this.UL = "┌" 29 | $this.UL = [char]::ConvertFromUtf32(0x256d) 30 | #$this.UR = "┐" 31 | $this.UR = [char]::ConvertFromUtf32(0x256e) 32 | $this.TOP = "─" 33 | $this.LEFT = "│" 34 | $this.RIGHT = "│" 35 | $this.BL = [char]::ConvertFromUtf32(0x2570) 36 | #$this.BL = "└" 37 | $this.BR = [char]::ConvertFromUtf32(0x256f) 38 | #$this.BR = "┘" 39 | $this.BOTTOM = "─" 40 | $this.LEFTSPLIT = [char]::ConvertFromUtf32(0x2524) 41 | $this.RIGHTSPLIT = [char]::ConvertFromUtf32(0x251c) 42 | } 43 | } 44 | } 45 | 46 | class window { 47 | [int]$X 48 | [int]$Y 49 | [int]$W 50 | [int]$H 51 | [Frame]$frameStyle 52 | [System.ConsoleColor]$frameColor 53 | [string]$title = "" 54 | [System.ConsoleColor]$titleColor 55 | [string]$footer = "" 56 | [int]$page = 1 57 | [int]$nbPages = 1 58 | $controls = @{} 59 | 60 | window( 61 | [int]$X, 62 | [int]$y, 63 | [int]$w, 64 | [int]$h, 65 | [bool]$Double, 66 | [System.ConsoleColor]$color = "White" 67 | ) { 68 | $this.X = $X 69 | $this.Y = $y 70 | $this.W = $W 71 | $this.H = $H 72 | $this.frameStyle = [Frame]::new($Double) 73 | $this.frameColor = $color 74 | 75 | } 76 | 77 | window( 78 | [int]$X, 79 | [int]$y, 80 | [int]$w, 81 | [int]$h, 82 | [bool]$Double, 83 | [System.ConsoleColor]$color = "White", 84 | [string]$title = "", 85 | [System.ConsoleColor]$titlecolor = "Blue" 86 | ) { 87 | $this.X = $X 88 | $this.Y = $y 89 | $this.W = $W 90 | $this.H = $H 91 | $this.frameStyle = [Frame]::new($Double) 92 | $this.frameColor = $color 93 | $this.title = $title 94 | $this.titleColor = $titlecolor 95 | } 96 | 97 | [void] setPosition( 98 | [int]$X, 99 | [int]$Y 100 | ) { 101 | [System.Console]::SetCursorPosition($X, $Y) 102 | } 103 | 104 | [void] drawWindow() { 105 | $esc = $([char]0x1b) 106 | 107 | [System.Console]::CursorVisible = $false 108 | $this.setPosition($this.X, $this.Y) 109 | $bloc1 = $this.frameStyle.UL, "".PadLeft($this.W - 2, $this.frameStyle.TOP), $this.frameStyle.UR -join "" 110 | $blank = "$esc[38;5;15m$($this.frameStyle.LEFT)", "".PadLeft($this.W - 2, " "), "$esc[38;5;15m$($this.frameStyle.RIGHT)" -join "" 111 | Write-Host $bloc1 -ForegroundColor $this.frameColor -NoNewline 112 | for ($i = 1; $i -lt $this.H; $i++) { 113 | $Y2 = $this.Y + $i 114 | $X3 = $this.X 115 | $this.setPosition($X3, $Y2) 116 | Write-Host $blank 117 | } 118 | $Y2 = $this.Y + $this.H 119 | $this.setPosition( $this.X, $Y2) 120 | $bloc1 = $this.frameStyle.BL, "".PadLeft($this.W - 2, $this.frameStyle.BOTTOM), $this.frameStyle.BR -join "" 121 | Write-Host $bloc1 -ForegroundColor $this.frameColor -NoNewline 122 | $this.drawTitle() 123 | $this.drawFooter() 124 | } 125 | 126 | 127 | [void] drawVersion() { 128 | $version = $this.frameStyle.LEFTSPLIT, [string]$(Get-InstalledModule -Name wingetposh -ErrorAction Ignore).version, $this.frameStyle.RIGHTSPLIT -join "" 129 | [System.Console]::setcursorposition($this.W - ($version.Length + 6), $this.Y ) 130 | [console]::write($version) 131 | } 132 | 133 | [void] drawTitle() { 134 | if ($this.title -ne "") { 135 | $local:X = $this.x + 2 136 | $this.setPosition($local:X, $this.Y) 137 | Write-Host ($this.frameStyle.LEFTSPLIT, " " -join "") -NoNewline -ForegroundColor $this.frameColor 138 | $local:X = $local:X + 2 139 | $this.setPosition($local:X, $this.Y) 140 | Write-Host $this.title -NoNewline -ForegroundColor $this.titleColor 141 | $local:X = $local:X + $this.title.Length 142 | $this.setPosition($local:X, $this.Y) 143 | Write-Host (" ", $this.frameStyle.RIGHTSPLIT -join "") -NoNewline -ForegroundColor $this.frameColor 144 | } 145 | } 146 | 147 | [void] drawFooter() { 148 | $Y2 = $this.Y + $this.H 149 | $this.setPosition( $this.X, $Y2) 150 | $bloc1 = $this.frameStyle.BL, "".PadLeft($this.W - 2, $this.frameStyle.BOTTOM), $this.frameStyle.BR -join "" 151 | Write-Host $bloc1 -ForegroundColor $this.frameColor -NoNewline 152 | if ($this.footer -ne "") { 153 | $local:x = $this.x + 2 154 | $local:Y = $this.Y + $this.h 155 | $this.setPosition($local:X, $local:Y) 156 | $foot = $this.frameStyle.LEFTSPLIT, " ", $this.footer, " ", $this.frameStyle.RIGHTSPLIT -join "" 157 | [console]::write($foot) 158 | } 159 | } 160 | 161 | [void] drawPagination() { 162 | $sPages = ('Page {0}/{1}' -f ($this.page, $this.nbPages)) 163 | [System.Console]::setcursorposition($this.W - ($sPages.Length + 6), $this.Y + $this.H) 164 | [console]::write($sPages) 165 | } 166 | 167 | [void] clearWindow() { 168 | $local:blank = "".PadLeft($this.W, " ") 169 | for ($i = 1; $i -lt $this.H; $i++) { 170 | $this.setPosition(($this.X), ($this.Y + $i)) 171 | Write-Host $blank 172 | } 173 | } 174 | 175 | [void] runWindow() { 176 | $this.drawWindow() 177 | $local:stop = $false 178 | $local:control = 0 179 | $this.controls.GetEnumerator() | ForEach-Object { 180 | ([InputBox]$_.Value).draw() 181 | } 182 | 183 | while (-not $local:stop) { 184 | [System.Management.Automation.Host.KeyInfo]$local:result = [System.Management.Automation.Host.KeyInfo]::new(65, "b", [System.Management.Automation.Host.ControlKeyStates]::NumLockOn, $true) 185 | if ($this.controls.containsKey("control$($local:control)")) { 186 | #setfocus 187 | $local:result = ($this.controls["control$($local:control)"]).focus() 188 | } 189 | $key = $local:result 190 | if ($key.VirtualKeyCode -eq 27) { 191 | $stop = $true 192 | } 193 | if ($key.VirtualKeyCode -eq 9) { 194 | [InputBox]($this.controls["control$($local:control)"]).draw() 195 | $key = {} 196 | $local:control ++ 197 | if ($local:control -gt ($this.controls.count - 1)) { 198 | $local:control = 0 199 | } 200 | } 201 | } 202 | } 203 | 204 | [void] addInputBox( 205 | [string]$name, 206 | [int]$x, 207 | [int]$y, 208 | [int]$width 209 | ) { 210 | [InputBox]$ib = [InputBox]::new() 211 | $ib.parent = $this 212 | $ib.name = $name 213 | $ib.id = $this.controls.Count 214 | $ib.X = $x 215 | $ib.Y = $y 216 | $ib.width = $width 217 | $ib.buffer = "" 218 | $this.controls.Add("control$($ib.Id)", $ib) 219 | } 220 | } 221 | 222 | class InputBox { 223 | [window]$parent 224 | [string]$name 225 | [int]$Id 226 | [int]$X 227 | [int]$Y 228 | [int]$Width 229 | [string]$buffer 230 | 231 | [void] draw() { 232 | $local:X = $this.parent.X + $this.X 233 | $local:Y = $this.parent.Y + $this.Y 234 | [console]::setcursorposition($local:X, $local:Y) 235 | [console]::write($this.buffer) 236 | } 237 | 238 | [System.Management.Automation.Host.KeyInfo] focus() { 239 | $local:X = $this.parent.X + $this.X 240 | $local:Y = $this.parent.Y + $this.Y 241 | $local:stop = $false 242 | while (-not $local:stop) { 243 | [console]::setcursorposition($local:X, $local:Y) 244 | [console]::write($this.buffer) 245 | [System.Console]::CursorVisible = $true 246 | if ($global:Host.UI.RawUI.KeyAvailable) { 247 | [System.Management.Automation.Host.KeyInfo]$key = $($global:host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')) 248 | } 249 | if ($key.VirtualKeyCode -eq 9) { 250 | $local:stop = $true 251 | } 252 | if ($key.VirtualKeyCode -eq 27) { 253 | $local:stop = $true 254 | } 255 | if ($key.Character -match "[\w+]") { 256 | $this.buffer = $this.buffer + $key.Character 257 | } 258 | } 259 | [System.Console]::CursorVisible = $false 260 | return $key 261 | } 262 | } 263 | 264 | function testWindow { 265 | [window]$win = [window]::new(0, 0, [console]::WindowWidth, [console]::WindowHeight - 1, $false, "white") 266 | $win.title = "Test Input Box" 267 | $win.titleColor = "Blue" 268 | $win.drawTitle() 269 | $win.addInputBox("searchkey", 1, 1, 30) 270 | $win.addInputBox("text", 10, 10, 40) 271 | $win.runWindow() 272 | Clear-Host 273 | $win.controls.GetEnumerator() | ForEach-Object { 274 | "$($([InputBox]$_.Value).Name) | $($([InputBox]$_.Value).buffer)" 275 | } 276 | } 277 | 278 | 279 | function Read-HostPlus() 280 | { 281 | param 282 | ( 283 | $CancelString = "x", 284 | $MaxLen = 60 285 | ) 286 | $result = "" 287 | $cursor = New-Object System.Management.Automation.Host.Coordinates 288 | while ($true) 289 | { 290 | While (!$host.UI.RawUI.KeyAvailable ){} 291 | $key = $host.UI.RawUI.ReadKey("NoEcho, IncludeKeyDown") 292 | 293 | switch ($key.virtualkeycode) 294 | { 295 | 27 { While (!$host.UI.RawUI.KeyAvailable ){}; return $CancelString } 296 | 13 { While (!$host.UI.RawUI.KeyAvailable ){}; return $result } 297 | 8 298 | { 299 | if ($result.length -gt 0) 300 | { 301 | $cursor = $host.UI.RawUI.CursorPosition 302 | $width = $host.UI.RawUI.MaxWindowSize.Width 303 | if ( $cursor.x -gt 0) { $cursor.x-- } 304 | else { $cursor.x = $width -1; $cursor.y-- } 305 | $Host.UI.RawUI.CursorPosition = $cursor ; write-host " " ; $Host.UI.RawUI.CursorPosition = $cursor 306 | $result = $result.substring(0,$result.length - 1 ) 307 | } 308 | } 309 | Default 310 | { 311 | $key_char = $key.character 312 | if( [byte][char]$key_char -ne 0 -and [byte][char]$key_char -gt 31 -and ($result + $key_char).Length -le $MaxLen ) 313 | { 314 | $result += $key_char 315 | $cursor.x = $host.UI.RawUI.CursorPosition.X 316 | Write-Host $key_char -NoNewline 317 | if ($cursor.X -eq $host.UI.RawUI.MaxWindowSize.Width-1 ) {write-host " `b" -NoNewline } 318 | } 319 | } 320 | } 321 | } 322 | } 323 | 324 | #testWindow 325 | -------------------------------------------------------------------------------- /SandBox/menu.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | A template for interactive, PowerShell menu. 3 | 4 | Created by Wiktor Mrowczynski. 5 | v.2022.05.25.A 6 | #> 7 | 8 | #region FUNCTIONS 9 | 10 | # Function used to simply revert console colors 11 | function Reverse-Colors { 12 | $bColor = [System.Console]::BackgroundColor 13 | $fColor = [System.Console]::ForegroundColor 14 | [System.Console]::BackgroundColor = $fColor 15 | [System.Console]::ForegroundColor = $bColor 16 | } 17 | 18 | # main function showing the menu 19 | function New-Menu { 20 | param( 21 | [parameter(Mandatory = $true)][System.Collections.Generic.List[string]]$menuItems, # contains all menu items 22 | [string]$title = "Menu Title", # the title for the menu 23 | [string]$hint = "Use arrows or type the number. 'Enter' - Run, 'ESC' - Exit`n", # hint to be displayed above menu entries 24 | [ValidateSet("green", "yellow", "red", "black", "white")] # you might add more colors allowed by console 25 | [string]$titleColor = 'green' # color of the title 26 | ) 27 | 28 | # prepare variables with function wide scope 29 | $invalidChoice = $false # initialize the flag indicating whether an ivalid key was pressed 30 | $selectIndex = 0 # initialize the variable storing the selection index (by default the first entry) 31 | $outChar = 'a' # initialize the variable storing the Enter or Esc value 32 | 33 | # prepare the cosnole 34 | [System.Console]::CursorVisible = $false # hide the cursor, we don't need it 35 | [Console]::Clear() # clear everything before showing the menu 36 | 37 | # main loop showing all the entries and handling the interaction with user 38 | # end the loop only when Enter or Escape is pressed 39 | while (([System.Int16]$inputChar.Key -ne [System.ConsoleKey]::Enter) -and ([System.Int16]$inputChar.Key -ne [System.ConsoleKey]::Escape)) { 40 | 41 | # show title and hint 42 | [System.Console]::CursorTop = 0 # start from top and then overwrite all lines; it's used instead of Clear to avoid blinking 43 | $tempColor = [System.Console]::ForegroundColor # keep the default font color 44 | [System.Console]::ForegroundColor = $titleColor # set the color for title according to value of parameter 45 | [System.Console]::WriteLine("$title`n") 46 | [System.Console]::ForegroundColor = $tempColor # revert back to default font color 47 | 48 | [System.Console]::WriteLine($hint) 49 | 50 | # show all entries 51 | for ($i = 0; $i -lt $menuItems.Count; $i++) { 52 | [System.Console]::Write("[$i] ") # add identity number to each entry, it's not highlighted for selection but it's in the same line 53 | if ($selectIndex -eq $i) { 54 | Reverse-Colors # in case this is the selected entry, reverse color just for it to make the selection visible 55 | [System.Console]::WriteLine($menuItems[$i]) 56 | Reverse-Colors 57 | } 58 | else { 59 | [System.Console]::WriteLine($menuItems[$i]) # in case this is not-selected entry, just show it 60 | } 61 | } 62 | 63 | # in case of invalid key, show the message 64 | if ($invalidChoice) { 65 | [System.Console]::WriteLine("Invalid button! Try again...") 66 | } 67 | else { 68 | [System.Console]::Write([System.String]::new(' ', [System.Console]::WindowWidth)) # in case the valid key was used after invalid, clean-up this line 69 | [System.Console]::SetCursorPosition(0, [System.Console]::CursorTop) # set the cursor back to first column so it's properly back to 1st column, 1st row in next iteration of the loop 70 | } 71 | $invalidChoice = $false # reset the invalid key flag 72 | 73 | # read the key from user 74 | $inputChar = [System.Console]::ReadKey($true) 75 | 76 | # try to convert it to number 77 | try { 78 | $number = [System.Int32]::Parse($inputChar.KeyChar) 79 | } 80 | catch { 81 | $number = -1 # in case it's not a valid number, set to always invalid -1 82 | } 83 | 84 | # hanlde arrows 85 | if ([System.Int16]$inputChar.Key -eq [System.ConsoleKey]::DownArrow) { 86 | if ($selectIndex -lt $menuItems.Count - 1) { 87 | # avoid selection out of range 88 | $selectIndex++ 89 | } 90 | } 91 | elseif ([System.Int16]$inputChar.Key -eq [System.ConsoleKey]::UpArrow) { 92 | if ($selectIndex -gt 0) { 93 | # avoid selection out of range 94 | $selectIndex-- 95 | } 96 | } 97 | elseif ($number -ge 0 -and $number -lt $menuItems.Count) { 98 | # if it's valid number within the range 99 | # handle double-digit numbers 100 | $timestamp = Get-Date 101 | while (![System.Console]::KeyAvailable -and ((Get-Date) - $timestamp).TotalMilliseconds -lt 500) { 102 | Start-Sleep -Milliseconds 250 # give the user 500 miliseconds to type in the 2nd digit, check after 250 to improve responsivness 103 | } 104 | if ([System.Console]::KeyAvailable) { 105 | # if user typed a key, read it in next line 106 | $secondChar = [System.Console]::ReadKey($true).KeyChar 107 | $fullChar = "$($inputChar.KeyChar)$($secondChar)" # join both keys 108 | try { 109 | # set selection 110 | $number = [System.Int32]::Parse($fullChar) # set the selection accordingly or raise flag for invalid key 111 | if ($number -ge 0 -and $number -lt $menuItems.Count) { 112 | $selectIndex = $number 113 | } 114 | else { 115 | $invalidChoice = $true 116 | } 117 | } 118 | catch { 119 | $invalidChoice = $true 120 | } 121 | } 122 | else { 123 | # set selection 124 | $selectIndex = $number # set selection for single digit number 125 | } 126 | } 127 | else { 128 | $invalidChoice = $true # key not recognized, raise the flag 129 | } 130 | $outChar = $inputChar # assign the key value to variable with scope outside the loop 131 | } 132 | 133 | # hanlde the result, just show the selected entry if Enter was pressed; do nothing if Escape was pressed 134 | if ($outChar.Key -eq [System.ConsoleKey]::Enter) { 135 | [Console]::WriteLine("You selected $($menuItems[$selectIndex])") 136 | } 137 | } 138 | 139 | #endregion FUNCTIONS 140 | 141 | #region MAIN SCRIPT 142 | 143 | # populate menuItems with example entries 144 | $menuItems = [System.Collections.Generic.List[string]]::new() 145 | <# 146 | $menuItems.Add("First Option") 147 | $menuItems.Add("Second Option") 148 | $menuItems.Add("Third Option") 149 | #> 150 | 1..15 | % { $menuItems.Add("Option un peu plus longue que ça lkfjlsdjflskjflksdjlkfsdjlkfsd $_") } 151 | 152 | # show the menu 153 | New-Menu $menuItems 154 | 155 | #endregion MAIN SCRIPT -------------------------------------------------------------------------------- /SandBox/params.json: -------------------------------------------------------------------------------- 1 | { 2 | "source": "*", 3 | "nresult": "10" 4 | } -------------------------------------------------------------------------------- /SandBox/params.json.old: -------------------------------------------------------------------------------- 1 | { 2 | "source": "*", 3 | "nresult": "*" 4 | } -------------------------------------------------------------------------------- /SandBox/screen.ps1: -------------------------------------------------------------------------------- 1 | $widths = @(32, 32, 14, 14 , 8) 2 | $widths2 = @(25, 25, 21, 21, 8) 3 | 4 | $tw = $host.UI.RawUI.BufferSize.Width -5 5 | 6 | $line = "" 7 | $widths | ForEach-Object { 8 | $colw = [math]::round($tw / 100 * $_) 9 | $line = $line, "".PadRight($colw -1 ,"#")," " -join "" 10 | } 11 | 12 | $line 13 | 14 | $stop = $false 15 | while (-not $stop) { 16 | if ($global:Host.UI.RawUI.KeyAvailable) { 17 | [System.Management.Automation.Host.KeyInfo]$key = $($global:host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')) 18 | $key.ControlKeyState 19 | } 20 | } -------------------------------------------------------------------------------- /SandBox/sleep.ps1: -------------------------------------------------------------------------------- 1 | ping -n localhost -------------------------------------------------------------------------------- /SandBox/test.csv: -------------------------------------------------------------------------------- 1 | Name,Id,Version,Available,Source 2 | Visual Studio Community 2022,Microsoft.VisualStudio.2022.Community,17.9.6,False,winget 3 | NVM for Windows,CoreyButler.NVMforWindows,1.1.11,True,winget 4 | 7-Zip,7zip.7zip,23.01,False,winget 5 | CPUID CPU-Z,CPUID.CPU-Z,2.09,False,winget 6 | Ubuntu 22.04 LTS,Canonical.Ubuntu.2204,2204.3.49.0,False,winget 7 | DBeaver Community Edition,dbeaver.dbeaver,24.0.0,True,winget 8 | DroidCam Client,dev47apps.DroidCam,6.5.2,False,winget 9 | GIMP,GIMP.GIMP,2.10.36,False,winget 10 | GitHub Desktop,GitHub.GitHubDesktop,3.3.11,True,winget 11 | Git,Git.Git,2.43.0,True,winget 12 | Microsoft Edge,Microsoft.Edge,124.0.2478.67,False,winget 13 | Microsoft Edge WebView2 Runtime,Microsoft.EdgeWebView2Runtime,124.0.2478.67,False,winget 14 | App Installer,Microsoft.AppInstaller,1.22.11132.0,False,winget 15 | Microsoft.UI.Xaml,Microsoft.UI.Xaml.2.7,7.2208.15002.0,False,winget 16 | Microsoft.UI.Xaml,Microsoft.UI.Xaml.2.8,8.2310.30001.0,False,winget 17 | Microsoft Visual C++ 2015 UWP Desktop Runtime Package,Microsoft.VCLibs.Desktop.14,14.0.33519.0,False,winget 18 | Dev Home (Preview),Microsoft.DevHome,0.1300.477.0,False,winget 19 | Windows Terminal,Microsoft.WindowsTerminal,1.19.10821.0,False,winget 20 | Microsoft Teams,Microsoft.Teams.Free,24033.1005.2701.7380,True,winget 21 | OBS Studio,OBSProject.OBSStudio,30.0.0,True,winget 22 | Oh My Posh,JanDeDobbeleer.OhMyPosh,19.20.0,True,winget 23 | Postman,Postman.Postman,10.21.0,True,winget 24 | Rustup: the Rust toolchain installer,Rustlang.Rustup,1.27.0,False,winget 25 | Steam,Valve.Steam,2.10.91.91,False,winget 26 | TegraRcmGUI,eliboa.TegraRcmGUI,2.6.0,False,winget 27 | Fedora Remix for WSL,whitewaterfoundry.fedora-remix-for-wsl,39.0.1.0,False,winget 28 | Wondershare Filmora 13,Wondershare.Filmora,Unknown,True,winget 29 | XnView MP,XnSoft.XnViewMP,1.6.4.0,True,winget 30 | CurseForge,Overwolf.CurseForge,0.244.5-16323,False,winget 31 | jq,jqlang.jq,1.7.1,False,winget 32 | fzf,junegunn.fzf,0.50.0,False,winget 33 | bat,sharkdp.bat,0.24.0,False,winget 34 | WinSCP,WinSCP.WinSCP,6.1.2,True,winget 35 | Microsoft Visual C++ 2013 Redistributable (x64),Microsoft.VCRedist.2013.x64,12.0.30501.0,True,winget 36 | Microsoft ASP.NET Core Runtime 7.0,Microsoft.DotNet.AspNetCore.7,7.0.18,False,winget 37 | Microsoft Visual C++ 2010 x86 Redistributable,Microsoft.VCRedist.2010.x86,10.0.30319,True,winget 38 | Webex,Cisco.Webex,43.11.0.27795,True,winget 39 | Python Launcher,Python.Launcher,3.12.0,False,winget 40 | Microsoft Visual C++ 2012 Redistributable (x86),Microsoft.VCRedist.2012.x86,11.0.61030.0,False,winget 41 | Go Programming Language,GoLang.Go,1.22.2,False,winget 42 | Win32DiskImager,Win32diskimager.win32diskimager,1.0.0,False,winget 43 | starship,Starship.Starship,1.18.2,False,winget 44 | VirtViewer,RedHat.VirtViewer,11.0.256,False,winget 45 | Windows Software Development Kit,Microsoft.WindowsSDK.10.0.19041,10.1.19041.685,False,winget 46 | Microsoft Visual C++ 2015-2022 Redistributable (x64),Microsoft.VCRedist.2015+.x64,14.38.33135.0,False,winget 47 | Keyviz,mulaRahul.Keyviz,1.0.6,False,winget 48 | Microsoft System CLR Types for SQL Server 2019,Microsoft.CLRTypesSQLServer.2019,15.0.2000.5,False,winget 49 | Microsoft Visual C++ 2008 Redistributable - x64,Microsoft.VCRedist.2008.x64,9.0.30729.6161,False,winget 50 | Neovim,Neovim.Neovim,0.9.5,False,winget 51 | OneCommander,MilosParipovic.OneCommander,3.68.3,True,winget 52 | Wondershare PDFelement,Wondershare.PDFelement.7,7.6.6.4995,True,winget 53 | Microsoft Visual Studio Code,Microsoft.VisualStudioCode,1.88.1,False,winget 54 | GitHub CLI,GitHub.cli,2.39.2,True,winget 55 | Logi Options+,Logitech.OptionsPlus,1.70.551909,False,winget 56 | Microsoft Web Deploy,Microsoft.WebDeploy,10.0.8215,False,winget 57 | NVIDIA PhysX (Legacy),Nvidia.PhysXLegacy,9.12.1031,True,winget 58 | PowerToys (Preview),Microsoft.PowerToys,0.80.0,True,winget 59 | Microsoft .NET Windows Desktop Runtime 8.0,Microsoft.DotNet.DesktopRuntime.8,8.0.4,False,winget 60 | VLC media player,VideoLAN.VLC,3.0.20,False,winget 61 | Microsoft .NET Windows Desktop Runtime 7.0,Microsoft.DotNet.DesktopRuntime.7,7.0.18,False,winget 62 | Microsoft Visual C++ 2008 Redistributable - x86,Microsoft.VCRedist.2008.x86,9.0.30729.6161,False,winget 63 | Nilesoft Shell,Nilesoft.Shell,1.9.10,True,winget 64 | NVIDIA GeForce Experience,Nvidia.GeForceExperience,3.28.0.412,False,winget 65 | Google Chrome,Google.Chrome,124.0.6367.91,True,winget 66 | ExplorerPatcher,valinet.ExplorerPatcher,22621.3007.63.3,True,winget 67 | Microsoft Visual C++ 2010 x64 Redistributable,Microsoft.VCRedist.2010.x64,10.0.30319,True,winget 68 | Belgium e-ID middleware,BelgianGovernment.Belgium-eIDmiddleware,5.1.6030,False,winget 69 | Java SE Development Kit 18,Oracle.JDK.18,18.0.2.1,False,winget 70 | PowerShell,Microsoft.PowerShell,7.4.2.0,False,winget 71 | Microsoft .NET SDK 6.0,Microsoft.DotNet.SDK.6,6.0.421,False,winget 72 | Microsoft Visual C++ 2015-2022 Redistributable (x64),Microsoft.VCRedist.2015+.x64,14.38.33135.0,False,winget 73 | Microsoft Visual C++ 2012 Redistributable (x64),Microsoft.VCRedist.2012.x64,11.0.61030.0,False,winget 74 | Python 3.12,Python.Python.3.12,3.12.0,True,winget 75 | Microsoft .NET Runtime 6.0,Microsoft.DotNet.Runtime.6,6.0.29,False,winget 76 | Microsoft Visual C++ 2013 Redistributable (x86),Microsoft.VCRedist.2013.x86,12.0.30501.0,True,winget 77 | -------------------------------------------------------------------------------- /SandBox/testGum.ps1: -------------------------------------------------------------------------------- 1 | # test if gum is installed 2 | 3 | # $type = Invoke-Command -scriptblock {gum choose 'fix' 'feat' 'docs' 'style' 'refactor' 'test' 'chore' 'revert'} 4 | # $type 5 | 6 | # $type = Invoke-Command -scriptblock {"fix`nfeat`ndocs`nstyle`nrefactor`ntest`nchore`nrevert`n" | gum choose --no-limit --header "Choisissez ....."} 7 | # $type 8 | 9 | # $confirm = Invoke-Command -ScriptBlock {gum confirm --affirmative="Oui" --negative="Non" "Test" && echo "Oui" || echo "Non"} 10 | # $confirm 11 | 12 | # $file = Invoke-Command -ScriptBlock {gum file} 13 | # $file 14 | 15 | 16 | # eza -f -1 | Where-Object {$_ -like "*.ps1"} | gum filter --no-limit --header "Choisissez un fichier" 17 | 18 | gum spin --spinner dot --title "List Winget Packages" -- pwsh.exe -noprofile -Command ".\getingetpackages.ps1" 19 | gum table --file .\test.csv --widths 30,30,10,10,30 -------------------------------------------------------------------------------- /SandBox/testWG.ps1: -------------------------------------------------------------------------------- 1 | param ( 2 | [ValidateSet("Show-WGList", "Install-WGPackage", "Search-WGPackage", "Get-ScoopStatus", "Test-Scoop", "Uninstall-WGPackage","Build-WGInstallFile")]$func 3 | ) 4 | 5 | 6 | $include = [System.IO.Path]::GetDirectoryName($myInvocation.MyCommand.Definition) 7 | 8 | . "$include\wingetposh.ps1" 9 | 10 | switch ($func) { 11 | "Get-ScoopStatus" { Get-ScoopStatus } 12 | "Show-WGList" { Show-WGList } 13 | "Install-WGPackage" { Install-WGPackage } 14 | "Search-WGPackage" { Search-WGPackage } 15 | "Test-Scoop" { 16 | Get-WingetposhConfig 17 | $script:config.IncludeScoop 18 | Test-Path -Path "$env:HOMEDRIVE$env:HOMEPATH\Scoop\" 19 | } 20 | "Uninstall-WGPackage" { 21 | Uninstall-WGPackage 22 | } 23 | "Build-WGInstallFile" 24 | { 25 | Build-WGInstallFile 26 | } 27 | Default { 28 | #Search-WGPackage -package git 29 | #Get-WGPackage 30 | #Search-WGPackage 31 | #Install-WGPackage 32 | #Get-WGPackage -interactive -update 33 | Get-WGList -quiet $true | Out-JSON 34 | #Show-WGList 35 | #Update-WGPackage -quiet 36 | #Search-WGPackage -source $args -interactive -allowSearch 37 | #Uninstall-WGPackage -source winget -apply 38 | #Get-WGSources 39 | #Set-WingetposhConfig -param UseNerdFont -value $args 40 | #Install-WGPackage 41 | #Get-WGPVersion -param WGP 42 | #Get-ScoopStatus 43 | #Get-ScoopBuckets 44 | #Reset-WingetposhConfig 45 | #GetVersion 46 | } 47 | } -------------------------------------------------------------------------------- /SandBox/testcolor.ps1: -------------------------------------------------------------------------------- 1 | [Flags()] enum Styles { 2 | Normal = 0 3 | Underline = 1 4 | Bold = 2 5 | Reversed = 3 6 | } 7 | 8 | function testcolor { 9 | if ($iscoreclr) { 10 | $esc = "`e" 11 | } else { 12 | $esc = $([char]0x1b) 13 | } 14 | 0..255 | ForEach-Object { 15 | Write-Host "$($_) $esc[4m$esc[38;5;$($_)m'test'$esc[0m" 16 | } 17 | } 18 | 19 | testcolor -------------------------------------------------------------------------------- /SandBox/teststream.ps1: -------------------------------------------------------------------------------- 1 | [Console]::OutputEncoding = [System.Text.Encoding]::UTF8 2 | [string[]]$WingetArgs = @("search","node") 3 | #$WingetArgs += "--source", "winget" 4 | 5 | [string[]] $IndexTitles = @("Name", "Id", "Version", "Available", "Source") 6 | 7 | [string[]]$WinGetSourceListRaw = & "WinGet" $WingetArgs | out-string -stream | foreach-object{$_ -replace ("$([char]915)$([char]199)$([char]170)", "$([char]199)")} 8 | 9 | $rgex = $IndexTitles -join "|" 10 | 11 | $rgex 12 | for ($Offset=0; $Offset -lt $WinGetSourceListRaw.Length; $Offset++) { 13 | if($WinGetSourceListRaw[$Offset].Split(" ")[0].Trim() -match $rgex) { 14 | $Found = $true 15 | break 16 | } 17 | } 18 | $Found -------------------------------------------------------------------------------- /SandBox/testutf.ps1: -------------------------------------------------------------------------------- 1 | [int32]$i = 0 2 | while($i -lt [int32]::MaxValue) { 3 | Write-Host "$i : $([char]::ConvertFromUtf32($i))" -NoNewline 4 | $i++ 5 | } 6 | 7 | -------------------------------------------------------------------------------- /SandBox/tools.ps1: -------------------------------------------------------------------------------- 1 | function Get-FieldLength { 2 | param( 3 | [string]$buffer 4 | ) 5 | $i = 0 6 | $buffer.ToCharArray() | ForEach-Object { 7 | $l = [Text.Encoding]::UTF8.GetByteCount($_) 8 | if ($l -ge 2) { 9 | $l = $l - 1 10 | } 11 | $i += $l 12 | } 13 | return $i 14 | } 15 | 16 | function Get-ProportionalLength { 17 | param( 18 | [int]$MaxLength 19 | ) 20 | $w = $Host.UI.RawUI.BufferSize.Width -6 21 | return [math]::Floor($w / 100 * $MaxLength) 22 | } 23 | 24 | function TruncateString { 25 | param ( 26 | [string]$InputString, 27 | [int]$MaxLength 28 | ) 29 | $l = Get-FieldLength -buffer $InputString 30 | $w = $Host.UI.RawUI.BufferSize.Width -6 31 | $Maxp = [math]::Floor($w / 100 * $MaxLength) 32 | if ($l -le $Maxp) { 33 | $pos = 0 34 | $offset = 0 35 | $TruncatedString = $InputString 36 | while ($pos -lt $InputString.Length) { 37 | $c = $InputString[$pos] 38 | $nbchars = [Text.Encoding]::UTF8.GetByteCount($c) 39 | if ($nbchars -gt 1) { 40 | $offset += ($nbchars - 2) 41 | } 42 | # $result += $nbchars 43 | $pos++ 44 | } 45 | while ($pos -lt $Maxp - $offset) { 46 | $TruncatedString += " " 47 | $pos++ 48 | } 49 | return $TruncatedString 50 | } 51 | 52 | $TruncatedString = $InputString.Substring(0, $MaxP - 1) + "…" 53 | return $TruncatedString 54 | } -------------------------------------------------------------------------------- /SandBox/tools/GetResuorces.ps1: -------------------------------------------------------------------------------- 1 | $languages = @('de-DE', 'es-ES', 'fr-FR', 'it-IT', 'ja-JP', 'ko-KR', 'pt-BR', 'ru-RU', 'zh-CN', 'zh-TW') 2 | 3 | $WGVersion = "release-v1.6" 4 | 5 | $url1 = "https://raw.githubusercontent.com/microsoft/winget-cli/release-v1.6/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw" 6 | $url2 = "https://raw.githubusercontent.com/microsoft/winget-cli/{0}/Localization/Resources/{1}/winget.resw" 7 | 8 | $resfile = "localization.json" 9 | 10 | function Get-ResourceFile { 11 | param( 12 | [string]$url, 13 | [string]$version, 14 | [string]$lang 15 | ) 16 | try { 17 | $localization = $url -f $version, $lang 18 | #$data = ([xml](((Invoke-WebRequest -Uri "https://raw.githubusercontent.com/microsoft/winget-cli/release-$version/Localization/Resources/$language/winget.resw" -ErrorAction Stop ).Content -replace "\uFEFF", ""))).root.data 19 | #Write-Host $localization 20 | $data = ([xml](((Invoke-WebRequest -Uri $localization -ErrorAction Continue ).Content -replace "\uFEFF", ""))).root.data 21 | 22 | } 23 | catch { 24 | Write-Host "Error $localization" 25 | } 26 | return $data 27 | } 28 | 29 | $res = [ordered]@{} 30 | $hash = @{} 31 | Get-ResourceFile -url $url1 -version $WGVersion -lang 'en-US' | ForEach-Object { 32 | $hash[$_.name] = $_.value 33 | } 34 | $res['en-us'] = $hash 35 | foreach ($lang in $languages) { 36 | Get-ResourceFile -url $url2 -version $WGVersion -lang $lang 37 | } 38 | Clear-Host 39 | Write-Host $res -------------------------------------------------------------------------------- /SandBox/tools/install.ps1: -------------------------------------------------------------------------------- 1 | function getWingetLocals { 2 | $culture = ((Get-WinUserLanguageList).LanguageTag -split "-")[0] 3 | $languages = @('de-DE', 'es-ES', 'fr-FR', 'it-IT', 'ja-JP', 'ko-KR', 'pt-BR', 'ru-RU', 'zh-CN', 'zh-TW') 4 | $language = $languages | Where-Object {$_.StartsWith($culture)} 5 | Write-Host "⏳ Downloading resources for $language" 6 | $hash = @{} 7 | 8 | try { 9 | # Download resources file from github 10 | $data = ([xml](((Invoke-WebRequest -Uri "https://raw.githubusercontent.com/microsoft/winget-cli/master/Localization/Resources/$language/winget.resw" -ErrorAction Stop ).Content -replace "\uFEFF", ""))).root.data 11 | } 12 | catch { 13 | # Fall back on the en-US resources 14 | $data = ([xml](((Invoke-WebRequest -Uri "https://raw.githubusercontent.com/microsoft/winget-cli/master/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw" -ErrorAction Stop ).Content -replace "\uFEFF", ""))).root.data 15 | } 16 | $data | ForEach-Object { 17 | $hash[$_.name] = $_.value 18 | } 19 | $hash 20 | } 21 | 22 | $version = [string]$(Get-InstalledModule -Name wingetposh -ErrorAction Ignore).version 23 | if (-not (Test-Path -Path "~/.config/.wingetposh/params.$version")) { 24 | 25 | Write-Host "🚧 Parsing resources and writing config files." 26 | if (-not (Test-Path -Path ~/.config/.wingetposh)) { 27 | New-Item -Path ~/.config/.wingetposh -ItemType Directory | Out-Null 28 | Remove-Item -Path ~/.config/.wingetposh/locals.json -ErrorAction Ignore | Out-Null 29 | New-Item -Path ~/.config/.wingetposh/locals.json | Out-Null 30 | } 31 | 32 | $l = getWingetLocals 33 | $l | ConvertTo-Json | Out-File -FilePath ~/.config/.wingetposh/locals.json -Force | Out-Null 34 | 35 | $init = @{} 36 | ( 37 | ('UseNerdFont', $false), 38 | ('SilentInstall', $false), 39 | ('AcceptPackageAgreements', $true), 40 | ('AcceptSourceAgreements', $true), 41 | ('Force', $false), 42 | ('IncludeScoop',$false) 43 | ) | ForEach-Object { $init[$_[0]] = $_[1] } 44 | 45 | $config = @{} 46 | if (Test-Path -Path ~/.config/.wingetposh/config.json) { 47 | (Get-Content $env:USERPROFILE/.config/.wingetposh/config.json | ConvertFrom-Json).psobject.Properties | ForEach-Object { 48 | $config[$_.Name] = $_.Value 49 | } 50 | } 51 | " " 52 | $init.GetEnumerator() | ForEach-Object { 53 | if (-not $config.ContainsKey($_.key)) { 54 | $config.Add($_.key, $_.Value) 55 | } 56 | } 57 | 58 | 59 | $config | ConvertTo-Json | Out-File -FilePath ~/.config/.wingetposh/config.json -Force | Out-Null 60 | "ok" | Out-File -FilePath "~/.config/.wingetposh/params.$version" | Out-Null 61 | 62 | Write-Host "Wingetposh version $version installed successfully 👌" 63 | Write-Host "".PadRight($Host.UI.RawUI.BufferSize.Width, '—') 64 | Write-Host "🗒️ Go to http://github.com/yves848/wingetposh for help and infos." 65 | Write-Host "📨 Please report bugs and requests at wingetposh@gmail.com" 66 | Invoke-Expression .\WGGui.exe 67 | } -------------------------------------------------------------------------------- /SandBox/updateconfig.ps1: -------------------------------------------------------------------------------- 1 | $init = @{} 2 | ( 3 | ('UseNerdFont', $false), 4 | ('SilentInstall', $false), 5 | ('AcceptPackageAgreements', $true), 6 | ('AcceptSourceAgreements', $true), 7 | ('Force', $false) 8 | ) | ForEach-Object { $init[$_[0]] = $_[1] } 9 | 10 | $config = @{} 11 | if (Test-Path -Path ~/.config/.wingetposh/config.json) { 12 | (Get-Content $env:USERPROFILE/.config/.wingetposh/config.json | ConvertFrom-Json).psobject.Properties | ForEach-Object { 13 | $config[$_.Name] = $_.Value 14 | } 15 | } 16 | " " 17 | $init.GetEnumerator() | ForEach-Object { 18 | if (-not $config.ContainsKey($_.key)) { 19 | $config.Add($_.key,$_.Value) 20 | } 21 | } 22 | 23 | $config | ConvertTo-Json | Out-File -FilePath ~/.config/.wingetposh/config.json -Force | Out-Null -------------------------------------------------------------------------------- /SandBox/visuals.ps1: -------------------------------------------------------------------------------- 1 | function color { 2 | param ( 3 | $Text, 4 | $ForegroundColor = 'default', 5 | $BackgroundColor = 'default' 6 | ) 7 | # Terminal Colors 8 | $Colors = @{ 9 | "default" = @(40, 50) 10 | "black" = @(30, 0) 11 | "lightgrey" = @(33, 43) 12 | "grey" = @(37, 47) 13 | "darkgrey" = @(90, 100) 14 | "red" = @(91, 101) 15 | "darkred" = @(31, 41) 16 | "green" = @(92, 102) 17 | "darkgreen" = @(32, 42) 18 | "yellow" = @(93, 103) 19 | "white" = @(97, 107) 20 | "brightblue" = @(94, 104) 21 | "darkblue" = @(34, 44) 22 | "indigo" = @(35, 45) 23 | "cyan" = @(96, 106) 24 | "darkcyan" = @(36, 46) 25 | } 26 | 27 | if ( $ForegroundColor -notin $Colors.Keys -or $BackgroundColor -notin $Colors.Keys) { 28 | Write-Error "Invalid color choice!" -ErrorAction Stop 29 | } 30 | 31 | "$([char]27)[$($colors[$ForegroundColor][0])m$([char]27)[$($colors[$BackgroundColor][1])m$($Text)$([char]27)[0m" 32 | } 33 | 34 | function Open-Spinner { 35 | param( 36 | [string]$label = "Loading", 37 | [string]$type = "Dot" 38 | ) 39 | $Spinners = @{ 40 | "Circle" = @{ 41 | "Frames" = @("◜", "◠", "◝", "◞", "◡", "◟") 42 | "Sleep" = 50 43 | } 44 | "Dots" = @{ 45 | "Frames" = @("⣾", "⣽", "⣻", "⢿", "⡿", "⣟", "⣯", "⣷", "⣿") 46 | "Sleep" = 50 47 | } 48 | "Line" = @{ 49 | "Frames" = @("▰▱▱▱▱▱▱", "▰▰▱▱▱▱▱", "▰▰▰▱▱▱▱", "▰▰▰▰▱▱▱", "▰▰▰▰▰▱▱", "▰▰▰▰▰▰▱", "▰▰▰▰▰▰▰", "▰▱▱▱▱▱▱") 50 | "Sleep" = 50 51 | } 52 | "Square" = @{ 53 | "Frames" = @("⣾⣿", "⣽⣿", "⣻⣿", "⢿⣿", "⡿⣿", "⣟⣿", "⣯⣿", "⣷⣿","⣿⣾", "⣿⣽", "⣿⣻", "⣿⢿", "⣿⡿", "⣿⣟", "⣿⣯", "⣿⣷") 54 | "Sleep" = 50 55 | } 56 | "Bubble" = @{ 57 | "Frames" = @("......","o.....","Oo....","oOo...",".oOo..","..oOo.","...oOo","....oO",".....o","....oO","...oOo","..oOo.",".oOo..","oOo...","Oo....","o.....","......") 58 | "Sleep" = 50 59 | } 60 | "Arrow" = @{ 61 | "Frames" = @("≻ ", " ≻ ", " ≻ ", " ≻ ", " ≻"," ≺", " ≺ ", " ≺ ", " ≺ ", "≺ ") 62 | "Sleep" = 50 63 | } 64 | "Pulse" = @{ 65 | "Frames" = @("◾", "◾", "◼️", "◼️", "⬛", "⬛", "◼️", "◼️") 66 | "Sleep" = 50 67 | } 68 | } 69 | 70 | $statedata = [System.Collections.Hashtable]::Synchronized([System.Collections.Hashtable]::new()) 71 | $runspace = [runspacefactory]::CreateRunspace() 72 | $statedata.X = $host.ui.rawui.CursorPosition.X 73 | $statedata.Y = $host.ui.rawui.CursorPosition.Y 74 | $statedata.offset = ($Spinners[$type].Frames | Measure-Object -Property Length -Maximum).Maximum 75 | $ThemedFrames = @() 76 | $Spinners[$type].Frames | ForEach-Object { 77 | $ThemedFrames += gum style $_ --foreground $($Theme["brightPurple"]) 78 | } 79 | $statedata.Frames =$ThemedFrames 80 | $statedata.Sleep = $Spinners[$type].Sleep 81 | $statedata.label = $label 82 | $runspace.Open() 83 | $Runspace.SessionStateProxy.SetVariable("StateData", $StateData) 84 | $sb = { 85 | [System.Console]::OutputEncoding = [System.Text.Encoding]::UTF8 86 | [system.Console]::CursorVisible = $false 87 | $X = $StateData.X 88 | $Y = $StateData.Y 89 | 90 | $Frames = $statedata.Frames 91 | $i = 0 92 | while ($true) { 93 | [System.Console]::setcursorposition($X, $Y) 94 | # $text = "$([char]27)[35m$([char]27)[50m$($Frames[$i])$([char]27)[0m" 95 | $text = $Frames[$i] 96 | [system.console]::write($text) 97 | [System.Console]::setcursorposition(($X + $statedata.offset) + 1, $Y) 98 | [system.console]::write($statedata.label) 99 | $i = ($i + 1) % $Frames.Length 100 | Start-Sleep -Milliseconds $Statedata.Sleep 101 | } 102 | } 103 | $session = [powershell]::create() 104 | $null = $session.AddScript($sb) 105 | $session.Runspace = $runspace 106 | $null = $session.BeginInvoke() 107 | return $Session, $runspace 108 | } 109 | 110 | function Close-Spinner { 111 | param( 112 | $Session, 113 | $Runspace 114 | ) 115 | $null = $session.Stop() 116 | $null = $runspace.dispose() 117 | [System.Console]::setcursorposition(0, $host.ui.rawui.CursorPosition.Y) # setting the cursor position (X) 118 | [system.console]::write(" ".PadLeft(($host.ui.rawui.BufferSize.Width), " ")) 119 | [System.Console]::setcursorposition(0, $host.ui.rawui.CursorPosition.Y) 120 | [System.Console]::CursorVisible = $true 121 | } 122 | 123 | class Frame { 124 | [char]$UL 125 | [char]$UR 126 | [char]$TOP 127 | [char]$LEFT 128 | [char]$RIGHT 129 | [char]$BL 130 | [char]$BR 131 | [char]$BOTTOM 132 | [char]$LEFTSPLIT 133 | [char]$RIGHTSPLIT 134 | 135 | 136 | $FrameStyles = @{ 137 | "Single" = @{ 138 | "UL" = "┌" 139 | "UR" = "┐" 140 | "TOP" = "─" 141 | "LEFT" = "│" 142 | "RIGHT" = "│" 143 | "BL" = "└" 144 | "BR" = "┘" 145 | "BOTTOM" = "─" 146 | "LEFTSPLIT" = "├" 147 | "RIGHTSPLIT" = "┤" 148 | } 149 | "Double" = @{ 150 | "UL" = "╔" 151 | "UR" = "╗" 152 | "TOP" = "═" 153 | "LEFT" = "║" 154 | "RIGHT" = "║" 155 | "BL" = "╚" 156 | "BR" = "╝" 157 | "BOTTOM" = "═" 158 | "LEFTSPLIT" = "╠" 159 | "RIGHTSPLIT" = "╣" 160 | } 161 | "Rounded" = @{ 162 | "UL" = "╭" 163 | "UR" = "╮" 164 | "TOP" = "─" 165 | "LEFT" = "│" 166 | "RIGHT" = "│" 167 | "BL" = "╰" 168 | "BR" = "╯" 169 | "BOTTOM" = "─" 170 | "LEFTSPLIT" = "├" 171 | "RIGHTSPLIT" = "┤" 172 | } 173 | } 174 | Frame ( 175 | [string]$FrameStyle 176 | ) { 177 | $this.UL = $this.FrameStyles[$FrameStyle].UL 178 | $this.UR = $this.FrameStyles[$FrameStyle].UR 179 | $this.TOP = $this.FrameStyles[$FrameStyle].TOP 180 | $this.LEFT = $this.FrameStyles[$FrameStyle].LEFT 181 | $this.RIGHT = $this.FrameStyles[$FrameStyle].RIGHT 182 | $this.BL = $this.FrameStyles[$FrameStyle].BL 183 | $this.BR = $this.FrameStyles[$FrameStyle].BR 184 | $this.BOTTOM = $this.FrameStyles[$FrameStyle].BOTTOM 185 | $this.LEFTSPLIT = $this.FrameStyles[$FrameStyle].LEFTSPLIT 186 | $this.RIGHTSPLIT = $this.FrameStyles[$FrameStyle].RIGHTSPLIT 187 | } 188 | } 189 | 190 | class window { 191 | [int]$X 192 | [int]$Y 193 | [int]$W 194 | [int]$H 195 | [Frame]$frameStyle 196 | [System.ConsoleColor]$frameColor 197 | [string]$title = "" 198 | [System.ConsoleColor]$titleColor 199 | [string]$footer = "" 200 | [int]$page = 1 201 | [int]$nbPages = 1 202 | 203 | window( 204 | [int]$X, 205 | [int]$y, 206 | [int]$w, 207 | [int]$h, 208 | [string]$FrameStyle = "Single", 209 | [System.ConsoleColor]$color = "White" 210 | ) { 211 | $this.X = $X 212 | $this.Y = $y 213 | $this.W = $W 214 | $this.H = $H 215 | $this.frameStyle = [Frame]::new($FrameStyle) 216 | $this.frameColor = $color 217 | 218 | } 219 | 220 | window( 221 | [int]$X, 222 | [int]$y, 223 | [int]$w, 224 | [int]$h, 225 | [string]$FrameStyle = "Single", 226 | [System.ConsoleColor]$color = "White", 227 | [string]$title = "", 228 | [System.ConsoleColor]$titlecolor = "Blue" 229 | ) { 230 | $this.X = $X 231 | $this.Y = $y 232 | $this.W = $W 233 | $this.H = $H 234 | $this.frameStyle = [Frame]::new($FrameStyle) 235 | $this.frameColor = $color 236 | $this.title = $title 237 | $this.titleColor = $titlecolor 238 | } 239 | 240 | [void] setPosition( 241 | [int]$X, 242 | [int]$Y 243 | ) { 244 | [System.Console]::SetCursorPosition($X, $Y) 245 | } 246 | 247 | [void] drawWindow() { 248 | # $esc = $([char]0x1b) 249 | 250 | [System.Console]::CursorVisible = $false 251 | $this.setPosition($this.X, $this.Y) 252 | $bloc1 = $this.frameStyle.UL, "".PadLeft($this.W - 2, $this.frameStyle.TOP), $this.frameStyle.UR -join "" 253 | $blank = $this.frameStyle.LEFT, "".PadLeft($this.W - 2, " "), $this.frameStyle.RIGHT -join "" 254 | Write-Host $bloc1 -ForegroundColor $this.frameColor -NoNewline 255 | for ($i = 1; $i -lt $this.H; $i++) { 256 | $Y2 = $this.Y + $i 257 | $X3 = $this.X 258 | $this.setPosition($X3, $Y2) 259 | Write-Host $blank -ForegroundColor $this.frameColor 260 | } 261 | $Y2 = $this.Y + $this.H 262 | $this.setPosition( $this.X, $Y2) 263 | $bloc1 = $this.frameStyle.BL, "".PadLeft($this.W - 2, $this.frameStyle.BOTTOM), $this.frameStyle.BR -join "" 264 | Write-Host $bloc1 -ForegroundColor $this.frameColor -NoNewline 265 | $this.drawTitle() 266 | $this.drawFooter() 267 | } 268 | 269 | 270 | [void] drawVersion() { 271 | $v = Get-WGPVersion -param WGP 272 | $version = $this.frameStyle.LEFTSPLIT, $v, $this.frameStyle.RIGHTSPLIT -join "" 273 | $isempty = [string]::IsNullOrEmpty($v) 274 | if ($isempty -eq $true) { 275 | $version = $this.frameStyle.LEFTSPLIT, "Debug", $this.frameStyle.RIGHTSPLIT -join "" 276 | } 277 | [System.Console]::setcursorposition($this.W - ($version.Length + 6), $this.Y ) 278 | [console]::write($version) 279 | } 280 | 281 | [void] drawTitle() { 282 | if ($this.title -ne "") { 283 | $local:X = $this.x + 2 284 | $this.setPosition($local:X, $this.Y) 285 | Write-Host ($this.frameStyle.RIGHTSPLIT, " " -join "") -NoNewline -ForegroundColor $this.frameColor 286 | $local:X = $local:X + 2 287 | $this.setPosition($local:X, $this.Y) 288 | Write-Host $this.title -NoNewline -ForegroundColor $this.titleColor 289 | $local:X = $local:X + $this.title.Length 290 | $this.setPosition($local:X, $this.Y) 291 | Write-Host (" ", $this.frameStyle.LEFTSPLIT -join "") -NoNewline -ForegroundColor $this.frameColor 292 | } 293 | } 294 | 295 | [void] drawFooter() { 296 | $Y2 = $this.Y + $this.H 297 | $this.setPosition( $this.X, $Y2) 298 | $bloc1 = $this.frameStyle.BL, "".PadLeft($this.W - 2, $this.frameStyle.BOTTOM), $this.frameStyle.BR -join "" 299 | Write-Host $bloc1 -ForegroundColor $this.frameColor -NoNewline 300 | if ($this.footer -ne "") { 301 | $local:x = $this.x + 2 302 | $local:Y = $this.Y + $this.h 303 | $this.setPosition($local:X, $local:Y) 304 | $foot = $this.frameStyle.RIGHTSPLIT, " ", $this.footer, " ", $this.frameStyle.LEFTSPLIT -join "" 305 | [console]::write($foot) 306 | } 307 | } 308 | 309 | [void] drawPagination() { 310 | $sPages = ('Page {0}/{1}' -f ($this.page, $this.nbPages)) 311 | [System.Console]::setcursorposition($this.W - ($sPages.Length + 6), $this.Y + $this.H) 312 | [console]::write($sPages) 313 | } 314 | 315 | [void] clearWindow() { 316 | $local:blank = "".PadLeft($this.W, " ") 317 | for ($i = 1; $i -lt $this.H; $i++) { 318 | $this.setPosition(($this.X), ($this.Y + $i)) 319 | Write-Host $blank 320 | } 321 | } 322 | } 323 | 324 | class Grid { 325 | [int]$X 326 | [int]$Y 327 | [int]$Width 328 | [int]$Height 329 | 330 | } 331 | 332 | function makeLines { 333 | param( 334 | [column[]]$columns, 335 | [package[]]$items 336 | ) 337 | 338 | $index = 0 339 | [string]$line = "" 340 | while ($index -lt $items.Count) { 341 | $item = $items[$index] 342 | [string]$temp = "" 343 | if ($item.IsUpdateAvailable) { 344 | $temp = [string]::Concat($temp, "↺ ") 345 | } else { 346 | $temp = [string]::Concat($temp, " ") 347 | } 348 | $columns | ForEach-Object { 349 | $fieldname = $_.FieldName 350 | $width = [int32]$_.Width 351 | $buffer = TruncateString -InputString $([string]$item."$fieldname") -MaxLength $width 352 | $temp = [string]::Concat($temp,[string]$buffer," ") 353 | } 354 | 355 | $line = [string]::Concat($line, $temp) 356 | 357 | if ($index -lt $items.Count - 1) { 358 | $line = [string]::Concat($line, "`n") 359 | } 360 | $index ++ 361 | } 362 | return $line 363 | } 364 | 365 | function makeHeader { 366 | param( 367 | [column[]]$columns 368 | ) 369 | $header = " " 370 | $columns | ForEach-Object { 371 | $w = Get-ProportionalLength -MaxLength $_.Width 372 | $header = [string]::Concat($header, $_.Label.PadRight($w," "), " ") 373 | } 374 | return gum style $([string]::Concat(" ",$header)) --foreground $($Theme["brightYellow"]) 375 | } 376 | 377 | function makeTitle { 378 | param( 379 | [string]$title, 380 | [int]$width 381 | ) 382 | $w = ($width / 2) + ($title.Length / 2) 383 | $title = $title.PadLeft($w, " ") 384 | $title = $title.PadRight($width, " ") 385 | return gum style $title --foreground $($Theme["brightPurple"]) --background $($Theme["background"]) --bold --align "center" 386 | } -------------------------------------------------------------------------------- /SandBox/wgGUI.ps1: -------------------------------------------------------------------------------- 1 | Add-Type -AssemblyName PresentationFramework 2 | 3 | Import-Module ~/CLRCLI.dll 4 | 5 | function wgGUI { 6 | $xamlFile = "C:\Users\yvesg\git\WingetPosh\GUI\WingetGUI\MainWindow.xaml" 7 | $inputXML = Get-Content $xamlFile -Raw 8 | $inputXML = $inputXML -replace 'mc:Ignorable="d"', '' -replace "x:N", 'N' -replace '^ 129 | Write-Host "Buffer: $buffer position:$position l1:$l1 diff:$diff $($bl2.Length)" 130 | } 131 | 132 | } 133 | if ($_.Index -gt 0) { 134 | # add separator 135 | $bl2 = ([string]$bl2).Remove($position - 1, 1).Insert($position - 1, "|") 136 | } 137 | } 138 | Write-Host $bl2 139 | } 140 | } 141 | 142 | [void] ParseList() { 143 | $partialKey = "---" 144 | $index = 0 145 | $data = $false 146 | $this.list | ForEach-Object { 147 | if ($_ -match $partialKey) { 148 | # Found the columns headers 149 | $index = $this.list.IndexOf($_) - 1 150 | $this.GetColumnHeaders($this.list[$index]) 151 | $this.lineWidth = ([string]$this.list[$index]).Length 152 | $data = $true 153 | } 154 | else { 155 | if ($data) { 156 | # parse the real data 157 | $this.ParseData($_) 158 | } 159 | } 160 | } 161 | } 162 | 163 | [void] ParseData( 164 | $line 165 | ) { 166 | $line = $line.PadRight($this.lineWidth, " ").Replace("|", " ").Replace('…', ' ') 167 | $i = 0 168 | $pos = 0 169 | $insertat = 0 170 | $offset = 0 171 | $this.columns | ForEach-Object { 172 | if ($_.Index -gt 0) { 173 | while ($pos -lt $_.Index) { 174 | $nbchars = [Text.Encoding]::UTF8.GetByteCount($line[$i]) 175 | $pos = $pos + $nbchars 176 | if ($nbchars -gt 1) { 177 | if ($pos -lt $_.Index) { 178 | $insertat += 2 179 | } 180 | else { 181 | $insertat += $nbchars 182 | } 183 | } 184 | else { 185 | $insertat++ 186 | } 187 | $i++ 188 | } 189 | $line = ($line).Insert($insertat + $offset, "|") 190 | $offset++ 191 | } 192 | } 193 | 194 | $fields = [ordered]@{} 195 | $idx = 0 196 | 197 | $line.Split("|") | ForEach-Object { 198 | $base = $script:fields.psobject.Properties | Where-Object { $_.Value -eq $this.columns[$Idx].Value } 199 | if ($base.count -eq 1) { 200 | $BaseName = $base.Name 201 | } 202 | else { 203 | $BaseName = ($base | Where-Object { $_.Name.StartsWith("Search") }).Name 204 | } 205 | $fields.add($baseFields[$BaseName], $_.Trim()) 206 | $idx++ 207 | } 208 | 209 | [item]$item = [item]::new() 210 | $item.data = New-Object -TypeName PSObject -Property $fields 211 | $this.items += $item 212 | } 213 | 214 | GetColumnHeaders( 215 | [string]$header 216 | ) { 217 | $this.columns = ($header | Select-String -Pattern "(?:\S+)" -AllMatches).Matches 218 | } 219 | } 220 | 221 | class displayOptions { 222 | [System.Boolean]$selected 223 | [System.Boolean]$checked 224 | [lineAction]$action 225 | } 226 | class Item { 227 | [displayOptions]$options 228 | [PSCustomObject]$data 229 | } 230 | 231 | function Get-WGPackage { 232 | param( 233 | [string]$source = $null, 234 | [switch]$interactive = $false, 235 | [switch]$update = $false, 236 | [switch]$uninstall = $false 237 | ) 238 | $GetParams = @{} 239 | if ($source) { 240 | $GetParams.Add("source", $source) 241 | } 242 | 243 | if ($update -and $uninstall) { 244 | 245 | return $null 246 | } 247 | 248 | $Session, $runspace = Open-Spinner -label "Loading Packages List" -type "Dots" 249 | 250 | $packages = Get-WinGetPackage | Where-Object { $_.Source -eq $source } 251 | 252 | Close-Spinner -session $Session -runspace $runspace 253 | if ($interactive) { 254 | [column[]]$cols = @() 255 | $cols += [column]::new("Name", "Name", 40) 256 | $cols += [column]::new("Id", "Id", 40) 257 | $cols += [column]::new("InstalledVersion", "Version", 20) 258 | [package[]]$InstalledPackages = @() 259 | $packages | ForEach-Object { 260 | $InstalledPackages += [package]::new($_.Name, $_.Id, $_.AvailableVersions[0]) 261 | } 262 | $choices = makeLines -columns $cols -items $InstalledPackages 263 | $width = $Host.UI.RawUI.BufferSize.Width - 2 264 | $height = $Host.UI.RawUI.BufferSize.Height - 7 265 | $title = makeTitle -title "List of Installed Packages" -width $width 266 | $header = makeHeader -columns $cols 267 | gum style --border "rounded" --width $width "$title`n$header" --border-foreground $($Theme["purple"]) 268 | $c = $choices | gum filter --no-limit --height $height --indicator "👉 " --placeholder "Search in the list" --prompt.foreground $($Theme["yellow"]) --prompt "🔎 " 269 | $packages = @() 270 | if ($c) { 271 | $c | ForEach-Object { 272 | $index = ($choices -split '\n').IndexOf($_) 273 | $packages += $InstalledPackages[$index] 274 | } 275 | } 276 | # Clear-Host 277 | } 278 | return $packages 279 | } 280 | 281 | function Update-WGPackage { 282 | param( 283 | [string]$source = $null, 284 | [switch]$interactive = $false 285 | ) 286 | $GetParams = @{} 287 | if ($source) { 288 | $GetParams.Add("source", $source) 289 | } 290 | 291 | $Session, $runspace = Open-Spinner -label "Loading Packages List" -type "Dots" 292 | 293 | $packages = Get-WinGetPackage | Where-Object { $_.IsUpdateAvailable } 294 | 295 | Close-Spinner -session $Session -runspace $runspace 296 | if ($interactive) { 297 | [column[]]$cols = @() 298 | $cols += [column]::new("Name", "Name", 35) 299 | $cols += [column]::new("Id", "Id", 35) 300 | $cols += [column]::new("InstalledVersion", "Version", 15) 301 | $cols += [column]::new("Available", "Available", 15) 302 | [package[]]$InstalledPackages = @() 303 | $packages | ForEach-Object { 304 | $InstalledPackages += [package]::new($_.Name, $_.Id, $_.InstalledVersion, $_.AvailableVersions[0]) 305 | } 306 | $choices = makeLines -columns $cols -items $InstalledPackages 307 | $height = $Host.UI.RawUI.BufferSize.Height - 6 308 | $width = $Host.UI.RawUI.BufferSize.Width - 2 309 | $title = makeTitle -title "Choose a package to update" -width $width 310 | $header = makeHeader -columns $cols 311 | gum style --border "rounded" --width $width "$title`n$header" --border-foreground $($Theme["purple"]) 312 | $c = $choices | gum choose --selected-prefix "✔️" --no-limit --cursor "👉 " --height $height 313 | $packages = @() 314 | if ($c) { 315 | $c | ForEach-Object { 316 | $index = ($choices -split '\n').IndexOf($_) 317 | $packages += $InstalledPackages[$index] 318 | } 319 | } 320 | # Clear-Host 321 | } 322 | return $packages 323 | } 324 | 325 | function Find-WGPackage { 326 | param( 327 | [string]$query = $null, 328 | [string]$source = $null, 329 | [switch]$interactive = $false 330 | ) 331 | 332 | $SearchParams = @{} 333 | $Y = $host.ui.rawui.CursorPosition.Y 334 | $buffer = gum style "Enter search query" --border "rounded" --width ($Host.UI.RawUI.BufferSize.Width - 2) 335 | $buffer | ForEach-Object { 336 | [System.Console]::write($_) 337 | } 338 | 339 | if (-not $query) { 340 | $query = gum input --placeholder "Search for a package" 341 | $SearchParams.Add("query", $query) 342 | } 343 | 344 | if ($source) { 345 | $SearchParams.Add("source", $source) 346 | } 347 | else { 348 | $source = gum style "every sources" --foreground "#FF0000" 349 | } 350 | if ($query) { 351 | $title = gum style $query --foreground "#00FF00" --bold 352 | $Session, $runspace = Open-Spinner -label "Searching for $title in $source" -type "Dots" 353 | $queries = $query.Split(",") 354 | $packages = @() 355 | $queries | ForEach-Object { 356 | $SearchParams["query"] = [string]$_.Trim() 357 | $packs = Find-WinGetPackage @SearchParams 358 | $packs | ForEach-Object { 359 | $packages += $_ 360 | } 361 | } 362 | [System.Console]::setcursorposition(0, $Y) 363 | } 364 | else { 365 | [System.Console]::setcursorposition(0, $Y) 366 | $buffer = gum style "No query specified" --border "rounded" --width ($Host.UI.RawUI.BufferSize.Width - 2) --foreground "#FF0000" 367 | $buffer | ForEach-Object { 368 | [System.Console]::write($_) 369 | } 370 | return $null 371 | } 372 | if ($packages -and $interactive) { 373 | # Clear-Host 374 | [column[]]$cols = @() 375 | $cols += [column]::new("Name", "Name", 40) 376 | $cols += [column]::new("Id", "Id", 40) 377 | $cols += [column]::new("InstalledVersion", "Version", 20) 378 | [package[]]$InstalledPackages = @() 379 | $packages | ForEach-Object { 380 | $InstalledPackages += [package]::new($_.Name, $_.Id, $_.Version) 381 | } 382 | $choices = makeLines -columns $cols -items $InstalledPackages 383 | Close-Spinner -session $Session -runspace $runspace 384 | $width = $Host.UI.RawUI.BufferSize.Width - 2 385 | $height = $Host.UI.RawUI.BufferSize.Height - 6 386 | [System.Console]::setcursorposition(0, $Y) 387 | $title = makeTitle -title "Choose Packages to Install" -width $width 388 | $header = makeHeader -columns $cols 389 | gum style --border "rounded" --width $width "$title`n$header" --border-foreground $($Theme["purple"]) 390 | # $c = $choices | gum choose --selected-prefix "✔️" --no-limit --cursor "👉 " --height $height 391 | $c = $choices | gum filter --no-limit --height $height --indicator "👉 " --placeholder "Search in the list" --prompt.foreground $($Theme["yellow"]) --prompt "🔎 " 392 | $packages = @() 393 | if ($c) { 394 | $c | ForEach-Object { 395 | $index = ($choices -split '\n').IndexOf($_) 396 | $packages += $InstalledPackages[$index] 397 | } 398 | } 399 | Clear-Host 400 | } 401 | else { 402 | Close-Spinner -session $Session -runspace $runspace 403 | } 404 | return $packages 405 | } 406 | 407 | function isGumInstalled { 408 | $gum = Get-Command -CommandType Application -Name gum -ErrorAction SilentlyContinue 409 | if ($gum) { 410 | return $true 411 | } 412 | return $false 413 | } 414 | 415 | function installGum { 416 | $command = "winget install --id charmbracelet.gum" 417 | Invoke-Expression $command | Out-Null 418 | $env:path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") 419 | } -------------------------------------------------------------------------------- /WGGui/ProjectGroup1.groupproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | {56698A23-87DA-4791-A09B-31F26695301F} 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Default.Personality.12 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /WGGui/ProjectGroup1.groupproj.local: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /WGGui/WGGui.dpr: -------------------------------------------------------------------------------- 1 | program WGGui; 2 | 3 | uses 4 | Vcl.Forms, 5 | uOldMain in 'uOldMain.pas' {fOldMain}, 6 | uConsts in 'uConsts.pas', 7 | uMain in 'uMain.pas' {fMain}, 8 | uBaseFrame in 'uBaseFrame.pas' {BaseFrame: TFrame}, 9 | uFrmList in 'uFrmList.pas' {FrmList: TFrame}, 10 | uFrmSearch in 'uFrmSearch.pas' {frmSearch: TFrame}, 11 | uFrmConfig in 'uFrmConfig.pas' {frmConfig: TFrame}, 12 | Vcl.Themes, 13 | Vcl.Styles, 14 | uDM in 'uDM.pas' {DM: TDataModule}, 15 | usearchPackage in 'usearchPackage.pas' {fSearchPackage}, 16 | uFrmSplash in 'uFrmSplash.pas' {FrmSplash: TFrame}; 17 | 18 | {$R *.res} 19 | 20 | begin 21 | Application.Initialize; 22 | 23 | Application.MainFormOnTaskbar := True; 24 | Application.ShowMainForm := true; 25 | TStyleManager.TrySetStyle('Windows11 MineShaft'); 26 | Application.CreateForm(TfMain, fMain); 27 | Application.CreateForm(TDM, DM); 28 | Application.CreateForm(TfSearchPackage, fSearchPackage); 29 | fMain.Onshow := Nil; 30 | 31 | 32 | Application.Run; 33 | 34 | end. 35 | -------------------------------------------------------------------------------- /WGGui/WGGui.dproj.local: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 1899-12-30 00:00:00.000.486,C:\Users\yvesg\git\WingetPosh\WGGui\Unit1.dfm=C:\Users\yvesg\git\WingetPosh\WGGui\uFrmList.dfm 5 | 1899-12-30 00:00:00.000.651,C:\Users\yvesg\git\WingetPosh\WGGui\Unit1.dfm=C:\Users\yvesg\git\WingetPosh\WGGui\uFrmConfig.dfm 6 | 1899-12-30 00:00:00.000.493,C:\Users\yvesg\git\WingetPosh\WGGui\Unit1.dfm=C:\Users\yvesg\git\WingetPosh\WGGui\uBaseFrame.dfm 7 | 1899-12-30 00:00:00.000.002,C:\Users\yvesg\git\WingetPosh\WGGui\Unit1.dfm=C:\Users\yvesg\git\WingetPosh\WGGui\usearchPackage.dfm 8 | 1899-12-30 00:00:00.000.200,C:\Users\yvesg\git\WGGui\WGGui.pas=C:\Users\yvesg\Documents\Embarcadero\Studio\Projects\Unit1.pas 9 | 1899-12-30 00:00:00.000.612,=C:\Users\yvesg\Documents\Embarcadero\Studio\Projects\Unit1.pas 10 | 1899-12-30 00:00:00.000.142,=C:\Users\yvesg\Documents\Embarcadero\Studio\Projects\Unit1.pas 11 | 1899-12-30 00:00:00.000.160,C:\Users\yvesg\git\WingetPosh\WGGui\uOldMain.pas=C:\Users\yvesg\git\WingetPosh\WGGui\uMain.pas 12 | 1899-12-30 00:00:00.000.913,C:\Users\yvesg\git\WingetPosh\WGGui\WGGui.dproj=C:\Users\yvesg\git\WGGui\WGGui.dproj 13 | 1899-12-30 00:00:00.000.714,C:\Users\yvesg\git\WingetPosh\WGGui\Unit1.dfm=C:\Users\yvesg\git\WingetPosh\WGGui\uFrmSearch.dfm 14 | 1899-12-30 00:00:00.000.160,C:\Users\yvesg\git\WingetPosh\WGGui\uOldMain.dfm=C:\Users\yvesg\git\WingetPosh\WGGui\uMain.dfm 15 | 1899-12-30 00:00:00.000.638,C:\Users\yvesg\git\WingetPosh\WGGui\uMain.pas=C:\Users\yvesg\git\WingetPosh\WGGui\Unit1.pas 16 | 1899-12-30 00:00:00.000.055,C:\Users\yvesg\git\WingetPosh\WGGui\uMain.pas=C:\Users\yvesg\git\WGGui\uMain.pas 17 | 1899-12-30 00:00:00.000.200,C:\Users\yvesg\git\WGGui\WGGui.dfm=C:\Users\yvesg\Documents\Embarcadero\Studio\Projects\Unit1.dfm 18 | 1899-12-30 00:00:00.000.156,C:\Users\yvesg\git\WGGui\uMain.pas=C:\Users\yvesg\git\WGGui\uMais.pas 19 | 1899-12-30 00:00:00.000.156,C:\Users\yvesg\git\WGGui\uMain.dfm=C:\Users\yvesg\git\WGGui\uMais.dfm 20 | 1899-12-30 00:00:00.000.923,D:\git\WingetPosh\WGGui\Unit1.dfm=D:\git\WingetPosh\WGGui\uFrmSplash.dfm 21 | 1899-12-30 00:00:00.000.055,C:\Users\yvesg\git\WingetPosh\WGGui\uMain.dfm=C:\Users\yvesg\git\WGGui\uMain.dfm 22 | 1899-12-30 00:00:00.000.638,C:\Users\yvesg\git\WingetPosh\WGGui\uMain.dfm=C:\Users\yvesg\git\WingetPosh\WGGui\Unit1.dfm 23 | 1899-12-30 00:00:00.000.729,=C:\Users\yvesg\git\WingetPosh\WGGui\Unit1.pas 24 | 1899-12-30 00:00:00.000.905,=C:\Users\yvesg\git\WingetPosh\WGGui\Unit1.pas 25 | 1899-12-30 00:00:00.000.708,=C:\Users\yvesg\git\WingetPosh\WGGui\Unit1.pas 26 | 1899-12-30 00:00:00.000.918,=C:\Users\yvesg\git\WingetPosh\WGGui\Unit1.pas 27 | 1899-12-30 00:00:00.000.103,C:\Users\yvesg\git\WGGui\uMais.dfm=C:\Users\yvesg\git\WGGui\WGGui.dfm 28 | 1899-12-30 00:00:00.000.165,C:\Users\yvesg\git\WingetPosh\WGGui\uConsts.pas=C:\Users\yvesg\git\WingetPosh\WGGui\Unit1.pas 29 | 1899-12-30 00:00:00.000.191,C:\Users\yvesg\git\WGGui\WGGui.dproj=C:\Users\yvesg\Documents\Embarcadero\Studio\Projects\Project2.dproj 30 | 1899-12-30 00:00:00.000.923,D:\git\WingetPosh\WGGui\Unit1.pas=D:\git\WingetPosh\WGGui\uFrmSplash.pas 31 | 1899-12-30 00:00:00.000.728,=D:\git\WingetPosh\WGGui\Unit1.pas 32 | 1899-12-30 00:00:00.000.317,=C:\Users\yvesg\git\WingetPosh\WGGui\Unit1.pas 33 | 1899-12-30 00:00:00.000.518,=C:\Users\yvesg\git\WingetPosh\WGGui\Unit1.pas 34 | 1899-12-30 00:00:00.000.486,C:\Users\yvesg\git\WingetPosh\WGGui\Unit1.pas=C:\Users\yvesg\git\WingetPosh\WGGui\uFrmList.pas 35 | 1899-12-30 00:00:00.000.691,=C:\Users\yvesg\git\WingetPosh\WGGui\uDM.pas 36 | 1899-12-30 00:00:00.000.103,C:\Users\yvesg\git\WGGui\uMais.pas=C:\Users\yvesg\git\WGGui\WGGui.pas 37 | 1899-12-30 00:00:00.000.398,=C:\Users\yvesg\git\WingetPosh\WGGui\Unit1.pas 38 | 1899-12-30 00:00:00.000.714,C:\Users\yvesg\git\WingetPosh\WGGui\Unit1.pas=C:\Users\yvesg\git\WingetPosh\WGGui\uFrmSearch.pas 39 | 1899-12-30 00:00:00.000.493,C:\Users\yvesg\git\WingetPosh\WGGui\Unit1.pas=C:\Users\yvesg\git\WingetPosh\WGGui\uBaseFrame.pas 40 | 1899-12-30 00:00:00.000.651,C:\Users\yvesg\git\WingetPosh\WGGui\Unit1.pas=C:\Users\yvesg\git\WingetPosh\WGGui\uFrmConfig.pas 41 | 1899-12-30 00:00:00.000.002,C:\Users\yvesg\git\WingetPosh\WGGui\Unit1.pas=C:\Users\yvesg\git\WingetPosh\WGGui\usearchPackage.pas 42 | 43 | 44 | -------------------------------------------------------------------------------- /WGGui/WGGui.identcache: -------------------------------------------------------------------------------- 1 | #D:\git\WingetPosh\WGGui\uConsts.pasD:\git\WingetPosh\WGGui\uDM.pas&D:\git\WingetPosh\WGGui\uFrmSplash.pas$D:\git\WingetPosh\WGGui\uFrmList.pas*D:\git\WingetPosh\WGGui\usearchPackage.pas$D:\git\WingetPosh\WGGui\uOldMain.pas&D:\git\WingetPosh\WGGui\uFrmConfig.pas!D:\git\WingetPosh\WGGui\WGGui.dpr&D:\git\WingetPosh\WGGui\uFrmSearch.pas!D:\git\WingetPosh\WGGui\uMain.pas&D:\git\WingetPosh\WGGui\uBaseFrame.pas -------------------------------------------------------------------------------- /WGGui/WGGui.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/WGGui/WGGui.res -------------------------------------------------------------------------------- /WGGui/WGGui_Icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/WGGui/WGGui_Icon.ico -------------------------------------------------------------------------------- /WGGui/WGGui_Icon1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/WGGui/WGGui_Icon1.ico -------------------------------------------------------------------------------- /WGGui/WGGui_Icon2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/WGGui/WGGui_Icon2.ico -------------------------------------------------------------------------------- /WGGui/WingetGUI.groupproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | {D6AB65B5-9293-4595-BBFA-A0963FA6D68B} 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Default.Personality.12 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /WGGui/WingetGUI.groupproj.local: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /WGGui/WingetGUI_prjgroup.tvsconfig: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /WGGui/WingetPoshGui.dpr: -------------------------------------------------------------------------------- 1 | program WingetPoshGui; 2 | 3 | uses 4 | Vcl.Forms, 5 | uConsts in 'uConsts.pas', 6 | uMain in 'uMain.pas' {fMain}, 7 | uBaseFrame in 'uBaseFrame.pas' {BaseFrame: TFrame}, 8 | uFrmList in 'uFrmList.pas' {FrmList: TFrame}, 9 | uFrmSearch in 'uFrmSearch.pas' {frmSearch: TFrame}, 10 | uFrmConfig in 'uFrmConfig.pas' {frmConfig: TFrame}, 11 | Vcl.Themes, 12 | Vcl.Styles, 13 | uDM in 'uDM.pas' {DM: TDataModule}, 14 | usearchPackage in 'usearchPackage.pas' {fSearchPackage}, 15 | uFrmSplash in 'uFrmSplash.pas' {FrmSplash: TFrame}; 16 | 17 | {$R *.res} 18 | 19 | begin 20 | Application.Initialize; 21 | 22 | Application.MainFormOnTaskbar := True; 23 | Application.ShowMainForm := False; 24 | TStyleManager.TrySetStyle('Glow'); 25 | Application.CreateForm(TfMain, fMain); 26 | Application.CreateForm(TDM, DM); 27 | fMain.Onshow := Nil; 28 | 29 | 30 | Application.Run; 31 | 32 | end. 33 | -------------------------------------------------------------------------------- /WGGui/WingetPoshGui.dproj.local: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 1899-12-30 00:00:00.000.703,D:\git\WingetPosh\WGGui\uOldMain.pas= 5 | 6 | 7 | -------------------------------------------------------------------------------- /WGGui/WingetPoshGui.identcache: -------------------------------------------------------------------------------- 1 | 2 | 2C:\Users\yvesg\git\WingetPosh\WGGui\uFrmConfig.pas5C:\Users\yvesg\git\WingetPosh\WGGui\WingetPoshGui.dpr2C:\Users\yvesg\git\WingetPosh\WGGui\uFrmSplash.pas6C:\Users\yvesg\git\WingetPosh\WGGui\usearchPackage.pas-C:\Users\yvesg\git\WingetPosh\WGGui\uMain.pas2C:\Users\yvesg\git\WingetPosh\WGGui\uFrmSearch.pas/C:\Users\yvesg\git\WingetPosh\WGGui\uConsts.pas2C:\Users\yvesg\git\WingetPosh\WGGui\uBaseFrame.pas0C:\Users\yvesg\git\WingetPosh\WGGui\uFrmList.pas+C:\Users\yvesg\git\WingetPosh\WGGui\uDM.pas -------------------------------------------------------------------------------- /WGGui/WingetPoshGui.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/WGGui/WingetPoshGui.res -------------------------------------------------------------------------------- /WGGui/images/bouton-carre-croix.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/WGGui/images/bouton-carre-croix.png -------------------------------------------------------------------------------- /WGGui/images/icons8-delete-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/WGGui/images/icons8-delete-24.png -------------------------------------------------------------------------------- /WGGui/images/icons8-update-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/WGGui/images/icons8-update-64.png -------------------------------------------------------------------------------- /WGGui/images/marque-de-croix (1).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/WGGui/images/marque-de-croix (1).png -------------------------------------------------------------------------------- /WGGui/images/marque-de-croix (2).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/WGGui/images/marque-de-croix (2).png -------------------------------------------------------------------------------- /WGGui/images/marque-de-croix.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/WGGui/images/marque-de-croix.png -------------------------------------------------------------------------------- /WGGui/uBaseFrame.dfm: -------------------------------------------------------------------------------- 1 | object BaseFrame: TBaseFrame 2 | Left = 0 3 | Top = 0 4 | Width = 640 5 | Height = 480 6 | TabOrder = 0 7 | object framePnl: TFlowPanel 8 | Left = 0 9 | Top = 0 10 | Width = 640 11 | Height = 33 12 | Align = alTop 13 | Caption = 'Base Frame' 14 | FlowStyle = fsBottomTopLeftRight 15 | Font.Charset = ANSI_CHARSET 16 | Font.Color = clWindowText 17 | Font.Height = -19 18 | Font.Name = 'MesloLGL Nerd Font' 19 | Font.Style = [fsBold, fsItalic] 20 | ParentFont = False 21 | TabOrder = 0 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /WGGui/uBaseFrame.pas: -------------------------------------------------------------------------------- 1 | unit uBaseFrame; 2 | 3 | interface 4 | 5 | uses 6 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, 7 | Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls; 8 | 9 | type 10 | tActivitySet = procedure (bActive: Boolean) of Object; 11 | TBaseFrame = class(TFrame) 12 | framePnl: TFlowPanel; 13 | private 14 | { Private declarations } 15 | public 16 | { Public declarations } 17 | ActivitySet : tActivitySet; 18 | end; 19 | 20 | implementation 21 | 22 | {$R *.dfm} 23 | 24 | end. 25 | -------------------------------------------------------------------------------- /WGGui/uConsts.pas: -------------------------------------------------------------------------------- 1 | unit uConsts; 2 | 3 | interface 4 | uses 5 | System.Classes, 6 | System.SysUtils; 7 | 8 | const 9 | sList = 'pwsh -noprofile -command "Get-WGList -quiet $true | Where-Object {$_.source -ceq \"winget\"} | Out-JSON'; 10 | //sList = 'pwsh -noprofile -command "Get-WGList -quiet $true | Out-JSON'; 11 | sUpdate = 'pwsh -noprofile -command "Get-WGList -quiet $true | Where-Object {$_.source -ceq \"winget\" -and $_.available -ne \"\" } | Out-JSON'; 12 | sSearchCmd = 'pwsh -noprofile -command "Search-WGPackage -quiet $true -package \"%s\" | Where-Object {$_.source -ceq \"winget\"} | Out-JSON '; 13 | 14 | implementation 15 | 16 | 17 | 18 | end. 19 | -------------------------------------------------------------------------------- /WGGui/uDM.dfm: -------------------------------------------------------------------------------- 1 | object DM: TDM 2 | Height = 480 3 | Width = 640 4 | end 5 | -------------------------------------------------------------------------------- /WGGui/uDM.pas: -------------------------------------------------------------------------------- 1 | unit uDM; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils, System.Classes; 7 | 8 | type 9 | tCharDecoding = Function(ASender: TObject; ABuf: TStream): String of object; 10 | 11 | TDM = class(TDataModule) 12 | private 13 | { Private declarations } 14 | public 15 | { Public declarations } 16 | function CharDecoding(ASender: TObject; ABuf: TStream): String; 17 | end; 18 | 19 | var 20 | DM: TDM; 21 | 22 | implementation 23 | 24 | function TDM.CharDecoding(ASender: TObject; ABuf: TStream): String; 25 | var 26 | pBytes: TBytes; 27 | iLength: Integer; 28 | begin 29 | iLength := ABuf.Size; 30 | if iLength > 0 then 31 | begin 32 | SetLength(pBytes, iLength); 33 | ABuf.Read(pBytes, iLength); 34 | try 35 | result := tEncoding.UTF8.GetString(pBytes); 36 | except 37 | result := ''; 38 | end; 39 | end 40 | else 41 | result := ''; 42 | end; 43 | 44 | {%CLASSGROUP 'Vcl.Controls.TControl'} 45 | {$R *.dfm} 46 | 47 | end. 48 | -------------------------------------------------------------------------------- /WGGui/uFrmConfig.dfm: -------------------------------------------------------------------------------- 1 | inherited frmConfig: TfrmConfig 2 | Width = 1023 3 | Height = 570 4 | ExplicitWidth = 1023 5 | ExplicitHeight = 570 6 | object sPanel1: TsPanel [0] 7 | Left = 0 8 | Top = 33 9 | Width = 1023 10 | Height = 537 11 | Align = alClient 12 | Caption = 'sPanel1' 13 | ShowCaption = False 14 | TabOrder = 0 15 | ExplicitTop = 0 16 | ExplicitHeight = 570 17 | end 18 | inherited framePnl: TFlowPanel 19 | Width = 1023 20 | Caption = 'Module Configuration' 21 | TabOrder = 1 22 | ExplicitWidth = 1023 23 | end 24 | object sFrameAdapter1: TsFrameAdapter 25 | Left = 1192 26 | Top = 472 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /WGGui/uFrmConfig.pas: -------------------------------------------------------------------------------- 1 | unit uFrmConfig; 2 | 3 | interface 4 | 5 | uses 6 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 7 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, uBaseFrame, Vcl.ExtCtrls, sPanel, sFrameAdapter; 8 | 9 | type 10 | TfrmConfig = class(TBaseFrame) 11 | sFrameAdapter1: TsFrameAdapter; 12 | sPanel1: TsPanel; 13 | private 14 | { Private declarations } 15 | public 16 | { Public declarations } 17 | end; 18 | 19 | var 20 | frmConfig: TfrmConfig; 21 | 22 | implementation 23 | 24 | {$R *.dfm} 25 | 26 | end. 27 | -------------------------------------------------------------------------------- /WGGui/uFrmList.dfm: -------------------------------------------------------------------------------- 1 | inherited FrmList: TFrmList 2 | Width = 1048 3 | Height = 672 4 | OnResize = FrameResize 5 | ExplicitWidth = 1048 6 | ExplicitHeight = 672 7 | object sPanel1: TsPanel [0] 8 | Left = 185 9 | Top = 64 10 | Width = 863 11 | Height = 608 12 | Align = alClient 13 | Caption = 'sPanel1' 14 | ShowCaption = False 15 | TabOrder = 0 16 | object sButton1: TsButton 17 | Left = 24 18 | Top = 368 19 | Width = 75 20 | Height = 25 21 | Caption = 'sButton1' 22 | TabOrder = 0 23 | Visible = False 24 | OnClick = sButton1Click 25 | end 26 | object sg1: TAdvStringGrid 27 | Left = 1 28 | Top = 1 29 | Width = 861 30 | Height = 606 31 | Align = alClient 32 | ColCount = 6 33 | DrawingStyle = gdsClassic 34 | FixedColor = clWhite 35 | FixedCols = 0 36 | RowCount = 2 37 | Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goEditing, goRowSelect, goFixedRowDefAlign] 38 | TabOrder = 1 39 | OnGetCellColor = sg1GetCellColor 40 | OnCheckBoxChange = sg1CheckBoxChange 41 | ActiveCellFont.Charset = DEFAULT_CHARSET 42 | ActiveCellFont.Color = 4474440 43 | ActiveCellFont.Height = -12 44 | ActiveCellFont.Name = 'Segoe UI' 45 | ActiveCellFont.Style = [fsBold] 46 | ActiveCellColor = 11565130 47 | ActiveCellColorTo = 11565130 48 | BorderColor = 11250603 49 | ColumnHeaders.Strings = ( 50 | '' 51 | 'Name' 52 | 'Id' 53 | 'Version' 54 | 'Available' 55 | 'Source') 56 | ControlLook.FixedGradientFrom = clWhite 57 | ControlLook.FixedGradientTo = clWhite 58 | ControlLook.FixedGradientHoverFrom = clGray 59 | ControlLook.FixedGradientHoverTo = clWhite 60 | ControlLook.FixedGradientHoverMirrorFrom = clWhite 61 | ControlLook.FixedGradientHoverMirrorTo = clWhite 62 | ControlLook.FixedGradientHoverBorder = 11645361 63 | ControlLook.FixedGradientDownFrom = clWhite 64 | ControlLook.FixedGradientDownTo = clWhite 65 | ControlLook.FixedGradientDownMirrorFrom = clWhite 66 | ControlLook.FixedGradientDownMirrorTo = clWhite 67 | ControlLook.FixedGradientDownBorder = 11250603 68 | ControlLook.DropDownHeader.Font.Charset = DEFAULT_CHARSET 69 | ControlLook.DropDownHeader.Font.Color = clWindowText 70 | ControlLook.DropDownHeader.Font.Height = -11 71 | ControlLook.DropDownHeader.Font.Name = 'Segoe UI' 72 | ControlLook.DropDownHeader.Font.Style = [] 73 | ControlLook.DropDownHeader.Visible = True 74 | ControlLook.DropDownHeader.Buttons = <> 75 | ControlLook.DropDownFooter.Font.Charset = DEFAULT_CHARSET 76 | ControlLook.DropDownFooter.Font.Color = clWindowText 77 | ControlLook.DropDownFooter.Font.Height = -11 78 | ControlLook.DropDownFooter.Font.Name = 'Segoe UI' 79 | ControlLook.DropDownFooter.Font.Style = [] 80 | ControlLook.DropDownFooter.Visible = True 81 | ControlLook.DropDownFooter.Buttons = <> 82 | Filter = < 83 | item 84 | Column = 4 85 | Condition = '! '#39'N/A'#39 86 | CaseSensitive = False 87 | Operation = foSHORT 88 | Method = fmExpression 89 | end> 90 | FilterDropDown.Font.Charset = DEFAULT_CHARSET 91 | FilterDropDown.Font.Color = clWindowText 92 | FilterDropDown.Font.Height = -12 93 | FilterDropDown.Font.Name = 'Segoe UI' 94 | FilterDropDown.Font.Style = [] 95 | FilterDropDown.TextChecked = 'Checked' 96 | FilterDropDown.TextUnChecked = 'Unchecked' 97 | FilterDropDownClear = '(All)' 98 | FilterEdit.TypeNames.Strings = ( 99 | 'Starts with' 100 | 'Ends with' 101 | 'Contains' 102 | 'Not contains' 103 | 'Equal' 104 | 'Not equal' 105 | 'Larger than' 106 | 'Smaller than' 107 | 'Clear') 108 | FixedRowHeight = 22 109 | FixedFont.Charset = DEFAULT_CHARSET 110 | FixedFont.Color = clWindowText 111 | FixedFont.Height = -11 112 | FixedFont.Name = 'Segoe UI' 113 | FixedFont.Style = [fsBold] 114 | FloatFormat = '%.2f' 115 | HoverButtons.Buttons = <> 116 | HTMLSettings.ImageFolder = 'images' 117 | HTMLSettings.ImageBaseName = 'img' 118 | Look = glCustom 119 | PrintSettings.DateFormat = 'dd/mm/yyyy' 120 | PrintSettings.Font.Charset = DEFAULT_CHARSET 121 | PrintSettings.Font.Color = clWindowText 122 | PrintSettings.Font.Height = -12 123 | PrintSettings.Font.Name = 'Segoe UI' 124 | PrintSettings.Font.Style = [] 125 | PrintSettings.FixedFont.Charset = DEFAULT_CHARSET 126 | PrintSettings.FixedFont.Color = clWindowText 127 | PrintSettings.FixedFont.Height = -12 128 | PrintSettings.FixedFont.Name = 'Segoe UI' 129 | PrintSettings.FixedFont.Style = [] 130 | PrintSettings.HeaderFont.Charset = DEFAULT_CHARSET 131 | PrintSettings.HeaderFont.Color = clWindowText 132 | PrintSettings.HeaderFont.Height = -12 133 | PrintSettings.HeaderFont.Name = 'Segoe UI' 134 | PrintSettings.HeaderFont.Style = [] 135 | PrintSettings.FooterFont.Charset = DEFAULT_CHARSET 136 | PrintSettings.FooterFont.Color = clWindowText 137 | PrintSettings.FooterFont.Height = -12 138 | PrintSettings.FooterFont.Name = 'Segoe UI' 139 | PrintSettings.FooterFont.Style = [] 140 | PrintSettings.PageNumSep = '/' 141 | SearchFooter.ColorTo = clNone 142 | SearchFooter.FindNextCaption = 'Find &next' 143 | SearchFooter.FindPrevCaption = 'Find &previous' 144 | SearchFooter.Font.Charset = DEFAULT_CHARSET 145 | SearchFooter.Font.Color = clWindowText 146 | SearchFooter.Font.Height = -12 147 | SearchFooter.Font.Name = 'Segoe UI' 148 | SearchFooter.Font.Style = [] 149 | SearchFooter.HighLightCaption = 'Highlight' 150 | SearchFooter.HintClose = 'Close' 151 | SearchFooter.HintFindNext = 'Find next occurrence' 152 | SearchFooter.HintFindPrev = 'Find previous occurrence' 153 | SearchFooter.HintHighlight = 'Highlight occurrences' 154 | SearchFooter.MatchCaseCaption = 'Match case' 155 | SearchFooter.ResultFormat = '(%d of %d)' 156 | SelectionColor = 13744549 157 | SelectionTextColor = clWindowText 158 | ShowDesignHelper = False 159 | SortSettings.HeaderColor = clWhite 160 | SortSettings.HeaderColorTo = clWhite 161 | SortSettings.HeaderMirrorColor = clWhite 162 | SortSettings.HeaderMirrorColorTo = clWhite 163 | Version = '8.6.14.2' 164 | RowHeights = ( 165 | 22 166 | 22) 167 | end 168 | end 169 | inherited framePnl: TFlowPanel 170 | Width = 1048 171 | Caption = 'Installed Packages' 172 | TabOrder = 1 173 | ExplicitWidth = 1048 174 | end 175 | object Panel1: TPanel 176 | Left = 0 177 | Top = 64 178 | Width = 185 179 | Height = 608 180 | Align = alLeft 181 | Caption = 'Panel1' 182 | ShowCaption = False 183 | TabOrder = 2 184 | object btnUpdate: TButton 185 | Left = 1 186 | Top = 1 187 | Width = 183 188 | Height = 64 189 | Align = alTop 190 | Caption = 'Update Cheked Packages' 191 | TabOrder = 0 192 | Visible = False 193 | end 194 | end 195 | object Panel2: TPanel 196 | Left = 0 197 | Top = 33 198 | Width = 1048 199 | Height = 31 200 | Align = alTop 201 | BevelOuter = bvNone 202 | Caption = 'Panel2' 203 | ShowCaption = False 204 | TabOrder = 3 205 | object ckUpdates: TCheckBox 206 | Left = 8 207 | Top = 6 208 | Width = 137 209 | Height = 17 210 | Caption = 'Show Only Updates' 211 | TabOrder = 0 212 | OnClick = ckUpdatesClick 213 | end 214 | end 215 | object DosCommand1: TDosCommand 216 | InputToOutput = False 217 | MaxTimeAfterBeginning = 0 218 | MaxTimeAfterLastOutput = 10 219 | Left = 904 220 | Top = 72 221 | end 222 | end 223 | -------------------------------------------------------------------------------- /WGGui/uFrmList.pas: -------------------------------------------------------------------------------- 1 | unit uFrmList; 2 | 3 | interface 4 | 5 | uses 6 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, 7 | System.Classes, Vcl.Graphics, System.JSON, System.JSON.Readers, 8 | System.JSON.Types, 9 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, uBaseFrame, sFrameAdapter, DosCommand, 10 | Vcl.StdCtrls, sLabel, Vcl.ExtCtrls, sPanel, SynEdit, uConsts, sButton, uDM, 11 | sMemo, 12 | Vcl.ComCtrls, sListView, AdvUtil, Vcl.Grids, AdvObj, BaseGrid, AdvGrid; 13 | 14 | type 15 | TFrmList = class(TBaseFrame) 16 | DosCommand1: TDosCommand; 17 | sPanel1: TsPanel; 18 | sButton1: TsButton; 19 | sg1: TAdvStringGrid; 20 | Panel1: TPanel; 21 | ckUpdates: TCheckBox; 22 | Panel2: TPanel; 23 | btnUpdate: TButton; 24 | procedure sButton1Click(Sender: TObject); 25 | procedure sg1GetCellColor(Sender: TObject; ARow, ACol: Integer; AState: TGridDrawState; ABrush: TBrush; AFont: TFont); 26 | procedure FrameResize(Sender: TObject); 27 | procedure ckUpdatesClick(Sender: TObject); 28 | procedure sg1CheckBoxChange(Sender: TObject; ACol, ARow: Integer; State: Boolean); 29 | private 30 | { Private declarations } 31 | ls: TStringList; 32 | Sr: TStringReader; 33 | Reader: TJsonTextReader; 34 | procedure terminated(Sender: TObject); 35 | function isAnUpdateChecked : Boolean; 36 | public 37 | { Public declarations } 38 | JSON : string; 39 | procedure init; 40 | end; 41 | 42 | var 43 | FrmList: TFrmList; 44 | 45 | implementation 46 | 47 | {$R *.dfm} 48 | { TFrmList } 49 | 50 | procedure TFrmList.ckUpdatesClick(Sender: TObject); 51 | begin 52 | inherited; 53 | sg1.FilterActive := ckUpdates.Checked; 54 | end; 55 | 56 | procedure TFrmList.FrameResize(Sender: TObject); 57 | begin 58 | inherited; 59 | sg1.AutoFitColumns(); 60 | end; 61 | 62 | procedure TFrmList.init; 63 | begin 64 | //Application.MainForm.Show; 65 | framePnl.Visible := false; 66 | terminated(nil); 67 | 68 | end; 69 | 70 | function TFrmList.isAnUpdateChecked: Boolean; 71 | var 72 | i : Integer; 73 | bchecked : boolean; 74 | b : boolean; 75 | begin 76 | i := 1; 77 | bchecked := false; 78 | while i < sg1.RowCount do 79 | begin 80 | if sg1.Cells[4,i] <> '' then 81 | sg1.GetCheckBoxState(0,i,b); 82 | bchecked := (bchecked or b); 83 | inc(i); 84 | end; 85 | result := bchecked; 86 | end; 87 | 88 | procedure TFrmList.sButton1Click(Sender: TObject); 89 | begin 90 | // SynEdit1.Lines.Assign(ls); 91 | // Sr := TStringReader.Create(ls.text); 92 | // Reader := TJsonTextReader.Create(Sr); 93 | // while Reader.read do 94 | // case Reader.TokenType of 95 | // TJsonToken.startobject: 96 | // Memo1.Lines.Add('(StartObject) ' + '- Token Path : ' + Reader.Path); 97 | // TJsonToken.StartArray: 98 | // Memo1.Lines.Add('(StartArray) ' + '- Token Path : ' + Reader.Path ); 99 | // TJsonToken.PropertyName: 100 | // Memo1.Lines.Add('PropertyName : ' + Reader.Value.ToString + '- Token Path : ' + Reader.Path ); 101 | // TJsonToken.String: 102 | // Memo1.Lines.Add('String Value : ' + Reader.Value.ToString + '- Token Path : ' + Reader.Path); 103 | // TJsonToken.Integer: 104 | // Memo1.Lines.Add('Integer Value : ' + Reader.Value.ToString + '- Token Path : ' + Reader.Path); 105 | // TJsonToken.Float: 106 | // Memo1.Lines.Add('Float Value : ' + Reader.Value.ToString + '- Token Path : ' + Reader.Path); 107 | // TJsonToken.Boolean: 108 | // Memo1.Lines.Add('Boolean Value : ' + Reader.Value.ToString + '- Token Path : ' + Reader.Path); 109 | // TJsonToken.Null: 110 | // Memo1.Lines.Add('Null Value : ' + Reader.Value.ToString + '- Token Path : ' + Reader.Path); 111 | // TJsonToken.EndArray: 112 | // Memo1.Lines.Add('(EndArray) ' + '- Token Path : ' + Reader.Path); 113 | // TJsonToken.EndObject: 114 | // Memo1.Lines.Add('(EndObject) ' + '- Token Path : ' + Reader.Path); 115 | // end; 116 | end; 117 | 118 | procedure TFrmList.sg1CheckBoxChange(Sender: TObject; ACol, ARow: Integer; State: Boolean); 119 | begin 120 | inherited; 121 | if sg1.Cells[4,aRow] <> '' then 122 | begin 123 | btnUpdate.Visible := isAnUpdateChecked; 124 | end; 125 | end; 126 | 127 | procedure TFrmList.sg1GetCellColor(Sender: TObject; ARow, ACol: Integer; AState: TGridDrawState; ABrush: TBrush; AFont: TFont); 128 | begin 129 | inherited; 130 | if arow > 0 then 131 | 132 | if aCol = 4 then 133 | begin 134 | if sg1.Cells[aCol,aRow] <> '' then begin 135 | aFont.Color := clRed; 136 | end; 137 | end; 138 | 139 | end; 140 | 141 | procedure TFrmList.terminated(Sender: TObject); 142 | var 143 | V: TJsonValue; 144 | O, E, P: TJsonObject; 145 | A: TJsonArray; 146 | s : String; 147 | aItem: TListItem; 148 | iRow : Integer; 149 | begin 150 | //listView1.Items.BeginUpdate; 151 | 152 | //listView1.Clear; 153 | V := TJSONObject.ParseJSONValue(JSON); 154 | // if not Assigned(V) then 155 | // Memo1.Lines.Assign(Doscommand1.OutputLines); 156 | try 157 | //Memo1.Clear; 158 | O := V as TJSONObject; 159 | A := O.GetValue('packages'); 160 | iRow := 1; 161 | sg1.ColWidths[0] := 25; 162 | sg1.AddCheckBoxColumn(0); 163 | sg1.AddCheckBox(0,0,false,false); 164 | sg1.MouseActions.CheckAllCheck := true; 165 | for var I := 0 to A.Count - 1 do 166 | begin 167 | E := A.Items[I] as TJsonObject; // Element 168 | // aItem := listView1.Items.Add; 169 | // aItem.Caption := E.GetValue('Name'); 170 | // aItem.SubItems.Add(E.GetValue('Id')); 171 | // aItem.SubItems.Add(E.GetValue('Version')); 172 | // try 173 | // aItem.SubItems.Add(E.GetValue('Available')); 174 | // except 175 | // aItem.SubItems.Add(''); 176 | // end; 177 | // aItem.SubItems.Add(E.GetValue('Source')); 178 | // s := 'Package : '; 179 | // E := A.Items[I] as TJsonObject; // Element 180 | // s := s + E.GetValue('Name'); 181 | // s := s + ' Id: ' + E.GetValue('Id') + ' ' + 'Version: ' + E.GetValue('Version')+' Available : '+E.GetValue('Available'); 182 | // memo1.Lines.Add(s); 183 | if (sg1.Cells[2,iRow] <> '') then 184 | begin 185 | sg1.AddRow; 186 | end; 187 | iRow := sg1.RowCount -1; 188 | sg1.AddCheckBox(0,iRow,false,false); 189 | sg1.Cells[1,iRow] := E.GetValue('Name'); 190 | sg1.Cells[2,iRow] := E.GetValue('Id'); 191 | sg1.Cells[3,iRow] := E.GetValue('Version'); 192 | try 193 | sg1.Cells[4,iRow] := E.GetValue('Available') 194 | except 195 | sg1.Cells[4,iRow] := ''; 196 | end; 197 | sg1.Cells[5,iRow] := E.GetValue('Source'); 198 | if (sg1.Cells[5,iRow].Trim() = '') then sg1.Cells[5,iRow]:= ' '; 199 | end; 200 | sg1.Filter.Clear; 201 | sg1.Filter.add(4,'! '); 202 | finally 203 | sg1.AutoFitColumns(); 204 | 205 | V.Free; 206 | end; 207 | ActivitySet(False); 208 | // listView1.Items.EndUpdate; 209 | end; 210 | 211 | end. 212 | -------------------------------------------------------------------------------- /WGGui/uFrmSearch.pas: -------------------------------------------------------------------------------- 1 | unit uFrmSearch; 2 | 3 | interface 4 | 5 | uses 6 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, system.JSON, uconsts, 7 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, uBaseFrame, Vcl.ExtCtrls, AdvUtil, Vcl.StdCtrls, Vcl.Grids, AdvObj, BaseGrid, AdvGrid, udm, 8 | DosCommand, Vcl.Buttons, System.ImageList, Vcl.ImgList; 9 | 10 | type 11 | TfrmSearch = class(TBaseFrame) 12 | sg1: TAdvStringGrid; 13 | Panel1: TPanel; 14 | Label1: TLabel; 15 | Edit1: TEdit; 16 | DosCommand1: TDosCommand; 17 | btnClose: TBitBtn; 18 | ImageList1: TImageList; 19 | private 20 | { Private declarations } 21 | public 22 | { Public declarations } 23 | sSearch: string; 24 | procedure init; 25 | procedure terminated(Sender: TObject); 26 | end; 27 | 28 | var 29 | frmSearch: TfrmSearch; 30 | 31 | implementation 32 | 33 | {$R *.dfm} 34 | 35 | { TfrmSearch } 36 | 37 | procedure TfrmSearch.init; 38 | begin 39 | Application.MainForm.Show; 40 | DosCommand1.CommandLine := format(sSearchCMD, [sSearch]); 41 | DosCommand1.OnCharDecoding := dm.CharDecoding; 42 | DosCommand1.CommandLine := format(sSearchCMD, [SSearch]); 43 | DosCommand1.OnTerminated := terminated; 44 | ActivitySet(true); 45 | DosCommand1.Execute; 46 | end; 47 | 48 | procedure TfrmSearch.terminated(Sender: TObject); 49 | var 50 | V: TJsonValue; 51 | O, E, P: TJsonObject; 52 | A: TJsonArray; 53 | s: string; 54 | //aItem: TListItem; 55 | iRow: Integer; 56 | begin 57 | //listView1.Items.BeginUpdate; 58 | 59 | //listView1.Clear; 60 | while (DosCommand1.IsRunning) do 61 | begin 62 | Application.ProcessMessages; 63 | end; 64 | V := TJSONObject.ParseJSONValue(Doscommand1.Lines.text); 65 | // if not Assigned(V) then 66 | // Memo1.Lines.Assign(Doscommand1.OutputLines); 67 | try 68 | //Memo1.Clear; 69 | O := V as TJSONObject; 70 | A := O.GetValue('packages'); 71 | iRow := 1; 72 | sg1.ColWidths[0] := 25; 73 | for var I := 0 to A.Count - 1 do 74 | begin 75 | E := A.Items[I] as TJsonObject; // Element 76 | // aItem := listView1.Items.Add; 77 | // aItem.Caption := E.GetValue('Name'); 78 | // aItem.SubItems.Add(E.GetValue('Id')); 79 | // aItem.SubItems.Add(E.GetValue('Version')); 80 | // aItem.SubItems.Add(E.GetValue('Available')); 81 | // aItem.SubItems.Add(E.GetValue('Source')); 82 | // s := 'Package : '; 83 | // E := A.Items[I] as TJsonObject; // Element 84 | // s := s + E.GetValue('Name'); 85 | // s := s + ' Id: ' + E.GetValue('Id') + ' ' + 'Version: ' + E.GetValue('Version')+' Available : '+E.GetValue('Available'); 86 | // memo1.Lines.Add(s); 87 | if (sg1.Cells[2, iRow] <> '') then 88 | begin 89 | sg1.AddRow; 90 | end; 91 | iRow := sg1.RowCount - 1; 92 | sg1.AddCheckBox(0, iRow, TCheckBoxState.cbChecked); 93 | sg1.Cells[1, iRow] := E.GetValue('Name'); 94 | sg1.Cells[2, iRow] := E.GetValue('Id'); 95 | sg1.Cells[3, iRow] := E.GetValue('Version'); 96 | if e.TryGetValue('Moniker',s) then 97 | sg1.Cells[4, iRow] := s 98 | else 99 | sg1.Cells[4, iRow] := ''; 100 | sg1.Cells[5, iRow] := E.GetValue('Source'); 101 | end; 102 | finally 103 | sg1.AutoFitColumns(); 104 | 105 | V.Free; 106 | end; 107 | ActivitySet(False); 108 | //listView1.Items.EndUpdate; 109 | end; 110 | 111 | end. 112 | 113 | -------------------------------------------------------------------------------- /WGGui/uFrmSplash.pas: -------------------------------------------------------------------------------- 1 | unit uFrmSplash; 2 | 3 | interface 4 | 5 | uses 6 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 7 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, uBaseFrame, Vcl.ExtCtrls, acPNG; 8 | 9 | type 10 | TFrmSplash = class(TBaseFrame) 11 | Image1: TImage; 12 | private 13 | { Private declarations } 14 | public 15 | { Public declarations } 16 | end; 17 | 18 | var 19 | FrmSplash: TFrmSplash; 20 | 21 | implementation 22 | 23 | {$R *.dfm} 24 | 25 | end. 26 | -------------------------------------------------------------------------------- /WGGui/uMain.pas: -------------------------------------------------------------------------------- 1 | unit uMain; 2 | 3 | interface 4 | 5 | uses 6 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,System.Generics.Collections, 7 | System.Classes, Vcl.Graphics, uConsts, System.JSON,System.StrUtils, 8 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, System.ImageList, Vcl.ImgList, 9 | sSkinManager, sSkinProvider, Vcl.Menus, Vcl.ExtCtrls, System.Actions, 10 | Vcl.ActnList, 11 | uBaseFrame, uFrmSearch, usearchPackage, uDM, 12 | uFrmList, Vcl.WinXCtrls, sPanel, DosCommand, Vcl.StdCtrls, 13 | System.Notification, ufrmsplash, AdvSysKeyboardHook, AdvListEditor; 14 | 15 | type 16 | TfMain = class(TForm) 17 | ImageList1: TImageList; 18 | TrayIcon1: TTrayIcon; 19 | PopupMenu1: TPopupMenu; 20 | W1: TMenuItem; 21 | N3: TMenuItem; 22 | L1: TMenuItem; 23 | List1: TMenuItem; 24 | N1: TMenuItem; 25 | N2: TMenuItem; 26 | ActionList1: TActionList; 27 | pnlMain: TPanel; 28 | actQuit: TAction; 29 | actListPackages: TAction; 30 | N4: TMenuItem; 31 | actConfigGui: TAction; 32 | mnuConfigurtion: TMenuItem; 33 | actShowGui: TAction; 34 | pnlStatus: TPanel; 35 | AI1: TActivityIndicator; 36 | Panel1: TPanel; 37 | actSearch: TAction; 38 | DosCUpdates: TDosCommand; 39 | NotificationCenter1: TNotificationCenter; 40 | DosCommand1: TDosCommand; 41 | Panel2: TPanel; 42 | lblSearch: TLabel; 43 | eSearch: TAdvListEditor; 44 | Button1: TButton; 45 | procedure actQuitExecute(Sender: TObject); 46 | procedure actListPackagesExecute(Sender: TObject); 47 | procedure actShowGuiExecute(Sender: TObject); 48 | procedure actSearchExecute(Sender: TObject); 49 | procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); 50 | procedure FormCreate(Sender: TObject); 51 | procedure AdvSysKeyboardHook1KeyDown(Sender: TObject; Key: Word; 52 | Shift: TShiftState; var Allow: Boolean); 53 | procedure Button1Click(Sender: TObject); 54 | private 55 | { Private declarations } 56 | bCanClose: Boolean; 57 | procedure popup(nb: integer); 58 | public 59 | aFrame: TBaseFrame; 60 | procedure ActivitySet(bActive: Boolean); 61 | procedure terminateUpdate(Sender: TObject); 62 | procedure displaySplash; 63 | procedure terminatedList(Sender: TObject); 64 | 65 | { Public declarations } 66 | end; 67 | 68 | var 69 | fMain: TfMain; 70 | 71 | implementation 72 | 73 | {$R *.dfm} 74 | 75 | 76 | procedure TfMain.actListPackagesExecute(Sender: TObject); 77 | begin 78 | ActivitySet(True); 79 | DosCommand1.OnCharDecoding := DM.CharDecoding; 80 | DosCommand1.CommandLine := sList; 81 | DosCommand1.OnTerminated := terminatedList; 82 | DosCommand1.Execute; 83 | end; 84 | 85 | procedure TfMain.ActivitySet(bActive: Boolean); 86 | begin 87 | AI1.Animate := bActive; 88 | end; 89 | 90 | procedure TfMain.actQuitExecute(Sender: TObject); 91 | begin 92 | bCanClose := True; 93 | Close; 94 | end; 95 | 96 | procedure TfMain.actSearchExecute(Sender: TObject); 97 | begin 98 | // ActivitySet(True); 99 | if aFrame <> Nil then 100 | aFrame.Free; 101 | 102 | aFrame := TfrmSearch.Create(pnlMain); 103 | aFrame.Parent := pnlMain; 104 | aFrame.Align := alClient; 105 | aFrame.ActivitySet := ActivitySet; 106 | 107 | TfrmSearch(aFrame).Init; 108 | end; 109 | 110 | procedure TfMain.actShowGuiExecute(Sender: TObject); 111 | begin 112 | Show; 113 | end; 114 | 115 | procedure TfMain.AdvSysKeyboardHook1KeyDown(Sender: TObject; Key: Word; 116 | Shift: TShiftState; var Allow: Boolean); 117 | begin 118 | showmessage(inttostr(Key)); 119 | end; 120 | 121 | procedure TfMain.Button1Click(Sender: TObject); 122 | var 123 | i : Integer; 124 | sSearch : tlist; 125 | begin 126 | if aFrame <> Nil then 127 | aFrame.Free; 128 | 129 | aFrame := TfrmSearch.Create(pnlMain); 130 | aFrame.Parent := pnlMain; 131 | aFrame.Align := alClient; 132 | i := 0; 133 | sSearch := tlist.Create; 134 | while i <= eSearch.Values.Count-1 do 135 | begin 136 | ssearch.Add(eSearch.Values[i].DisplayText); 137 | inc(i); 138 | end; 139 | 140 | TfrmSearch(aFrame).sSearch := String.join(',',sSearch.ToArray); 141 | TfrmSearch(aFrame).btnClose.OnClick := actListPackagesExecute; 142 | aFrame.ActivitySet := ActivitySet; 143 | 144 | TfrmSearch(aFrame).Init; 145 | end; 146 | 147 | procedure TfMain.displaySplash; 148 | begin 149 | if aFrame <> Nil then 150 | aFrame.Free; 151 | 152 | aFrame := TfrmSplash.Create(pnlMain); 153 | aFrame.Parent := pnlMain; 154 | aFrame.Align := alClient; 155 | aFrame.ActivitySet := ActivitySet; 156 | 157 | end; 158 | 159 | procedure TfMain.FormCloseQuery(Sender: TObject; var CanClose: Boolean); 160 | begin 161 | hide; 162 | CanClose := bCanClose; 163 | end; 164 | 165 | procedure TfMain.FormCreate(Sender: TObject); 166 | begin 167 | //displaySplash; 168 | bCanClose := False; 169 | DosCUpdates.CommandLine := sUpdate; 170 | DosCUpdates.OnCharDecoding := DM.CharDecoding; 171 | DosCUpdates.OnTerminated := terminateUpdate; 172 | DosCUpdates.Execute; 173 | 174 | end; 175 | 176 | procedure TfMain.popup(nb: integer); 177 | var 178 | MyNotification: TNotification; 179 | begin 180 | MyNotification := NotificationCenter1.CreateNotification; 181 | // Creates the notification 182 | try 183 | MyNotification.Name := 'Winget Helper Notification'; 184 | // Defines the name of the notification. 185 | MyNotification.Title := 'Winget Helper'; 186 | // Defines the name that appears when the notification is presented. 187 | MyNotification.AlertBody := Format('New Upgrades availables (%d)', [nb]); 188 | // Defines the body of the notification that appears below the title. 189 | MyNotification.EnableSound := True; 190 | 191 | NotificationCenter1.PresentNotification(MyNotification); 192 | // Presents the notification on the screen. 193 | finally 194 | MyNotification.Free; // Frees the variable 195 | end; 196 | end; 197 | 198 | procedure TfMain.terminatedList(Sender: TObject); 199 | begin 200 | if aFrame <> Nil then 201 | aFrame.Free; 202 | 203 | aFrame := TfrmList.Create(pnlMain); 204 | aFrame.Parent := pnlMain; 205 | aFrame.Align := alClient; 206 | aFrame.ActivitySet := ActivitySet; 207 | TfrmList(aFrame).JSON := DosCommand1.Lines.Text; 208 | TfrmList(aFrame).Init; 209 | //tfrmList(aFrame).sg1.SetFocus; 210 | //eSearch.SetFocus; 211 | end; 212 | 213 | procedure TfMain.terminateUpdate(Sender: TObject); 214 | var 215 | V: TJsonValue; 216 | O, E, P: TJsonObject; 217 | A: TJsonArray; 218 | s: String; 219 | 220 | iRow: integer; 221 | begin 222 | V := TJsonObject.ParseJSONValue(DosCUpdates.Lines.Text); 223 | 224 | O := V as TJsonObject; 225 | A := O.GetValue('packages'); 226 | 227 | popup(A.Count); 228 | actListPackagesExecute(Sender); 229 | end; 230 | 231 | end. 232 | -------------------------------------------------------------------------------- /WGGui/uOldMain.dfm: -------------------------------------------------------------------------------- 1 | object fOldMain: TfOldMain 2 | Left = 0 3 | Top = 0 4 | Caption = 'fOldMain' 5 | ClientHeight = 659 6 | ClientWidth = 980 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -12 11 | Font.Name = 'Segoe UI' 12 | Font.Style = [] 13 | PopupMenu = PopupMenu1 14 | PopupMode = pmExplicit 15 | TextHeight = 15 16 | object SynEdit1: TSynEdit 17 | Left = 8 18 | Top = 8 19 | Width = 801 20 | Height = 569 21 | Font.Charset = DEFAULT_CHARSET 22 | Font.Color = clWindowText 23 | Font.Height = -13 24 | Font.Name = 'Consolas' 25 | Font.Style = [] 26 | Font.Quality = fqClearTypeNatural 27 | TabOrder = 0 28 | UseCodeFolding = False 29 | Gutter.Font.Charset = DEFAULT_CHARSET 30 | Gutter.Font.Color = clWindowText 31 | Gutter.Font.Height = -11 32 | Gutter.Font.Name = 'Consolas' 33 | Gutter.Font.Style = [] 34 | Gutter.Bands = < 35 | item 36 | Kind = gbkMarks 37 | Width = 13 38 | end 39 | item 40 | Kind = gbkLineNumbers 41 | end 42 | item 43 | Kind = gbkFold 44 | end 45 | item 46 | Kind = gbkTrackChanges 47 | end 48 | item 49 | Kind = gbkMargin 50 | Width = 3 51 | end> 52 | Highlighter = SynJSONSyn1 53 | Lines.Strings = ( 54 | 'SynEdit1') 55 | SelectedColor.Alpha = 0.400000005960464500 56 | end 57 | object sButton1: TsButton 58 | Left = 856 59 | Top = 80 60 | Width = 75 61 | Height = 25 62 | Caption = 'sButton1' 63 | TabOrder = 1 64 | OnClick = sButton1Click 65 | end 66 | object TrayIcon1: TTrayIcon 67 | Animate = True 68 | Icons = ImageList1 69 | PopupMenu = PopupMenu1 70 | Visible = True 71 | Left = 272 72 | Top = 80 73 | end 74 | object sSkinManager1: TsSkinManager 75 | ButtonsOptions.OldGlyphsMode = False 76 | IsDefault = False 77 | InternalSkins = <> 78 | MenuSupport.Font.Charset = DEFAULT_CHARSET 79 | MenuSupport.Font.Color = clWindowText 80 | MenuSupport.Font.Height = -11 81 | MenuSupport.Font.Name = 'Segoe UI' 82 | MenuSupport.Font.Style = [] 83 | SkinDirectory = 'C:\skins\Skins' 84 | SkinName = 'Windows 11 dark' 85 | SkinInfo = '16.13' 86 | ThirdParty.ThirdEdits = ' '#13#10 87 | ThirdParty.ThirdButtons = 'TButton'#13#10'TPopUpMenu'#13#10 88 | ThirdParty.ThirdBitBtns = ' '#13#10 89 | ThirdParty.ThirdCheckBoxes = ' '#13#10 90 | ThirdParty.ThirdGroupBoxes = ' '#13#10 91 | ThirdParty.ThirdListViews = ' '#13#10 92 | ThirdParty.ThirdPanels = ' '#13#10 93 | ThirdParty.ThirdGrids = ' '#13#10 94 | ThirdParty.ThirdTreeViews = ' '#13#10'TTrayIcon'#13#10 95 | ThirdParty.ThirdComboBoxes = ' '#13#10 96 | ThirdParty.ThirdWWEdits = ' '#13#10 97 | ThirdParty.ThirdVirtualTrees = ' '#13#10 98 | ThirdParty.ThirdGridEh = ' '#13#10 99 | ThirdParty.ThirdPageControl = ' '#13#10 100 | ThirdParty.ThirdTabControl = ' '#13#10 101 | ThirdParty.ThirdToolBar = ' '#13#10 102 | ThirdParty.ThirdStatusBar = ' '#13#10 103 | ThirdParty.ThirdSpeedButton = ' '#13#10 104 | ThirdParty.ThirdScrollControl = ' '#13#10 105 | ThirdParty.ThirdUpDown = ' '#13#10 106 | ThirdParty.ThirdScrollBar = ' '#13#10 107 | ThirdParty.ThirdStaticText = ' '#13#10 108 | ThirdParty.ThirdNativePaint = ' '#13#10 109 | Left = 392 110 | Top = 48 111 | end 112 | object sSkinProvider1: TsSkinProvider 113 | AddedTitle.Font.Charset = DEFAULT_CHARSET 114 | AddedTitle.Font.Color = clNone 115 | AddedTitle.Font.Height = -12 116 | AddedTitle.Font.Name = 'Segoe UI' 117 | AddedTitle.Font.Style = [] 118 | SkinData.SkinSection = 'FORM' 119 | TitleButtons = <> 120 | Left = 456 121 | Top = 136 122 | end 123 | object PopupMenu1: TPopupMenu 124 | Left = 296 125 | Top = 144 126 | object W1: TMenuItem 127 | Caption = 'Winget GUI' 128 | SubMenuImages = ImageList1 129 | ImageIndex = 0 130 | ShortCut = 36935 131 | end 132 | object N3: TMenuItem 133 | Caption = '-' 134 | end 135 | object L1: TMenuItem 136 | Caption = 'List' 137 | SubMenuImages = ImageList1 138 | OnClick = L1Click 139 | end 140 | object List1: TMenuItem 141 | Caption = 'Update' 142 | end 143 | object N1: TMenuItem 144 | Caption = '-' 145 | end 146 | object N2: TMenuItem 147 | Caption = 'Quit' 148 | OnClick = N2Click 149 | end 150 | end 151 | object DosCommand1: TDosCommand 152 | CommandLine = 153 | 'powershell -command "get-wglist | out-object | where-Object {$_.' + 154 | 'source -eq '#39'winget'#39'}' 155 | InputToOutput = False 156 | MaxTimeAfterBeginning = 0 157 | MaxTimeAfterLastOutput = 0 158 | OnCharDecoding = DosCommand1CharDecoding 159 | OnNewLine = DosCommand1NewLine 160 | Left = 864 161 | Top = 216 162 | end 163 | object ImageList1: TImageList 164 | Left = 376 165 | Top = 608 166 | Bitmap = { 167 | 494C010101000800040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 168 | 0000000000003600000028000000400000001000000001002000000000000010 169 | 0000000000000000000000000000000000000000000000000000000000000000 170 | 00000000000000000000000000002C98FDFF2E50FAFF00000000000000000000 171 | 0000000000000000000000000000000000000000000000000000000000000000 172 | 0000000000000000000000000000000000000000000000000000000000000000 173 | 0000000000000000000000000000000000000000000000000000000000000000 174 | 0000000000000000000000000000000000000000000000000000000000000000 175 | 0000000000000000000000000000000000000000000000000000000000000000 176 | 0000000000000000000000000000000000000000000000000000000000000000 177 | 0000000000000000000000000000000000000000000000000000000000000000 178 | 00002C98FDFF2C98FDFF2C98FDFF2C98FDFF2E50FAFFC17025FF2E50FAFF2E50 179 | FAFF000000000000000000000000000000000000000000000000000000000000 180 | 0000000000000000000000000000000000000000000000000000000000000000 181 | 0000000000000000000000000000000000000000000000000000000000000000 182 | 0000000000000000000000000000000000000000000000000000000000000000 183 | 0000000000000000000000000000000000000000000000000000000000000000 184 | 0000000000000000000000000000000000000000000000000000000000000000 185 | 00000000000000000000000000000000000000000000000000002C98FDFF2C98 186 | FDFF2C98FDFF2C98FDFF2C98FDFF2C98FDFF2E50FAFFC17025FFFFFFFEFF6D3E 187 | 12FF6D3E12FF2E50FAFF00000000000000000000000000000000000000000000 188 | 0000000000000000000000000000000000000000000000000000000000000000 189 | 0000000000000000000000000000000000000000000000000000000000000000 190 | 0000000000000000000000000000000000000000000000000000000000000000 191 | 0000000000000000000000000000000000000000000000000000000000000000 192 | 0000000000000000000000000000000000000000000000000000000000000000 193 | 00000000000000000000000000000000000000000000000000002C98FDFF2C98 194 | FDFF2C98FDFF2C98FDFF2C98FDFF2C98FDFF2E50FAFFB76B2BFFC17025FF9052 195 | 1AFF91531BFF2E50FAFF00000000000000000000000000000000000000000000 196 | 0000000000000000000000000000000000000000000000000000000000000000 197 | 0000000000000000000000000000000000000000000000000000000000000000 198 | 0000000000000000000000000000000000000000000000000000000000000000 199 | 0000000000000000000000000000000000000000000000000000000000000000 200 | 0000000000000000000000000000000000000000000000000000000000000000 201 | 00000000000000000000000000000000000000000000000000002C98FDFF2C98 202 | FDFF2C98FDFF2C98FDFF2C98FDFF2C98FDFF2E50FAFF4054DFFFDEBFA3FFC170 203 | 25FF91531BFF2E50FAFF00000000000000000000000000000000000000000000 204 | 0000000000000000000000000000000000000000000000000000000000000000 205 | 0000000000000000000000000000000000000000000000000000000000000000 206 | 0000000000000000000000000000000000000000000000000000000000000000 207 | 0000000000000000000000000000000000000000000000000000000000000000 208 | 0000000000000000000000000000000000000000000000000000000000000000 209 | 00000000000000000000000000000000000000000000000000002C98FDFF2C98 210 | FDFF2C98FDFF2C98FDFF2C98FDFF2C98FDFF2E50FAFF2E50FAFF2E50FAFFC170 211 | 25FF92531AFF2E50FAFF00000000000000000000000000000000000000000000 212 | 0000000000000000000000000000000000000000000000000000000000000000 213 | 0000000000000000000000000000000000000000000000000000000000000000 214 | 0000000000000000000000000000000000000000000000000000000000000000 215 | 0000000000000000000000000000000000000000000000000000000000000000 216 | 0000000000000000000000000000000000000000000000000000000000000000 217 | 00000000000000000000000000000000000000000000000000002C98FDFF2C98 218 | FDFF3DBEFAFF3DBEFAFF3DBEFAFF2C98FDFF2E50FAFF2C98FDFF2C98FDFF2C98 219 | FDFF2E4FFAFF2E50FAFF00000000000000000000000000000000000000000000 220 | 0000000000000000000000000000000000000000000000000000000000000000 221 | 0000000000000000000000000000000000000000000000000000000000000000 222 | 0000000000000000000000000000000000000000000000000000000000000000 223 | 0000000000000000000000000000000000000000000000000000000000000000 224 | 0000000000000000000000000000000000000000000000000000000000000000 225 | 000000000000000000000000000000000000000000003DBEFAFF3DBEFAFF3DBE 226 | FAFF3DBEFAFF3DBEFAFF3DBEFAFF2C98FDFF2E4FFAFF2C98FDFF2C98FDFF2C98 227 | FDFF2C98FDFF2C98FDFF2C98FDFF000000000000000000000000000000000000 228 | 0000000000000000000000000000000000000000000000000000000000000000 229 | 0000000000000000000000000000000000000000000000000000000000000000 230 | 0000000000000000000000000000000000000000000000000000000000000000 231 | 0000000000000000000000000000000000000000000000000000000000000000 232 | 0000000000000000000000000000000000000000000000000000000000000000 233 | 0000000000000000000000000000000000003DBEFAFF3DBEFAFF3DBEFAFF3DBE 234 | FAFF3DBEFAFF3DBEFAFF3DBEFAFF3CBEFAFF2C98FDFF2C98FDFF2C98FDFF2C98 235 | FDFF2C98FDFF2C98FDFF2C98FDFF2C98FDFF0000000000000000000000000000 236 | 0000000000000000000000000000000000000000000000000000000000000000 237 | 0000000000000000000000000000000000000000000000000000000000000000 238 | 0000000000000000000000000000000000000000000000000000000000000000 239 | 0000000000000000000000000000000000000000000000000000000000000000 240 | 0000000000000000000000000000000000000000000000000000000000000000 241 | 000000000000000000000000000000000000000000003DBEFAFF3DBEFAFF3DBE 242 | FAFF3DBEFAFFB4F2FFFFB4F2FFFFB4F2FFFF8EDFFFFF8EDFFFFF8EDFFFFF2C98 243 | FDFF2C98FDFF2C98FDFF2C98FDFF000000000000000000000000000000000000 244 | 0000000000000000000000000000000000000000000000000000000000000000 245 | 0000000000000000000000000000000000000000000000000000000000000000 246 | 0000000000000000000000000000000000000000000000000000000000000000 247 | 0000000000000000000000000000000000000000000000000000000000000000 248 | 0000000000000000000000000000000000000000000000000000000000000000 249 | 00000000000000000000000000000000000000000000000000003CBEFAFFB4F2 250 | FFFFB4F2FFFFB4F2FFFFB4F2FFFFB4F2FFFF8EDFFFFF8EDFFFFF8EDFFFFF8EDF 251 | FFFF8EDFFFFF2C98FDFF00000000000000000000000000000000000000000000 252 | 0000000000000000000000000000000000000000000000000000000000000000 253 | 0000000000000000000000000000000000000000000000000000000000000000 254 | 0000000000000000000000000000000000000000000000000000000000000000 255 | 0000000000000000000000000000000000000000000000000000000000000000 256 | 0000000000000000000000000000000000000000000000000000000000000000 257 | 0000000000000000000000000000000000000000000078DEFEBE50DAFDFF50DA 258 | FDFFB4F2FFFFB4F2FFFFB4F2FFFFB4F2FFFF8EDFFFFF8EDFFFFF8EDFFFFF8EDF 259 | FFFF3DBEFAFF3DBEFAFFF4FAFF0E000000000000000000000000000000000000 260 | 0000000000000000000000000000000000000000000000000000000000000000 261 | 0000000000000000000000000000000000000000000000000000000000000000 262 | 0000000000000000000000000000000000000000000000000000000000000000 263 | 0000000000000000000000000000000000000000000000000000000000000000 264 | 0000000000000000000000000000000000000000000000000000000000000000 265 | 0000000000000000000000000000000000000000000050DAFDFF50DAFDFF50DA 266 | FDFF50DAFDFF50DAFDFFA7EEFFFAB4F2FFFF8EDFFFFF7AD5FEF93DBEFAFF3DBE 267 | FAFF3DBEFAFF3DBEFAFF3DBEFAFF000000000000000000000000000000000000 268 | 0000000000000000000000000000000000000000000000000000000000000000 269 | 0000000000000000000000000000000000000000000000000000000000000000 270 | 0000000000000000000000000000000000000000000000000000000000000000 271 | 0000000000000000000000000000000000000000000000000000000000000000 272 | 0000000000000000000000000000000000000000000000000000000000000000 273 | 00000000000000000000000000000000000050DAFDFF50DAFDFF50DAFDFF50DA 274 | FDFF50DAFDFF50DAFDFF50DAFDFF50DAFDFF3DBEFAFF3DBEFAFF3DBEFAFF3DBE 275 | FAFF3DBEFAFF3DBEFAFF3DBEFAFF3DBEFAFF0000000000000000000000000000 276 | 0000000000000000000000000000000000000000000000000000000000000000 277 | 0000000000000000000000000000000000000000000000000000000000000000 278 | 0000000000000000000000000000000000000000000000000000000000000000 279 | 0000000000000000000000000000000000000000000000000000000000000000 280 | 0000000000000000000000000000000000000000000000000000000000000000 281 | 000000000000000000000000000000000000000000000000000052DBFDFC50DA 282 | FDFF50DAFDFF50DAFDFF50DAFDFF00000000000000003DBEFAFF3DBEFAFF3DBE 283 | FAFF3DBEFAFF56C6FADD00000000000000000000000000000000000000000000 284 | 0000000000000000000000000000000000000000000000000000000000000000 285 | 0000000000000000000000000000000000000000000000000000000000000000 286 | 0000000000000000000000000000000000000000000000000000000000000000 287 | 0000000000000000000000000000000000000000000000000000000000000000 288 | 0000000000000000000000000000000000000000000000000000000000000000 289 | 0000000000000000000000000000000000000000000000000000000000000000 290 | 00000000000050DAFDFF000000000000000000000000000000003DBEFAFF0000 291 | 0000000000000000000000000000000000000000000000000000000000000000 292 | 0000000000000000000000000000000000000000000000000000000000000000 293 | 0000000000000000000000000000000000000000000000000000000000000000 294 | 0000000000000000000000000000000000000000000000000000000000000000 295 | 0000000000000000000000000000000000000000000000000000000000000000 296 | 0000000000000000000000000000000000000000000000000000000000000000 297 | 000000000000000000000000000000000000424D3E000000000000003E000000 298 | 2800000040000000100000000100010000000000800000000000000000000000 299 | 000000000000000000000000FFFFFF00FE7F000000000000F00F000000000000 300 | C003000000000000C003000000000000C003000000000000C003000000000000 301 | C003000000000000800100000000000000000000000000008001000000000000 302 | C003000000000000800100000000000080010000000000000000000000000000 303 | C183000000000000FBDF00000000000000000000000000000000000000000000 304 | 000000000000} 305 | end 306 | object SynJSONSyn1: TSynJSONSyn 307 | Left = 696 308 | Top = 336 309 | end 310 | end 311 | -------------------------------------------------------------------------------- /WGGui/uOldMain.pas: -------------------------------------------------------------------------------- 1 | unit uOldMain; 2 | 3 | interface 4 | 5 | uses 6 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 7 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, sSkinProvider, sSkinManager, Vcl.ExtCtrls, Vcl.Menus, SynEdit, DosCommand, Vcl.StdCtrls, sButton, System.ImageList, 8 | Vcl.ImgList, acAlphaImageList, SynEditHighlighter, SynEditCodeFolding, SynHighlighterJSON; 9 | 10 | type 11 | TfOldMain = class(TForm) 12 | TrayIcon1: TTrayIcon; 13 | sSkinManager1: TsSkinManager; 14 | sSkinProvider1: TsSkinProvider; 15 | PopupMenu1: TPopupMenu; 16 | L1: TMenuItem; 17 | List1: TMenuItem; 18 | N1: TMenuItem; 19 | N2: TMenuItem; 20 | DosCommand1: TDosCommand; 21 | SynEdit1: TSynEdit; 22 | sButton1: TsButton; 23 | W1: TMenuItem; 24 | N3: TMenuItem; 25 | ImageList1: TImageList; 26 | SynJSONSyn1: TSynJSONSyn; 27 | procedure N2Click(Sender: TObject); 28 | procedure L1Click(Sender: TObject); 29 | function DosCommand1CharDecoding(ASender: TObject; ABuf: TStream): string; 30 | procedure DosCommand1NewLine(ASender: TObject; const ANewLine: string; AOutputType: TOutputType); 31 | procedure sButton1Click(Sender: TObject); 32 | private 33 | { Private declarations } 34 | public 35 | { Public declarations } 36 | end; 37 | 38 | var 39 | fOldMain: TfOldMain; 40 | 41 | implementation 42 | 43 | {$R *.dfm} 44 | 45 | function TfOldMain.DosCommand1CharDecoding(ASender: TObject; ABuf: TStream): string; 46 | var 47 | pBytes: TBytes; 48 | iLength: Integer; 49 | begin 50 | iLength := ABuf.Size; 51 | if iLength > 0 then 52 | begin 53 | SetLength(pBytes, iLength); 54 | ABuf.Read(pBytes, iLength); 55 | try 56 | result := tEncoding.UTF8.GetString(pBytes); 57 | except 58 | result := ''; 59 | end; 60 | end 61 | else 62 | result := ''; 63 | 64 | end; 65 | 66 | procedure TfOldMain.DosCommand1NewLine(ASender: TObject; const ANewLine: string; AOutputType: TOutputType); 67 | begin 68 | SynEdit1.Lines.Add(aNewLine); 69 | end; 70 | 71 | procedure TfOldMain.L1Click(Sender: TObject); 72 | begin 73 | Show; 74 | end; 75 | 76 | procedure TfOldMain.N2Click(Sender: TObject); 77 | begin 78 | Close; 79 | end; 80 | 81 | procedure TfOldMain.sButton1Click(Sender: TObject); 82 | begin 83 | var s : string := ''; 84 | DosCommand1.CommandLine := s; 85 | DosCommand1.Execute; 86 | end; 87 | 88 | end. 89 | -------------------------------------------------------------------------------- /WGGui/usearchPackage.dfm: -------------------------------------------------------------------------------- 1 | object fSearchPackage: TfSearchPackage 2 | Left = 0 3 | Top = 0 4 | BorderStyle = bsNone 5 | Caption = 'fSearchPackage' 6 | ClientHeight = 480 7 | ClientWidth = 640 8 | Color = clBtnFace 9 | Font.Charset = DEFAULT_CHARSET 10 | Font.Color = clWindowText 11 | Font.Height = -12 12 | Font.Name = 'Segoe UI' 13 | Font.Style = [] 14 | Position = poScreenCenter 15 | TextHeight = 15 16 | object pnlSearch: TPanel 17 | Left = 0 18 | Top = 0 19 | Width = 640 20 | Height = 48 21 | Align = alClient 22 | BevelOuter = bvNone 23 | Caption = 'pnlSearch' 24 | ShowCaption = False 25 | TabOrder = 0 26 | object Edit1: TEdit 27 | Left = 0 28 | Top = 0 29 | Width = 640 30 | Height = 472 31 | Align = alTop 32 | Font.Charset = DEFAULT_CHARSET 33 | Font.Color = clWindowText 34 | Font.Height = -24 35 | Font.Name = 'Segoe UI' 36 | Font.Style = [] 37 | ParentFont = False 38 | TabOrder = 0 39 | Text = 'Edit1' 40 | ExplicitWidth = 48 41 | end 42 | end 43 | object AdvStringGrid1: TAdvStringGrid 44 | Left = 0 45 | Top = 48 46 | Width = 640 47 | Height = 432 48 | Align = alBottom 49 | DrawingStyle = gdsClassic 50 | FixedColor = clWhite 51 | TabOrder = 1 52 | Visible = False 53 | GridLineColor = 13948116 54 | GridFixedLineColor = 11250603 55 | ActiveCellFont.Charset = DEFAULT_CHARSET 56 | ActiveCellFont.Color = 4474440 57 | ActiveCellFont.Height = -12 58 | ActiveCellFont.Name = 'Segoe UI' 59 | ActiveCellFont.Style = [fsBold] 60 | ActiveCellColor = 11565130 61 | ActiveCellColorTo = 11565130 62 | BorderColor = 11250603 63 | ControlLook.FixedGradientFrom = clWhite 64 | ControlLook.FixedGradientTo = clWhite 65 | ControlLook.FixedGradientHoverTo = clWhite 66 | ControlLook.FixedGradientHoverMirrorFrom = clWhite 67 | ControlLook.FixedGradientHoverMirrorTo = clWhite 68 | ControlLook.FixedGradientHoverBorder = 11645361 69 | ControlLook.FixedGradientDownFrom = clWhite 70 | ControlLook.FixedGradientDownTo = clWhite 71 | ControlLook.FixedGradientDownMirrorFrom = clWhite 72 | ControlLook.FixedGradientDownMirrorTo = clWhite 73 | ControlLook.FixedGradientDownBorder = 11250603 74 | ControlLook.DropDownHeader.Font.Charset = DEFAULT_CHARSET 75 | ControlLook.DropDownHeader.Font.Color = clWindowText 76 | ControlLook.DropDownHeader.Font.Height = -11 77 | ControlLook.DropDownHeader.Font.Name = 'Segoe UI' 78 | ControlLook.DropDownHeader.Font.Style = [] 79 | ControlLook.DropDownHeader.Visible = True 80 | ControlLook.DropDownHeader.Buttons = <> 81 | ControlLook.DropDownFooter.Font.Charset = DEFAULT_CHARSET 82 | ControlLook.DropDownFooter.Font.Color = clWindowText 83 | ControlLook.DropDownFooter.Font.Height = -11 84 | ControlLook.DropDownFooter.Font.Name = 'Segoe UI' 85 | ControlLook.DropDownFooter.Font.Style = [] 86 | ControlLook.DropDownFooter.Visible = True 87 | ControlLook.DropDownFooter.Buttons = <> 88 | Filter = <> 89 | FilterDropDown.Font.Charset = DEFAULT_CHARSET 90 | FilterDropDown.Font.Color = clWindowText 91 | FilterDropDown.Font.Height = -12 92 | FilterDropDown.Font.Name = 'Segoe UI' 93 | FilterDropDown.Font.Style = [] 94 | FilterDropDown.TextChecked = 'Checked' 95 | FilterDropDown.TextUnChecked = 'Unchecked' 96 | FilterDropDownClear = '(All)' 97 | FilterEdit.TypeNames.Strings = ( 98 | 'Starts with' 99 | 'Ends with' 100 | 'Contains' 101 | 'Not contains' 102 | 'Equal' 103 | 'Not equal' 104 | 'Larger than' 105 | 'Smaller than' 106 | 'Clear') 107 | FixedRowHeight = 22 108 | FixedFont.Charset = DEFAULT_CHARSET 109 | FixedFont.Color = 3881787 110 | FixedFont.Height = -11 111 | FixedFont.Name = 'Segoe UI' 112 | FixedFont.Style = [fsBold] 113 | FloatFormat = '%.2f' 114 | HoverButtons.Buttons = <> 115 | HTMLSettings.ImageFolder = 'images' 116 | HTMLSettings.ImageBaseName = 'img' 117 | Look = glCustom 118 | PrintSettings.DateFormat = 'dd/mm/yyyy' 119 | PrintSettings.Font.Charset = DEFAULT_CHARSET 120 | PrintSettings.Font.Color = clWindowText 121 | PrintSettings.Font.Height = -12 122 | PrintSettings.Font.Name = 'Segoe UI' 123 | PrintSettings.Font.Style = [] 124 | PrintSettings.FixedFont.Charset = DEFAULT_CHARSET 125 | PrintSettings.FixedFont.Color = clWindowText 126 | PrintSettings.FixedFont.Height = -12 127 | PrintSettings.FixedFont.Name = 'Segoe UI' 128 | PrintSettings.FixedFont.Style = [] 129 | PrintSettings.HeaderFont.Charset = DEFAULT_CHARSET 130 | PrintSettings.HeaderFont.Color = clWindowText 131 | PrintSettings.HeaderFont.Height = -12 132 | PrintSettings.HeaderFont.Name = 'Segoe UI' 133 | PrintSettings.HeaderFont.Style = [] 134 | PrintSettings.FooterFont.Charset = DEFAULT_CHARSET 135 | PrintSettings.FooterFont.Color = clWindowText 136 | PrintSettings.FooterFont.Height = -12 137 | PrintSettings.FooterFont.Name = 'Segoe UI' 138 | PrintSettings.FooterFont.Style = [] 139 | PrintSettings.PageNumSep = '/' 140 | SearchFooter.ColorTo = clNone 141 | SearchFooter.FindNextCaption = 'Find &next' 142 | SearchFooter.FindPrevCaption = 'Find &previous' 143 | SearchFooter.Font.Charset = DEFAULT_CHARSET 144 | SearchFooter.Font.Color = clWindowText 145 | SearchFooter.Font.Height = -12 146 | SearchFooter.Font.Name = 'Segoe UI' 147 | SearchFooter.Font.Style = [] 148 | SearchFooter.HighLightCaption = 'Highlight' 149 | SearchFooter.HintClose = 'Close' 150 | SearchFooter.HintFindNext = 'Find next occurrence' 151 | SearchFooter.HintFindPrev = 'Find previous occurrence' 152 | SearchFooter.HintHighlight = 'Highlight occurrences' 153 | SearchFooter.MatchCaseCaption = 'Match case' 154 | SearchFooter.ResultFormat = '(%d of %d)' 155 | SelectionColor = 13744549 156 | ShowDesignHelper = False 157 | SortSettings.HeaderColor = clWhite 158 | SortSettings.HeaderColorTo = clWhite 159 | SortSettings.HeaderMirrorColor = clWhite 160 | SortSettings.HeaderMirrorColorTo = clWhite 161 | Version = '8.6.14.2' 162 | ExplicitTop = 54 163 | end 164 | end 165 | -------------------------------------------------------------------------------- /WGGui/usearchPackage.pas: -------------------------------------------------------------------------------- 1 | unit usearchPackage; 2 | 3 | interface 4 | 5 | uses 6 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 7 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, AdvUtil, Vcl.StdCtrls, Vcl.Grids, AdvObj, BaseGrid, AdvGrid; 8 | 9 | type 10 | TfSearchPackage = class(TForm) 11 | pnlSearch: TPanel; 12 | AdvStringGrid1: TAdvStringGrid; 13 | Edit1: TEdit; 14 | private 15 | { Private declarations } 16 | public 17 | { Public declarations } 18 | end; 19 | 20 | var 21 | fSearchPackage: TfSearchPackage; 22 | 23 | implementation 24 | 25 | {$R *.dfm} 26 | 27 | end. 28 | -------------------------------------------------------------------------------- /Winget-posh/License.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Yves Godart 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /Winget-posh/WingetPoshGui.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/Winget-posh/WingetPoshGui.exe -------------------------------------------------------------------------------- /Winget-posh/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/Winget-posh/icon.ico -------------------------------------------------------------------------------- /Winget-posh/image0.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/Winget-posh/image0.jpeg -------------------------------------------------------------------------------- /Winget-posh/tools/install.ps1: -------------------------------------------------------------------------------- 1 | function getWinVersion { 2 | $win10 = (Get-ComputerInfo | Select-Object OsName) -match "windows 10" 3 | $psversion = $PSVersionTable.PSVersion.Major 4 | if ($win10) { 5 | if ($psversion -eq 5) { 6 | import-Module -Name International 7 | } else { 8 | import-Module -Name International -UseWindowsPowerShell 9 | } 10 | } 11 | } 12 | 13 | function getWingetLocals { 14 | getWinVersion 15 | $culture = ((Get-WinUserLanguageList).LanguageTag -split "-")[0] 16 | $languages = @('de-DE', 'es-ES', 'fr-FR', 'it-IT', 'ja-JP', 'ko-KR', 'pt-BR', 'ru-RU', 'zh-CN', 'zh-TW') 17 | $language = $languages | Where-Object {$_.StartsWith($culture)} 18 | Write-Host "⏳ Downloading resources for $language" 19 | $hash = @{} 20 | 21 | try { 22 | # Download resources file from github 23 | $data = ([xml](((Invoke-WebRequest -Uri "https://raw.githubusercontent.com/microsoft/winget-cli/master/Localization/Resources/$language/winget.resw" -ErrorAction Stop ).Content -replace "\uFEFF", ""))).root.data 24 | } 25 | catch { 26 | # Fall back on the en-US resources 27 | $data = ([xml](((Invoke-WebRequest -Uri "https://raw.githubusercontent.com/microsoft/winget-cli/master/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw" -ErrorAction Stop ).Content -replace "\uFEFF", ""))).root.data 28 | } 29 | $data | ForEach-Object { 30 | $hash[$_.name] = $_.value 31 | } 32 | $hash 33 | } 34 | 35 | $version = [string]$(Get-InstalledModule -Name wingetposh -ErrorAction Ignore).version 36 | if (-not (Test-Path -Path "~/.config/.wingetposh/params.$version")) { 37 | 38 | Write-Host "🚧 Parsing resources and writing config files." 39 | if (-not (Test-Path -Path ~/.config/.wingetposh)) { 40 | New-Item -Path ~/.config/.wingetposh -ItemType Directory | Out-Null 41 | Remove-Item -Path ~/.config/.wingetposh/locals.json -ErrorAction Ignore | Out-Null 42 | New-Item -Path ~/.config/.wingetposh/locals.json | Out-Null 43 | } 44 | 45 | 46 | 47 | $l = getWingetLocals 48 | $l | ConvertTo-Json | Out-File -FilePath ~/.config/.wingetposh/locals.json -Force | Out-Null 49 | 50 | $init = @{} 51 | ( 52 | ('UseNerdFont', $false), 53 | ('SilentInstall', $false), 54 | ('AcceptPackageAgreements', $true), 55 | ('AcceptSourceAgreements', $true), 56 | ('Force', $false), 57 | ('IncludeScoop',$false) 58 | ) | ForEach-Object { $init[$_[0]] = $_[1] } 59 | 60 | $config = @{} 61 | if (Test-Path -Path ~/.config/.wingetposh/config.json) { 62 | (Get-Content $env:USERPROFILE/.config/.wingetposh/config.json | ConvertFrom-Json).psobject.Properties | ForEach-Object { 63 | $config[$_.Name] = $_.Value 64 | } 65 | } 66 | " " 67 | $init.GetEnumerator() | ForEach-Object { 68 | if (-not $config.ContainsKey($_.key)) { 69 | $config.Add($_.key, $_.Value) 70 | } 71 | } 72 | 73 | 74 | $config | ConvertTo-Json | Out-File -FilePath ~/.config/.wingetposh/config.json -Force | Out-Null 75 | "ok" | Out-File -FilePath "~/.config/.wingetposh/params.$version" | Out-Null 76 | 77 | Write-Host "Wingetposh version $version installed successfully 👌" 78 | Write-Host "".PadRight($Host.UI.RawUI.BufferSize.Width, '—') 79 | Write-Host "🗒️ Go to http://github.com/yves848/wingetposh for help and infos." 80 | Write-Host "📨 Please report bugs and requests at wingetposh@gmail.com" 81 | 82 | } 83 | $include = [System.IO.Path]::GetDirectoryName($myInvocation.MyCommand.Definition) 84 | $process = $(Get-Process WingetPoshGui -ErrorAction Ignore) 85 | if (-not $process) { 86 | Invoke-Expression "$include\..\WingetPoshGui.exe" 87 | } 88 | -------------------------------------------------------------------------------- /Winget-posh/visuals.ps1: -------------------------------------------------------------------------------- 1 | class Frame { 2 | [char]$UL 3 | [char]$UR 4 | [char]$TOP 5 | [char]$LEFT 6 | [char]$RIGHT 7 | [char]$BL 8 | [char]$BR 9 | [char]$BOTTOM 10 | [char]$LEFTSPLIT 11 | [char]$RIGHTSPLIT 12 | 13 | Frame ( 14 | [bool]$Double 15 | ) { 16 | if ($Double) { 17 | $this.UL = "╔" 18 | $this.UR = "╗" 19 | $this.TOP = "═" 20 | $this.LEFT = "║" 21 | $this.RIGHT = "║" 22 | $this.BL = "╚" 23 | $this.BR = "╝" 24 | $this.BOTTOM = "═" 25 | $this.LEFTSPLIT = "⊫" 26 | } 27 | else { 28 | #$this.UL = "┌" 29 | $this.UL = [char]::ConvertFromUtf32(0x256d) 30 | #$this.UR = "┐" 31 | $this.UR = [char]::ConvertFromUtf32(0x256e) 32 | $this.TOP = "─" 33 | $this.LEFT = "│" 34 | $this.RIGHT = "│" 35 | $this.BL = [char]::ConvertFromUtf32(0x2570) 36 | #$this.BL = "└" 37 | $this.BR = [char]::ConvertFromUtf32(0x256f) 38 | #$this.BR = "┘" 39 | $this.BOTTOM = "─" 40 | $this.LEFTSPLIT = [char]::ConvertFromUtf32(0x2524) 41 | $this.RIGHTSPLIT = [char]::ConvertFromUtf32(0x251c) 42 | } 43 | } 44 | } 45 | 46 | $Single = [Frame]::new($false) 47 | $Double = [Frame]::new($true) 48 | 49 | class window { 50 | [int]$X 51 | [int]$Y 52 | [int]$W 53 | [int]$H 54 | [Frame]$frameStyle 55 | [System.ConsoleColor]$frameColor 56 | [string]$title = "" 57 | [System.ConsoleColor]$titleColor 58 | [string]$footer = "" 59 | [int]$page = 1 60 | [int]$nbPages = 1 61 | 62 | window( 63 | [int]$X, 64 | [int]$y, 65 | [int]$w, 66 | [int]$h, 67 | [bool]$Double, 68 | [System.ConsoleColor]$color = "White" 69 | ) { 70 | $this.X = $X 71 | $this.Y = $y 72 | $this.W = $W 73 | $this.H = $H 74 | $this.frameStyle = [Frame]::new($Double) 75 | $this.frameColor = $color 76 | 77 | } 78 | 79 | window( 80 | [int]$X, 81 | [int]$y, 82 | [int]$w, 83 | [int]$h, 84 | [bool]$Double, 85 | [System.ConsoleColor]$color = "White", 86 | [string]$title = "", 87 | [System.ConsoleColor]$titlecolor = "Blue" 88 | ) { 89 | $this.X = $X 90 | $this.Y = $y 91 | $this.W = $W 92 | $this.H = $H 93 | $this.frameStyle = [Frame]::new($Double) 94 | $this.frameColor = $color 95 | $this.title = $title 96 | $this.titleColor = $titlecolor 97 | } 98 | 99 | [void] setPosition( 100 | [int]$X, 101 | [int]$Y 102 | ) { 103 | [System.Console]::SetCursorPosition($X, $Y) 104 | } 105 | 106 | [void] drawWindow() { 107 | $esc = $([char]0x1b) 108 | 109 | [System.Console]::CursorVisible = $false 110 | $this.setPosition($this.X, $this.Y) 111 | $bloc1 = $this.frameStyle.UL, "".PadLeft($this.W - 2, $this.frameStyle.TOP), $this.frameStyle.UR -join "" 112 | $blank = $this.frameStyle.LEFT, "".PadLeft($this.W - 2, " "), $this.frameStyle.RIGHT -join "" 113 | Write-Host $bloc1 -ForegroundColor $this.frameColor -NoNewline 114 | for ($i = 1; $i -lt $this.H; $i++) { 115 | $Y2 = $this.Y + $i 116 | $X3 = $this.X 117 | $this.setPosition($X3, $Y2) 118 | Write-Host $blank -ForegroundColor $this.frameColor 119 | } 120 | $Y2 = $this.Y + $this.H 121 | $this.setPosition( $this.X, $Y2) 122 | $bloc1 = $this.frameStyle.BL, "".PadLeft($this.W - 2, $this.frameStyle.BOTTOM), $this.frameStyle.BR -join "" 123 | Write-Host $bloc1 -ForegroundColor $this.frameColor -NoNewline 124 | $this.drawTitle() 125 | $this.drawFooter() 126 | } 127 | 128 | 129 | [void] drawVersion() { 130 | $v =Get-WGPVersion -param WGP 131 | $version = $this.frameStyle.LEFTSPLIT, $v, $this.frameStyle.RIGHTSPLIT -join "" 132 | $isempty = [string]::IsNullOrEmpty($v) 133 | if ($isempty -eq $true) { 134 | $version = $this.frameStyle.LEFTSPLIT, "Debug", $this.frameStyle.RIGHTSPLIT -join "" 135 | } 136 | [System.Console]::setcursorposition($this.W - ($version.Length + 6), $this.Y ) 137 | [console]::write($version) 138 | } 139 | 140 | [void] drawTitle() { 141 | if ($this.title -ne "") { 142 | $local:X = $this.x + 2 143 | $this.setPosition($local:X, $this.Y) 144 | Write-Host ($this.frameStyle.LEFTSPLIT, " " -join "") -NoNewline -ForegroundColor $this.frameColor 145 | $local:X = $local:X + 2 146 | $this.setPosition($local:X, $this.Y) 147 | Write-Host $this.title -NoNewline -ForegroundColor $this.titleColor 148 | $local:X = $local:X + $this.title.Length 149 | $this.setPosition($local:X, $this.Y) 150 | Write-Host (" ", $this.frameStyle.RIGHTSPLIT -join "") -NoNewline -ForegroundColor $this.frameColor 151 | } 152 | } 153 | 154 | [void] drawFooter() { 155 | $Y2 = $this.Y + $this.H 156 | $this.setPosition( $this.X, $Y2) 157 | $bloc1 = $this.frameStyle.BL, "".PadLeft($this.W - 2, $this.frameStyle.BOTTOM), $this.frameStyle.BR -join "" 158 | Write-Host $bloc1 -ForegroundColor $this.frameColor -NoNewline 159 | if ($this.footer -ne "") { 160 | $local:x = $this.x + 2 161 | $local:Y = $this.Y + $this.h 162 | $this.setPosition($local:X, $local:Y) 163 | $foot = $this.frameStyle.LEFTSPLIT, " ", $this.footer, " ", $this.frameStyle.RIGHTSPLIT -join "" 164 | [console]::write($foot) 165 | } 166 | } 167 | 168 | [void] drawPagination() { 169 | $sPages = ('Page {0}/{1}' -f ($this.page, $this.nbPages)) 170 | [System.Console]::setcursorposition($this.W - ($sPages.Length + 6), $this.Y + $this.H) 171 | [console]::write($sPages) 172 | } 173 | 174 | [void] clearWindow() { 175 | $local:blank = "".PadLeft($this.W, " ") 176 | for ($i = 1; $i -lt $this.H; $i++) { 177 | $this.setPosition(($this.X), ($this.Y + $i)) 178 | Write-Host $blank 179 | } 180 | } 181 | } -------------------------------------------------------------------------------- /Winget-posh/wingetposh.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/Winget-posh/wingetposh.ico -------------------------------------------------------------------------------- /Winget-posh/wingetposh.psd1: -------------------------------------------------------------------------------- 1 | # 2 | # Module manifest for module 'wingetposh' 3 | # 4 | # Generated by: yvesg 5 | # 6 | # Generated on: 20-11-22 7 | # 8 | 9 | @{ 10 | 11 | # Script module or binary module file associated with this manifest. 12 | RootModule = 'wingetposh.psm1' 13 | 14 | # Version number of this module. 15 | ModuleVersion = '2.0.1' 16 | 17 | # Supported PSEditions 18 | # CompatiblePSEditions = @() 19 | 20 | # ID used to uniquely identify this module 21 | GUID = 'f1f782ec-e131-4e03-b909-8a60e5aeb49b' 22 | 23 | # Author of this module 24 | Author = 'yvesg' 25 | 26 | # Company or vendor of this module 27 | CompanyName = 'Unknown' 28 | 29 | # Copyright statement for this module 30 | Copyright = '(c) yvesg. All rights reserved.' 31 | 32 | # Description of the functionality provided by this module 33 | Description = 'Helpers functions for Winget' 34 | 35 | # Minimum version of the PowerShell engine required by this module 36 | PowerShellVersion = '5.1' 37 | 38 | # Name of the PowerShell host required by this module 39 | # PowerShellHostName = '' 40 | 41 | # Minimum version of the PowerShell host required by this module 42 | # PowerShellHostVersion = '' 43 | 44 | # Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. 45 | # DotNetFrameworkVersion = '' 46 | 47 | # Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. 48 | # ClrVersion = '' 49 | 50 | # Processor architecture (None, X86, Amd64) required by this module 51 | # ProcessorArchitecture = '' 52 | 53 | # Modules that must be imported into the global environment prior to importing this module 54 | #RequiredModules = @('Microsoft.PowerShell.ConsoleGuiTools') 55 | 56 | # Assemblies that must be loaded prior to importing this module 57 | # RequiredAssemblies = @() 58 | 59 | # Script files (.ps1) that are run in the caller's environment prior to importing this module. 60 | ScriptsToProcess = @('tools\install.ps1') 61 | 62 | # Type files (.ps1xml) to be loaded when importing this module 63 | # TypesToProcess = @() 64 | 65 | # Format files (.ps1xml) to be loaded when importing this module 66 | # FormatsToProcess = @() 67 | 68 | # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess 69 | # NestedModules = @() 70 | 71 | # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. 72 | FunctionsToExport = @('Get-WGPackage', 73 | 'Invoke-Winget', 74 | 'Out-Object', 75 | 'Out-JSON', 76 | 'Search-WGPackage', 77 | 'Uninstall-WGPackage', 78 | 'Update-WGPackage', 79 | 'Install-WGPackage', 80 | 'Show-WGList', 81 | 'Get-WGList', 82 | 'Get-WGSources', 83 | "Set-WingetPoshConfig", 84 | "Get-WingetPoshConfig", 85 | "Reset-WingetposhConfig", 86 | "Get-WingetposhConfig", 87 | "Get-WGPVersion", 88 | "Build-WGInstallFile", 89 | "Start-Gui" ) 90 | 91 | # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. 92 | CmdletsToExport = @() 93 | 94 | # Variables to export from this module 95 | VariablesToExport = '*' 96 | 97 | # Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. 98 | AliasesToExport = @() 99 | 100 | # DSC resources to export from this module 101 | # DscResourcesToExport = @() 102 | 103 | # List of all modules packaged with this module 104 | # ModuleList = @() 105 | 106 | # List of all files packaged with this module 107 | FileList = @( 108 | 'visuals.ps1', 109 | 'wingetposh.psm1', 110 | 'WingetPoshGui.exe' 111 | ) 112 | 113 | # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. 114 | PrivateData = @{ 115 | 116 | PSData = @{ 117 | 118 | # Tags applied to this module. These help with module discovery in online galleries. 119 | Tags = @('winget','helper','powershell', 'TUI', 'Package', 'Manager') 120 | 121 | # A URL to the license for this module. 122 | LicenseUri = 'https://github.com/Yves848/WingetPosh/blob/master/licence.txt' 123 | 124 | # A URL to the main website for this project. 125 | ProjectUri = 'https://github.com/Yves848/WingetPosh/tree/Delphi-GUI' 126 | 127 | # A URL to an icon representing this module. 128 | IconUri = 'https://raw.githubusercontent.com/Yves848/WingetPosh/master/Winget-posh/wingetposh2.ico' 129 | 130 | # ReleaseNotes of this module 131 | ReleaseNotes = 'https://github.com/Yves848/WingetPosh/blob/0.9.8-(scoop-integration)/readme.md' 132 | 133 | 134 | # Prerelease string of this module 135 | Prerelease = 'alpha03' 136 | 137 | # Flag to indicate whether the module requires explicit user acceptance for install/update/save 138 | # RequireLicenseAcceptance = $true 139 | 140 | # External dependent modules of this module 141 | # ExternalModuleDependencies = @() 142 | 143 | } # End of PSData hashtable 144 | 145 | } # End of PrivateData hashtable 146 | 147 | # HelpInfo URI of this module 148 | # HelpInfoURI = '' 149 | 150 | # Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. 151 | # DefaultCommandPrefix = '' 152 | 153 | } 154 | 155 | -------------------------------------------------------------------------------- /Winget-posh/wingetposh2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/Winget-posh/wingetposh2.ico -------------------------------------------------------------------------------- /alpha/A_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/alpha/A_01.png -------------------------------------------------------------------------------- /alpha/A_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/alpha/A_02.png -------------------------------------------------------------------------------- /alpha/A_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/alpha/A_03.png -------------------------------------------------------------------------------- /alpha/A_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/alpha/A_04.png -------------------------------------------------------------------------------- /alpha/A_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/alpha/A_05.png -------------------------------------------------------------------------------- /alpha/A_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/alpha/A_06.png -------------------------------------------------------------------------------- /alpha/A_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/alpha/A_07.png -------------------------------------------------------------------------------- /alpha/A_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/alpha/A_08.png -------------------------------------------------------------------------------- /alpha/A_09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/alpha/A_09.png -------------------------------------------------------------------------------- /demo.md: -------------------------------------------------------------------------------- 1 | get-command -module wingetposh 2 | show-wglist 3 | Set-WingetposhConfig -param UseNerdFont -value $true 4 | show-wglist 5 | show-wglist | out-object 6 | show-wglist | out-object | Select-Object -Property id 7 | get-wglist 8 | Get-WGList | Out-Object 9 | Get-WGList | Out-Object | Select-Object -Property id 10 | Get-WGList | Out-Object | Where-Object {$_.id -like "Microsoft*"} 11 | Search-WGPackage -package code 12 | Search-WGPackage -package code | Out-Object 13 | Search-WGPackage -package code | Out-Object | Select-Object -Property id 14 | Install-WGPackage 15 | Install-WGPackage -package -source winget 16 | Get-WGSources 17 | Set-WingetposhConfig -param SilentInstall -value $true 18 | Install-WGPackage -package notepad 19 | Build-WGInstallFile - 20 | Invoke-Winget "winget list" 21 | Invoke-Winget "winget list" | Out-Object 22 | Invoke-Winget "winget list" | Out-Object | Where-Object {$_.Nom -like "*code*"} 23 | Get-WGList -quiet $true | Out-JSON 24 | Search-WGPackage "cpu-z,notepad++" -quiet $true | Out-JSON 25 | clear -------------------------------------------------------------------------------- /history.md: -------------------------------------------------------------------------------- 1 | ### 0.5.1 : 2 | - Fixed the show-WGList bug when there is no updatable packages to show. 3 | ### 0.5.2 : 4 | - Removed the "-Interactive" switch to search-WGPackage. 5 | - Removed the search parameter from search-WGPackage. 6 | - Allowing multiple selection in uninstall-WGPackage. 7 | - Removing crash brug when no package is found in search-WGPackage. 8 | - Removing the "-Interactive" switch to updage-WGPackage. If no Object is passed through the pipeline, it will automatically display an interactive grid 9 | - Update readme.md 10 | 11 | ### 0.5.4 : 12 | - Addind a license file. 13 | 14 | ### 0.5.5 : 15 | - Adding license acceptance when installing module 16 | 17 | ### 0.5.6 : 18 | - Adding headless functions : Get-WGList and Get-WGUpdatables 19 | 20 | ### 0.6.0 : 21 | - Removing "Microsoft.PowerShell.ConsoleGuiTools" dependance to add Powershell 5.1 compatibility 22 | - Rewriting the TUI in full powershell (some flickering still to fix) 23 | - Adding "Invoke-Winget" funtion to add generic call to Winget 24 | 25 | ### 0.6.1 : 26 | - Fix -Install switch of Install-WGPAckage 27 | - Rename Show-WGUpdatables to Update-WGPackages 28 | - Add a switch -Update to Update-WGPackages 29 | 30 | ### 0.6.2 : 31 | - Fix flickering 32 | - rename Update-WGPackages to Update-WGPackage for uniformity 33 | - in Install-WGPackage, F3 allows to run a new search 34 | - Version of the module shown in the window frame 35 | 36 | ### 0.6.3 : 37 | - remove the module version of the window frame 38 | 39 | ### 0.6.4 : 40 | - Add '+' and '-' keys for selections in the grid 41 | - Version of the module shown in the window frame (back) 42 | - add "?" to display help 43 | 44 | ### 0.6.5 : 45 | - refine windows drawing 46 | - add a "package" parameter to Install-WGPackage 47 | 48 | ### 0.6.6 : 49 | - Correctiong bugs in install, uninstall and update functions 50 | - Fixing the order of the install-WGPackage parameters 51 | 52 | ### 0.7.0 : 53 | - Changing search mode. Now the search is on everything, not only the name 54 | - Improving winget result parsing 55 | - Every function now returns a hastable. Faster, lighter 56 | - Adding a "Out-Object" function to convert hashtable results in PsCustomObject arrays (if needed) 57 | - Adding a "Search-WGPackage" to search without the graphical interface 58 | 59 | ### 0.7.2 : 60 | - Minor bug fixes 61 | 62 | ### 0.7.3 : 63 | - fixing visual function (using hastables) 64 | 65 | ### 0.7.4 : 66 | - fixing bug with visual functions returning multiple objects 67 | 68 | ### 0.7.5 : 69 | - Fixing the update-wgpackage when multiple packages selected 70 | 71 | ### 0.7.9 : 72 | - Start Using runspaces to multitask the module. 73 | First usage is for animating the waitings. 74 | Last version before heavy code restucture / rewrite 75 | - Small visual improvements 76 | 77 | ### 0.8.0 (beta): 78 | - Rewrite of the parsing module. 79 | - Now, parsing successfuly multibytes characters (eg : kanji) 80 | - Using more animations for the long running tasks (runspaces) 81 | - More parameters to the functions and more error tracking. 82 | - Using localized resources from winget repository 83 | - Many bug fixes. 84 | - No more fixes to the 0.7.9 => Merging 0.8.0 to master 85 | ### 0.8.1 : 86 | - Using function from PSReadLine for the texts inputs (Allows 'Esc' to cancel editing) 87 | - Small visual changes to the interactive parts 88 | - in grids, **F2** cycles instantly through the sources availables 89 | - '?' displays a small help message on the screen 90 | - Introdution of an config file and a "localization" file. (~/.config/.wingetposh) 91 | 92 | ### 0.9.1 : 93 | - Fixing bug when downloading localized resources on non English Windows. 94 | 95 | ### 0.9.7 : 96 | - Removing licence acceptance at installation 97 | - Only download ressource once for a version. 98 | - Add function **Get-WGPVersions" to display Winget and/or WGP versions. 99 | - Updating Readme and screenshots. 100 | ### 1.0.0 : 101 | - Changed the download resources method. Now based on the "master" branch of Winget 102 | - Uninstall-WGPackage is deprecated => Show-WGList 103 | - Update-WGPackage is deprecated => Show-WGList 104 | - Install-WGPackage accept multiple keywords to perform multiple installations at once 105 | - Scoop Integration 106 | - Build-WGInstallFile is added to generate a config file (json) to replicate install on other machines 107 | - Readme updated 108 | - Use of multiple runspaces (display and invokes) 109 | - Bug fixes 110 | ### 1.0.1 : 111 | - fixing a bug on Windows 10 when installing the module. Now, it correctly download the resources. -------------------------------------------------------------------------------- /images/001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/001.png -------------------------------------------------------------------------------- /images/002-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/002-2.png -------------------------------------------------------------------------------- /images/002.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/002.png -------------------------------------------------------------------------------- /images/003.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/003.png -------------------------------------------------------------------------------- /images/004.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/004.png -------------------------------------------------------------------------------- /images/005.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/005.png -------------------------------------------------------------------------------- /images/006-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/006-1.png -------------------------------------------------------------------------------- /images/006-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/006-2.png -------------------------------------------------------------------------------- /images/006-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/006-3.png -------------------------------------------------------------------------------- /images/006-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/006-4.png -------------------------------------------------------------------------------- /images/006-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/006-5.png -------------------------------------------------------------------------------- /images/006.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/006.png -------------------------------------------------------------------------------- /images/007.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/007.png -------------------------------------------------------------------------------- /images/008.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/008.png -------------------------------------------------------------------------------- /images/009.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/009.png -------------------------------------------------------------------------------- /images/010.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/010.png -------------------------------------------------------------------------------- /images/011.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/011.png -------------------------------------------------------------------------------- /images/012.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/012.png -------------------------------------------------------------------------------- /images/013.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/013.png -------------------------------------------------------------------------------- /images/014.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/014.png -------------------------------------------------------------------------------- /images/A_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/A_01.png -------------------------------------------------------------------------------- /images/A_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/A_02.png -------------------------------------------------------------------------------- /images/A_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/A_03.png -------------------------------------------------------------------------------- /images/A_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/A_04.png -------------------------------------------------------------------------------- /images/A_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/A_05.png -------------------------------------------------------------------------------- /images/A_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/A_06.png -------------------------------------------------------------------------------- /images/A_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/A_07.png -------------------------------------------------------------------------------- /images/A_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/A_08.png -------------------------------------------------------------------------------- /images/A_09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/A_09.png -------------------------------------------------------------------------------- /images/Miniature.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/Miniature.png -------------------------------------------------------------------------------- /images/Wingetposh (2).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/Wingetposh (2).png -------------------------------------------------------------------------------- /images/Wingetposh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/Wingetposh.png -------------------------------------------------------------------------------- /images/WingetposhLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/WingetposhLogo.png -------------------------------------------------------------------------------- /images/img1-0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/img1-0.png -------------------------------------------------------------------------------- /images/img1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/img1.png -------------------------------------------------------------------------------- /images/img10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/img10.png -------------------------------------------------------------------------------- /images/img11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/img11.png -------------------------------------------------------------------------------- /images/img2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/img2.png -------------------------------------------------------------------------------- /images/img3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/img3.png -------------------------------------------------------------------------------- /images/img4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/img4.png -------------------------------------------------------------------------------- /images/img5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/img5.png -------------------------------------------------------------------------------- /images/img6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/img6.png -------------------------------------------------------------------------------- /images/img7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/img7.png -------------------------------------------------------------------------------- /images/img8-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/img8-1.png -------------------------------------------------------------------------------- /images/img8-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/img8-2.png -------------------------------------------------------------------------------- /images/img8-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/img8-3.png -------------------------------------------------------------------------------- /images/img8-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/img8-4.png -------------------------------------------------------------------------------- /images/img8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/img8.png -------------------------------------------------------------------------------- /images/img9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yves848/WingetPosh/b5a3b26d2c8ad7c35b091572d2ca65c886c945fc/images/img9.png -------------------------------------------------------------------------------- /publish.ps1: -------------------------------------------------------------------------------- 1 | $content = Import-PowerShellDataFile .\Winget-posh\wingetposh.psd1 2 | if ($content.PrivateData.PSData.Prerelease) { 3 | $versionP = "$($content.ModuleVersion)","$($content.PrivateData.PSData.Prerelease)" -join "-" 4 | $preRelease = $true 5 | } 6 | else { 7 | $versionP = "$($content.ModuleVersion)" 8 | $preRelease = $false 9 | } 10 | 11 | $version = "$($content.ModuleVersion)" 12 | 13 | $folder = "C:\Users\yvesg\Documents\PowerShell\Modules\$(split-path $content.RootModule -LeafBase)",$version -join "\" 14 | $env:NUGET_CLI_LANGUAGE="en_US" 15 | 16 | Write-Host "Module folder : $folder" 17 | 18 | 19 | if ((Test-Path -Path $folder) -ne $true) { 20 | mkdir -Path $folder 21 | } 22 | 23 | Copy-Item -Path ".\Winget-posh\*" -Destination "$folder\" -Force -Recurse 24 | 25 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 26 | $pskey = Get-Content ~\.config\.private\apikey.txt 27 | Import-Module PowerShellGet 28 | $params = @{ 29 | Name = "wingetposh" 30 | NuGetApiKey = $pskey 31 | Verbose = $true 32 | RequiredVersion = $versionP 33 | AllowPrerelease = $preRelease 34 | } 35 | 36 | Publish-Module @params -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | ![](./images/Wingetposh.png) 2 | *** 3 | ## Demo 4 | https://youtu.be/rH9PcEj8u5A 5 | 6 | 7 | A set of functions to help using winget. 8 | 9 | Entirely written in __Powershell__, it has 2 types of functions : visuals and non visuals. 10 | 11 | No dependencies are used to ensure compatibility with Powershell 5.1 12 | 13 | *** 14 | ## Remaks : 15 | The goal of this module is not really the same as *Microsoft.WinGet.Client* 16 | 17 | Basically, it was focused on the "graphical interface" aspect. The "parsing" part was added naturally. 18 | Unlike the official module, it is 100% written in Powershell in order to be compatible with version 5.1 and requires NO external dependency. 19 | 20 | But, in the end, it offers the same functionalities, new ones will be added to it as time goes on. (Scoop support, .....) 21 | *** 22 | The availablle functions are : 23 | - Get-WGPackage [-source] [-interactive] [-uninstall] [-update] [-apply] 24 | - Search-WGPackage [-package "search terms"] [-source "source"] [-interactive] [-install] [-allowsearch] 25 | - Get-WGList [-source "source"] 26 | - Get-WGSources 27 | - Install-WGPackage [-package] [-source] [-silent] [-acceptpackageagreements] [acceptsourceagreements] 28 | - Invoke-Winget 29 | - Out-Object 30 | - Show-WGList 31 | - Uninstall-WGPackage *(deprecated)* 32 | - Update-WGPackage [-Update] *(deprecated)* 33 | - Set-WingetposhConfig -param -value 34 | - Get-WingetposhConfig [-display] 35 | - Reset-WingetposhConfig 36 | - Get-WGPVersions [-param] 37 | - Build-WGInstallFile [-file] 38 | 39 | 40 | Starting with version 1.0.0, **Scoop** (if present) is supported. 41 | This is a limited support but it will grow with the next versions of WingetPosh. 42 | 43 | When the module is imported for the first time, Scoop is detected and if present, his usage is flagged in the config file. 44 | 45 | Scoop integration can be activated or deactivated with : 46 | ``` Powershell 47 | Set-WingetposhConfig -param includeScoop $True / $False 48 | ``` 49 | *** 50 | ## Installation 51 | 52 | ``` Powershell 53 | Install-Module -Name wingetposh -Scope CurrentUser 54 | ``` 55 | # IMPORTANT 56 | Don't forget to import the module after the installation ! 57 | *Ideally, put it in your profile file ($PROFILE)* 58 | When it's imported, the localized resources are downloaded from the winget repository. 59 | 60 | ### Remark : 61 | To install in powershell 5.1, you need to install the latest "PowershellGet" 62 | ``` Powershell 63 | Install-Module PowerShellGet -AllowClobber -Force 64 | ``` 65 | 66 | Close and re-open the powershell 5.1 terminal to make changes effective. 67 | *** 68 | 69 | ## History 70 | See [History.md](./history.md) for the complete module history. 71 | 72 | There is a "?" on the bottom of the window, for interactive commands. 73 | Pressing "?" displays a "help" in the context of the running command. 74 | 75 | ``` Powershell 76 | Get-Command -module wingetposh 77 | ``` 78 | ![](./images/001.png) 79 | 80 | ## Get-WGPackage 81 | 82 | ``` 83 | Get-WGPackage [-source] [-interactive] [-uninstall] [-update] [-apply] 84 | ``` 85 | - -source : Specify the source to filter on 86 | - -interactive : Switch that command the display of the GUI 87 | - -uninstall : switch to specify if the selected packages will be uninstalled 88 | - -update : switch to specify if the selected packages will be updated 89 | - -apply : additionnal switch to confirm -uninstall & -update 90 | 91 | ### Examples 92 | 93 | ``` powershell 94 | Get-WGPackage -source winget 95 | ``` 96 | Get a hashtable with the installed packages, filtered on the source "winget" 97 | 98 | ``` powershell 99 | Get-WGPackage -source winget | Out-Object 100 | ``` 101 | Get an Object (or an array of objects) with the installed packages, filtered on the source "winget" 102 | 103 | ## Search-Package 104 | 105 | ``` 106 | Search-WGPackage "package" [-source] [-interactive] [-install] [-allowsearch] 107 | ``` 108 | - -source : Specify the source to filter on 109 | - -interactive : Switch that command the display of the GUI 110 | - -install : Lauch the installation of the selected packages 111 | - -allowsearch : Allow to search on new keywords by pressing "F3" in the grid. 112 | 113 | ### Examples 114 | 115 | ``` powershell 116 | Search-WGPackage notepad -source winget | Out-Object | Select-Object -Property id 117 | ``` 118 | 119 | ![](./images/A_07.png) 120 | 121 | ``` Powershell 122 | Show-WGList 123 | ``` 124 | ![image1](./images/002.png) 125 | 126 | This screen allow to select (Space) the package for which information will be returned. 127 | It is also possible to flag some packages for uninstallation (with "Del") and for update (with "u") 128 | **Note:** Only updatable packages will be available to update. 129 | Pressing "Ctrl-U" will flag every updatable package to be updated. 130 | 131 | Info, Uninstall and Update can be combined. 132 | 133 | ![image2](./images/002-2.png) 134 | 135 | Pressing enter launches the process. (See demo vidéo) 136 | 137 | ![](./images/003.png) 138 | When Hit return ..... 139 | ![](./images/004.png) 140 | 141 | The result is an array of PSObject 142 | 143 | And, of course, we can pipe this result to perform additionnal operations ..... 144 | 145 | ``` Powershell 146 | Show-WGList | Select-Object -Property id 147 | ``` 148 | 149 | ![](./images/006.png) 150 | 151 | *** 152 | ## Search Packages 153 | The -Package parameter is not mandatory. 154 | If omitted, wingetposh will display a popup to enter the packages to search. 155 | 156 | ``` Powershell 157 | Search-WGPackage 158 | ``` 159 | Search-WGPackage now accept multiple search keys. They must be comma-separated. 160 | If the "-package" switch is used, the search string must be quoted. 161 | If the interactive search is used, no quotes needed. 162 | 163 | ![](./images/006-1.png) 164 | ![](./images/006-3.png) 165 | 166 | *** 167 | 168 | ## Converting results to PSCustomObject arrays 169 | 170 | ``` Powershell 171 | Search-WGPackage -package "cpu-z,git" | Out-Object 172 | ``` 173 | 174 | *** 175 | 176 | ## Search and install a package 177 | 178 | Just as Search-WGPackage, Install-WGPackage now accept multiple search keys. They must be comma-separated. 179 | If the "-package" switch is used, the search string must be quoted. 180 | If the interactive search is used, no quotes needed. 181 | 182 | If no **-package** parameter is specified, the function will popup a window to enter the terms to search. 183 | 184 | The source can be specified to limit the number of results. EG : *-source winget* 185 | 186 | ``` Powershell 187 | Install-WGPackage 188 | ``` 189 | 190 | ![image8](./images/007.png) 191 | 192 | ![image8-1](./images/006-2.png) 193 | 194 | If no source is specified, the display grid will allow to filter the sources by pressing **F2** key. 195 | 196 | ![image8-2](./images/006-4.png) 197 | 198 | Multiple packages, from multiple source can be selected at once to install. 199 | 200 | ![image8-5](./images/006-5.png) 201 | 202 | *** 203 | 204 | ## ~~Select and update an installed package~~ 205 | **(Deprecated)** 206 | 207 | To confirm the update, the *-apply* switch must be provided. Otherwise, the function will only return a list of the selected packages. 208 | 209 | 210 | ```Powershell 211 | Update-WGPackage -source winget -apply 212 | ``` 213 | 214 | *** 215 | 216 | ## Building a config file to replicate packages installation 217 | 218 | ``` Powershell 219 | Build-WGInstallFile -file RyzenConfig.json 220 | ``` 221 | This function will display a grid similar to **Show-WGList". 222 | But when confirmed with "Enter", the function will generate a JSON config file with every package informations. 223 | This file can be used for future installation or replication of the same package list. 224 | 225 | If no "-file" parameter is present, the defaut config file is "WGConfig.json" 226 | 227 | **Remark :** The import function will be soon available in a next beta version. 228 | 229 | *** 230 | 231 | ## ~~Select and uninstall an installed package~~ 232 | **(Deprecated)** 233 | 234 | To confirm the update, the *-apply* switch must be provided. Otherwise, the function will only return a list of the selected packages. 235 | ``` Powershell 236 | Uninstall-WGPackage -source winget -apply 237 | ``` 238 | 239 | ## Generic function to convert winget results to PSCustomObject 240 | 241 | ``` Powershell 242 | Invoke-Winget "winget list" | Out-Object | Where-Object {$_.Name -like "*code*"} 243 | ``` 244 | ![image11](./images/011.png) 245 | 246 | # Configuration 247 | 248 | Starting 0.8.0-beta5 version, a config file is used to store some global parameters. 249 | The file is stored in 250 | ``` powershell 251 | $env:USERPROFILE/.config/.wingetposh/config.json 252 | ``` 253 | ![image11](./images/012.png) 254 | 255 | ## Set an option 256 | Change the value of an option in the config file 257 | 258 | ## Example 259 | To allow the use of nerd font special characters in the grid, change the option "UseNerdFont" to true 260 | ``` Powershell 261 | Set-WingetposhConfig -param UseNerdFont -value $true 262 | ``` 263 | 264 | To force silent installation of packages, set "SilentInstall" to true 265 | ``` powershell 266 | Set-WingetposhConfig -param SilentInstall -value $true 267 | ``` 268 | 269 | ## Reset the config file 270 | Reset to default every options in the config file 271 | 272 | ``` Powershell 273 | Reset-WingetposhConfig 274 | ``` 275 | 276 | ## Display the options of the confid file 277 | Display the value of the options in the config file 278 | 279 | ``` Powershell 280 | Get-WingetposhConfig -display 281 | ``` 282 | ![image13](./images/013.png) 283 | 284 | ## Get-WGPVersions -param All 285 | Display Winget and WingetPosh versions 286 | Available parameters : "All", "Winget", "WGP" 287 | ``` Powershell 288 | Get-WGPVersions -param All 289 | ``` 290 | ![image14](./images/014.png) --------------------------------------------------------------------------------