@ -52,15 +52,18 @@ namespace amecs.Actions
{
{
string letter ;
string letter ;
var choice = new ChoicePrompt ( ) { Text = "A Windows Setup image must be provided to install .NET 3.5.\r\nWould you like to use a Windows Setup USB/folder instead of an ISO? (Y/N): " } . Start ( ) ;
var choice = new ChoicePrompt ( ) { Text = "A Windows Setup ISO must be provided to install .NET 3.5.\r\nDo you have a Win USB/folder instead of an ISO? (Y/N): " } . Start ( ) ;
if ( choice = = null ) return false ;
if ( choice = = null ) return false ;
var usingFolder = choice = = 0 ;
var usingFolder = choice = = 0 ;
if ( usingFolder )
if ( usingFolder )
{
{
var dlg = new FolderPicker ( ) ;
var dlg = new FolderPicker ( ) ;
dlg . InputPath = Globals . UserFolder ;
if ( dlg . ShowDialog ( default , false ) = = false ) return false ;
if ( dlg . ShowDialog ( default , false ) = = false ) return false ;
if ( CheckFileViolation ( dlg . ResultPath ) ) return false ;
if ( CheckFileViolation ( dlg . ResultPath ) ) return false ;
letter = dlg . ResultPath ;
letter = dlg . ResultPath ;
Console . WriteLine ( letter ) ;
Console . ReadLine ( ) ;
}
}
else
else
{
{
@ -71,51 +74,12 @@ namespace amecs.Actions
NativeWindow window = new NativeWindow ( ) ;
NativeWindow window = new NativeWindow ( ) ;
window . AssignHandle ( Process . GetCurrentProcess ( ) . MainWindowHandle ) ;
window . AssignHandle ( Process . GetCurrentProcess ( ) . MainWindowHandle ) ;
Console . WriteLine ( "a" ) ;
if ( dialog . ShowDialog ( window ) = = DialogResult . OK )
if ( dialog . ShowDialog ( window ) = = DialogResult . OK )
{
{
if ( CheckFileViolation ( dialog . FileName ) ) return false ;
if ( CheckFileViolation ( dialog . FileName ) ) return false ;
Console . WriteLine ( ) ;
Console . WriteLine ( ) ;
ConsoleTUI . OpenFrame . WriteCentered ( "\r\nMounting ISO" ) ;
ConsoleTUI . OpenFrame . WriteCentered ( "\r\nMounting ISO" ) ;
using ( new ConsoleUtils . LoadingIndicator ( true ) )
{
ProcessStartInfo startInfo = new ProcessStartInfo ( ) ;
startInfo . CreateNoWindow = false ;
startInfo . UseShellExecute = false ;
startInfo . FileName = "PowerShell.exe" ;
startInfo . WindowStyle = ProcessWindowStyle . Hidden ;
startInfo . Arguments = $"-NoP -C \" ( Mount - DiskImage ' { file } ' - PassThru | Get - Volume ) . DriveLetter + ':' \ "" ;
startInfo . RedirectStandardOutput = true ;
var proc = Process . Start ( startInfo ) ;
proc . WaitForExit ( ) ;
letter = proc . StandardOutput . ReadLine ( ) ;
}
if ( ! Directory . Exists ( letter + @"\sources\sxs" ) | | ! Directory . GetFiles ( letter + @"\sources\sxs" , "*netfx3*" ) . Any ( ) )
{
try
{
ProcessStartInfo startInfo = new ProcessStartInfo ( ) ;
startInfo . CreateNoWindow = false ;
startInfo . UseShellExecute = false ;
startInfo . FileName = "PowerShell.exe" ;
startInfo . WindowStyle = ProcessWindowStyle . Hidden ;
startInfo . Arguments = $"-NoP -C \" Dismount - DiskImage ' { file } ' \ "" ;
startInfo . RedirectStandardOutput = true ;
var proc = Process . Start ( startInfo ) ;
proc . WaitForExit ( ) ;
} catch ( Exception e )
{
}
Console . WriteLine ( ) ;
ConsoleTUI . OpenFrame . Close ( "ISO does not contain the required files." , ConsoleColor . Red , Console . BackgroundColor , new ChoicePrompt ( ) { AnyKey = true , Text = "Press any key to return to the Menu: " } ) ;
return false ;
}
}
}
else
else
{
{
@ -123,8 +87,33 @@ namespace amecs.Actions
ConsoleTUI . OpenFrame . Close ( "\r\nYou must select an ISO." , new ChoicePrompt ( ) { AnyKey = true , Text = "Press any key to return to the Menu: " } ) ;
ConsoleTUI . OpenFrame . Close ( "\r\nYou must select an ISO." , new ChoicePrompt ( ) { AnyKey = true , Text = "Press any key to return to the Menu: " } ) ;
return true ;
return true ;
}
}
using ( new ConsoleUtils . LoadingIndicator ( true ) )
{
ProcessStartInfo startInfo = new ProcessStartInfo ( ) ;
startInfo . CreateNoWindow = false ;
startInfo . UseShellExecute = false ;
startInfo . FileName = "PowerShell.exe" ;
startInfo . WindowStyle = ProcessWindowStyle . Hidden ;
startInfo . Arguments =
$"-NoP -C \" ( Mount - DiskImage ' { file } ' - PassThru | Get - Volume ) . DriveLetter + ' : \ ' \ "" ;
startInfo . RedirectStandardOutput = true ;
var proc = Process . Start ( startInfo ) ;
proc . WaitForExit ( ) ;
letter = proc . StandardOutput . ReadLine ( ) ;
}
}
}
if ( ! Directory . Exists ( letter + @"\sources\sxs" ) | | ! Directory . GetFiles ( letter + @"\sources\sxs" , "*netfx3*" ) . Any ( ) )
{
DismountImage ( ) ;
Console . WriteLine ( ) ;
ConsoleTUI . OpenFrame . Close ( "ISO/USB/folder does not contain the required files." , ConsoleColor . Red , Console . BackgroundColor , new ChoicePrompt ( ) { AnyKey = true , Text = "Press any key to return to the Menu: " } ) ;
return false ;
}
ConsoleTUI . OpenFrame . WriteCentered ( "\r\nInstalling .NET 3.5" ) ;
ConsoleTUI . OpenFrame . WriteCentered ( "\r\nInstalling .NET 3.5" ) ;
var topCache = Console . CursorTop ;
var topCache = Console . CursorTop ;
var leftCache = Console . CursorLeft ;
var leftCache = Console . CursorLeft ;