|
|
@@ -1,19 +1,21 @@
|
|
|
|
|
|
Add-Type -AssemblyName "System.Windows.Forms"
|
|
|
|
|
|
-Function BecomeAdmin($invocation){
|
|
|
+$PSScriptRoot |Out-Host
|
|
|
+
|
|
|
+Function BecomeAdmin($script){
|
|
|
if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
|
|
|
{
|
|
|
- $arguments = "-ExecutionPolicy Bypass & '" +$invocation.mycommand.definition + "'"
|
|
|
+ $arguments = "-ExecutionPolicy Bypass & '" +$env:WINIMAGER + "' -Script " + $script
|
|
|
Hide-Console
|
|
|
Start-Process powershell -Wait -Verb runAs -ArgumentList $arguments
|
|
|
Break
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-Function LogFilePath($invocation,$name){
|
|
|
+Function LogFilePath($name){
|
|
|
$logfilename = $name+"_"+([System.DateTime]::Now).ToFileTime()+".log"
|
|
|
- [System.IO.Path]::Combine($invocation.MyCommand.Definition, "..", "..","log", $logfilename)
|
|
|
+ [System.IO.Path]::Combine($PSScriptRoot, "log", $logfilename)
|
|
|
}
|
|
|
|
|
|
Function GuiMessageBox
|
|
|
@@ -136,7 +138,7 @@ Function GuiSaveFileName
|
|
|
param(
|
|
|
$initialDirectory = "C:\",
|
|
|
$title = "Save Image File",
|
|
|
- $filter = "Images (*.img;*.afp;*.usb;*.iso)| *.img;*.afp;*.usb;*.iso"
|
|
|
+ $filter = "Images (*.img;*.afp;*.raw;*.usb;*.iso)| *.img;*.afp;*.raw;*.usb;*.iso"
|
|
|
)
|
|
|
$SaveFileDialog = New-Object System.Windows.Forms.SaveFileDialog
|
|
|
$SaveFileDialog.initialDirectory = $initialDirectory
|
|
|
@@ -146,12 +148,17 @@ Function GuiSaveFileName
|
|
|
$SaveFileDialog.filename
|
|
|
}
|
|
|
|
|
|
-Function GuiOpenFileName($initialDirectory = "C:\", $title = "Select Image File")
|
|
|
+Function GuiOpenFileName
|
|
|
{
|
|
|
+ param(
|
|
|
+ $initialDirectory = "C:\",
|
|
|
+ $title = "Select Image File",
|
|
|
+ $filter = "Images (*.img;*.afp;*.raw;*.usb;*.iso)| *.img;*.afp;*.raw;*.usb;*.iso"
|
|
|
+ )
|
|
|
|
|
|
$OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
|
|
|
$OpenFileDialog.initialDirectory = $initialDirectory
|
|
|
- $OpenFileDialog.filter = "Images (*.img;*.afp;*.usb;*.iso)| *.img;*.afp;*.usb;*.iso|All files (*.*)| *.*"
|
|
|
+ $OpenFileDialog.filter = $filter + "|All files (*.*)| *.*"
|
|
|
$OpenFileDialog.Title = $title
|
|
|
$OpenFileDialog.ShowDialog() | Out-Null
|
|
|
$OpenFileDialog.filename
|