Add folder selection for portable installation

This commit is contained in:
sk82jack
2018-12-11 16:47:53 +00:00
parent 6cc1cb5afa
commit 534c622980

View File

@@ -17,6 +17,23 @@ foreach ($Path in 'HKLM:\SOFTWARE\WOW6432Node\mRemoteNG', 'HKLM:\SOFTWARE\mRemot
continue
}
}
if (!$mRNGPath) {
Add-Type -AssemblyName System.Windows.Forms
$FolderBrowser = [System.Windows.Forms.FolderBrowserDialog]@{
Description = 'Please select the folder which contains mRemoteNG.exe'
ShowNewFolderButton = $false
}
$Response = $FolderBrowser.ShowDialog()
if ($Response.value__ -eq 1) {
$mRNGPath = $FolderBrowser.SelectedPath
}
elseif ($Response.value__ -eq 2) {
Write-Warning 'A folder containing mRemoteNG.exe has not been selected'
return
}
}
$null = [System.Reflection.Assembly]::LoadFile((Join-Path -Path $mRNGPath -ChildPath "mRemoteNG.exe"))
Add-Type -Path (Join-Path -Path $mRNGPath -ChildPath "BouncyCastle.Crypto.dll")