diff --git a/.gitattributes b/.gitattributes index 4160f58..31043c1 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,3 @@ * text=auto *.ps1 eol=crlf +*.sh eol=lf diff --git a/.gitignore b/.gitignore index 3c4efe2..ed2823e 100644 --- a/.gitignore +++ b/.gitignore @@ -258,4 +258,7 @@ paket-files/ # Python Tools for Visual Studio (PTVS) __pycache__/ -*.pyc \ No newline at end of file +*.pyc + +# Signatures +*.sig diff --git a/Fido.ps1 b/Fido.ps1 index 973b6c4..f5a3fe4 100644 --- a/Fido.ps1 +++ b/Fido.ps1 @@ -1,5 +1,5 @@ # -# Fido - Retail Windows ISO Downloader +# Fido v1.01 - Retail Windows ISO Downloader # Copyright © 2019 Pete Batard # ConvertTo-ImageSource: Copyright © 2016 Chris Carter # @@ -22,21 +22,17 @@ #region Parameters param( + # (Optional) The title to display on the application window. + [string]$AppTitle = "Fido - Retail Windows ISO Downloader", + # (Optional) '|' separated UI localization strings. + [string]$LocData, + # (Optional) Path to a file that should be used for the UI icon. + [string]$Icon, # (Optional) Name of a pipe the download URL should be sent to. # If not provided, a browser window is opened instead. [string]$PipeName, - # (Optional) '|' separated UI localization strings. - [string]$LocData, - # (Optional) Path to the file that should be used for the UI icon. - [string]$Icon, - # (Optional) The title to display on the application window - [string]$AppTitle = "Fido - Retail Windows ISO Downloader", - # (Optional) Whether to show the "Download in a browser" checkbox - [switch]$ShowBrowserOption = $True, - # (Optional) Test/Debug options - [switch]$Debug = $False, - [switch]$Expert = $False, - [switch]$Testing = $False + # (Optional) Toggle expert mode (additional ISOs to choose). + [switch]$Expert = $False ) #endregion @@ -61,8 +57,6 @@ $code = @" if (!File.Exists(muiPath)) muiPath = Environment.SystemDirectory + @"\en-US\" + dll + ".mui"; IntPtr hMui = LoadLibrary(muiPath); - if (hMui == null) - return ""; StringBuilder szString = new StringBuilder(MAX_PATH); LoadString(hMui, (uint)index, szString, MAX_PATH); return szString.ToString(); @@ -296,9 +290,9 @@ function Add-Entry([int]$pos, [string]$Name, [array]$Items, [string]$DisplayName $XMLGrid.Children.Insert(2 * $Stage + 3, $Combo) $XMLForm.Height += $dh; - $Margin = $Confirm.Margin + $Margin = $Continue.Margin $Margin.Top += $dh - $Confirm.Margin = $Margin + $Continue.Margin = $Margin $Margin = $Back.Margin $Margin.Top += $dh $Back.Margin = $Margin @@ -308,7 +302,7 @@ function Add-Entry([int]$pos, [string]$Name, [array]$Items, [string]$DisplayName function Refresh-Control([object]$Control) { - $Control.Dispatcher.Invoke("Render", [Windows.Input.InputEventHandler] { $Confirm.UpdateLayout() }, $null, $null) + $Control.Dispatcher.Invoke("Render", [Windows.Input.InputEventHandler] { $Continue.UpdateLayout() }, $null, $null) } function Send-Message([string]$PipeName, [string]$Message) @@ -316,7 +310,6 @@ function Send-Message([string]$PipeName, [string]$Message) [System.Text.Encoding]$Encoding = [System.Text.Encoding]::UTF8 $Pipe = New-Object -TypeName System.IO.Pipes.NamedPipeClientStream -ArgumentList ".", $PipeName, ([System.IO.Pipes.PipeDirection]::Out), ([System.IO.Pipes.PipeOptions]::None), ([System.Security.Principal.TokenImpersonationLevel]::Impersonation) try { - Write-Host Connecting to $PipeName $Pipe.Connect(1000) } catch { Write-Host $_.Exception.Message @@ -378,12 +371,12 @@ function Error([string]$ErrorMessage) Write-Host $ErrorMessage $XMLForm.Title = $(Get-Translation("Error")) + ": " + $ErrorMessage Refresh-Control($XMLForm) - $Confirm.Content = Get-Translation("Close") - Refresh-Control($Confirm) + $Continue.Content = Get-Translation("Close") + Refresh-Control($Continue) $UserInput = [System.Windows.MessageBox]::Show($XMLForm.Title, $(Get-Translation("Error")), "OK", "Error") $script:ExitCode = $Stage $script:Stage = -1 - $Confirm.IsEnabled = $True + $Continue.IsEnabled = $True } #endregion @@ -391,7 +384,7 @@ function Error([string]$ErrorMessage) [xml]$XAML = @" -