diff --git a/winutil.ps1 b/winutil.ps1
index ffd2cd4b..4dc821c7 100644
--- a/winutil.ps1
+++ b/winutil.ps1
@@ -2307,6 +2307,36 @@ Function Update-WinUtilProgramWinget {
$global:WinGetInstall = Start-Process -Verb runas powershell -ArgumentList "-command invoke-command -scriptblock {$wingetinstall} -argumentlist '$($ProgramsToInstall -join ",")'" -PassThru
+}
+
+function Invoke-ScratchDialog {
+
+ <#
+
+ .SYNOPSIS
+ Enable Editable Text box Alternate Scartch path
+
+ .PARAMETER Button
+ #>
+ $sync.WPFMicrowinISOScratchDir.IsChecked
+
+
+ [System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null
+ $Dialog = New-Object System.Windows.Forms.FolderBrowserDialog
+ $Dialog.SelectedPath = $sync.MicrowinScratchDirBox.Text
+ $DialogShowNewFolderButton = $true
+ $Dialog.ShowDialog()
+ $filePath = $Dialog.SelectedPath
+ Write-Host "No ISO is chosen+ $filePath"
+
+ if ([string]::IsNullOrEmpty($filePath))
+ {
+ Write-Host "No Folder had chosen"
+ return
+ }
+
+ $sync.MicrowinScratchDirBox.Text = Join-Path $filePath "\"
+
}
function Invoke-WPFButton {
@@ -2362,6 +2392,7 @@ function Invoke-WPFButton {
"WPFGetIso" {Invoke-WPFGetIso}
"WPFMicrowin" {Invoke-WPFMicrowin}
"WPFCloseButton" {Invoke-WPFCloseButton}
+ "MicrowinScratchDirBT" {Invoke-ScratchDialog}
}
}
function Invoke-WPFCloseButton {
@@ -2861,6 +2892,10 @@ function Invoke-WPFGetIso {
return
}
+ $sync.BusyMessage.Visibility="Visible"
+ $sync.BusyText.Text="N Busy"
+
+
Write-Host " _ __ __ _ "
Write-Host " /\/\ (_) ___ _ __ ___ / / /\ \ \(_) _ __ "
Write-Host " / \ | | / __|| '__| / _ \ \ \/ \/ /| || '_ \ "
@@ -2868,12 +2903,17 @@ function Invoke-WPFGetIso {
Write-Host "\/ \/|_| \___||_| \___/ \/ \/ |_||_| |_| "
$oscdimgPath = Join-Path $env:TEMP 'oscdimg.exe'
+ if( ! (Test-Path $oscdimgPath -PathType Leaf) ) {
+ $oscdimgPath = Join-Path '.\releases\' 'oscdimg.exe'
+}
+
$oscdImgFound = [bool] (Get-Command -ErrorAction Ignore -Type Application oscdimg.exe) -or (Test-Path $oscdimgPath -PathType Leaf)
Write-Host "oscdimg.exe on system: $oscdImgFound"
if (!$oscdImgFound)
{
$downloadFromGitHub = $sync.WPFMicrowinDownloadFromGitHub.IsChecked
+ $sync.BusyMessage.Visibility="Hidden"
if (!$downloadFromGitHub)
{
@@ -2918,6 +2958,7 @@ function Invoke-WPFGetIso {
if ([string]::IsNullOrEmpty($filePath))
{
Write-Host "No ISO is chosen"
+ $sync.BusyMessage.Visibility="Hidden"
return
}
@@ -2946,13 +2987,38 @@ function Invoke-WPFGetIso {
# there is probably a better way of doing this, I don't have time to figure this out
$sync.MicrowinIsoDrive.Text = $driveLetter
+ $mountedISOPath = (Split-Path -Path $filePath)
+ if ($sync.MicrowinScratchDirBox.Text.Trim() -eq "Scratch") {
+ $sync.MicrowinScratchDirBox.Text =""
+ }
+
+ $UseISOScratchDir = $sync.WPFMicrowinISOScratchDir.IsChecked
+
+ if ($UseISOScratchDir) {
+ $sync.MicrowinScratchDirBox.Text=$mountedISOPath
+ }
+
+ if( -Not $sync.MicrowinScratchDirBox.Text.EndsWith('\') -And $sync.MicrowinScratchDirBox.Text.Length -gt 1) {
+
+ $sync.MicrowinScratchDirBox.Text = Join-Path $sync.MicrowinScratchDirBox.Text.Trim() '\'
+
+ }
+
Write-Host "Setting up mount dir and scratch dirs"
$timestamp = Get-Date -Format "yyyyMMdd_HHmmss"
$randomNumber = Get-Random -Minimum 1 -Maximum 9999
$randomMicrowin = "Microwin_${timestamp}_${randomNumber}"
$randomMicrowinScratch = "MicrowinScratch_${timestamp}_${randomNumber}"
+ $sync.BusyText.Text=" - Mounting"
+ Write-Host "Mounting Iso. Please wait."
+ if ($sync.MicrowinScratchDirBox.Text -eq "") {
$mountDir = Join-Path $env:TEMP $randomMicrowin
$scratchDir = Join-Path $env:TEMP $randomMicrowinScratch
+ } else {
+ $scratchDir = $sync.MicrowinScratchDirBox.Text+"Scrach"
+ $mountDir = $sync.MicrowinScratchDirBox.Text+"micro"
+ }
+
$sync.MicrowinMountDir.Text = $mountDir
$sync.MicrowinScratchDir.Text = $scratchDir
Write-Host "Done setting up mount dir and scratch dirs"
@@ -2987,7 +3053,7 @@ function Invoke-WPFGetIso {
$imageName = $_.ImageName
$sync.MicrowinWindowsFlavors.Items.Add("$imageIdx : $imageName")
}
- $sync.MicrowinWindowsFlavors.SelectedIndex = 0
+ $sync.MicrowinWindowsFlavors.SelectedIndex = 5
Get-Volume $driveLetter | Get-DiskImage | Dismount-DiskImage
Write-Host "Selected value '$($sync.MicrowinWindowsFlavors.SelectedValue)'....."
@@ -3004,6 +3070,7 @@ function Invoke-WPFGetIso {
Write-Host "*********************************"
Write-Host "Check the UI for further steps!!!"
+ $sync.BusyMessage.Visibility="Hidden"
$sync.ProcessRunning = $false
}
@@ -5115,6 +5182,22 @@ $inputXML = '
Check the status in the console
+
+
+
+
+
+
+
+