From 6dd7f5cf5f307b6b1e41754e124327d13fd75e3e Mon Sep 17 00:00:00 2001 From: Ferdinand V Date: Wed, 20 Nov 2024 00:34:35 -0500 Subject: [PATCH] revert a0e77762f506365f8a7a1727b6e51a408829cab9 revert Working 4.8 Framework Version --- WindowsUpgradeService/MainWindow.xaml | 25 +- WindowsUpgradeService/MainWindow.xaml.cs | 195 ++++----- WindowsUpgradeService/Window1.xaml | 13 - WindowsUpgradeService/Window1.xaml.cs | 40 -- .../WindowsUpgradeService.csproj | 380 +++++++++--------- 5 files changed, 290 insertions(+), 363 deletions(-) delete mode 100644 WindowsUpgradeService/Window1.xaml delete mode 100644 WindowsUpgradeService/Window1.xaml.cs diff --git a/WindowsUpgradeService/MainWindow.xaml b/WindowsUpgradeService/MainWindow.xaml index cd9e190..5989bb8 100644 --- a/WindowsUpgradeService/MainWindow.xaml +++ b/WindowsUpgradeService/MainWindow.xaml @@ -1,13 +1,12 @@ - - - - + + + + + diff --git a/WindowsUpgradeService/MainWindow.xaml.cs b/WindowsUpgradeService/MainWindow.xaml.cs index eb93bec..b6c0d4e 100644 --- a/WindowsUpgradeService/MainWindow.xaml.cs +++ b/WindowsUpgradeService/MainWindow.xaml.cs @@ -1,110 +1,85 @@ -using DiscUtils.Udf; -using Microsoft.Toolkit.Uwp.Notifications; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace WindowsUpgradeService -{ - /// - /// Interaction logic for MainWindow.xaml - /// - public partial class MainWindow : Window - { - public MainWindow() - { - //InitializeComponent(); - ExtractISO(); - SetupWindows(); - } - static string OutPutWork = $"{Environment.GetEnvironmentVariable("SystemDrive")}\\WindowsSetup"; - private void ExtractISO() - { - using (Stream isoStream = File.Open($"{Directory.GetCurrentDirectory()}\\Windows_24H2.iso", FileMode.Open)) - { - UdfReader udfReader = new UdfReader(isoStream); - var DIRcd = udfReader.GetDirectories("\\", "*", SearchOption.AllDirectories); - var FILEScd = udfReader.GetFiles("\\", "*", SearchOption.AllDirectories); - - if (Directory.Exists(OutPutWork)) - { - Directory.Delete(OutPutWork,true); - } - - Directory.CreateDirectory(OutPutWork); - - foreach (var dir in DIRcd) { - Directory.CreateDirectory($"{OutPutWork}{dir}"); - } - - foreach (var files in FILEScd) { - Stream destOutput = File.OpenWrite($"{OutPutWork}{files}"); - Stream fileStream = udfReader.OpenFile(files,FileMode.Open); - fileStream.CopyTo(destOutput); - } - } - } - - private void SetupWindows() - { - var ProcStartInfo = new ProcessStartInfo() - { - FileName = $"{OutPutWork}\\setup.exe", - Arguments = "/auto upgrade /quiet /noreboot", - UseShellExecute = true, - CreateNoWindow = true, - - }; - var ProcStart = new Process() - { - StartInfo = ProcStartInfo, - }; - NotifyMe("The Upgrade is in Progress.", "Please do not shutdown or unplug your PC."); - Window1 window1 = new Window1(); - window1.StatusLabel.Content = "The Upgrade is in Progress."; - window1.Show(); - ProcStart.Start(); - ProcStart.WaitForExit(); - if (ProcStart.ExitCode != 0) { - NotifyMe("The Upgrade Failed.", "Please try to install again later."); - window1.StatusLabel.Content = "The Upgrade Failed."; - } - else { - NotifyMe("Welcome to Windows 11.", "Please restart your machine and allow the setup to complete."); - window1.StatusLabel.Content = "Please restart your machine and allow the setup to complete."; - } - - } - public void NotifyMe(string Title, string Message) - { - new ToastContentBuilder() - .AddArgument("action", "viewConversation") - .AddArgument("conversationId", 6969) - .AddText(Title) - .AddText(Message) - .Show(); - } - private void StatusLabel_Loaded(object sender, RoutedEventArgs e) - { - - } - - private void Window_Loaded(object sender, RoutedEventArgs e) - { - Visibility = Visibility.Collapsed; - } - } -} +using DiscUtils.Udf; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace WindowsUpgradeService +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + public MainWindow() + { + ExtractISO(); + SetupWindows(); + InitializeComponent(); + } + static string OutPutWork = $"{Environment.GetEnvironmentVariable("SystemDrive")}\\WindowsSetup"; + private void ExtractISO() + { + using (Stream isoStream = File.Open($"{Directory.GetCurrentDirectory()}\\Windows_24H2.iso", FileMode.Open)) + { + UdfReader udfReader = new UdfReader(isoStream); + var DIRcd = udfReader.GetDirectories("\\", "*", SearchOption.AllDirectories); + var FILEScd = udfReader.GetFiles("\\", "*", SearchOption.AllDirectories); + + if (Directory.Exists(OutPutWork)) + { + Directory.Delete(OutPutWork,true); + } + + Directory.CreateDirectory(OutPutWork); + + foreach (var dir in DIRcd) { + Directory.CreateDirectory($"{OutPutWork}{dir}"); + } + + foreach (var files in FILEScd) { + Stream destOutput = File.OpenWrite($"{OutPutWork}{files}"); + Stream fileStream = udfReader.OpenFile(files,FileMode.Open); + fileStream.CopyTo(destOutput); + } + } + } + + private void SetupWindows() + { + var ProcStartInfo = new ProcessStartInfo() + { + FileName = $"{OutPutWork}\\setup.exe", + Arguments = "/auto upgrade /quiet /noreboot", + UseShellExecute = true, + CreateNoWindow = true, + + }; + var ProcStart = new Process() + { + StartInfo = ProcStartInfo, + }; + ProcStart.Start(); + ProcStart.WaitForExit(); + if (ProcStart.ExitCode != 0) { + MessageBox.Show("Failed"); + } else { + MessageBox.Show("Passed"); + + } + + } + } +} diff --git a/WindowsUpgradeService/Window1.xaml b/WindowsUpgradeService/Window1.xaml deleted file mode 100644 index a3f8d08..0000000 --- a/WindowsUpgradeService/Window1.xaml +++ /dev/null @@ -1,13 +0,0 @@ - - - - diff --git a/WindowsUpgradeService/Window1.xaml.cs b/WindowsUpgradeService/Window1.xaml.cs deleted file mode 100644 index 78e4e13..0000000 --- a/WindowsUpgradeService/Window1.xaml.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Shapes; - -namespace WindowsUpgradeService -{ - /// - /// Interaction logic for Window1.xaml - /// - public partial class Window1 : Window - { - public Window1() - { - InitializeComponent(); - } - - private void Window_Loaded(object sender, RoutedEventArgs e) - { - var desktopWorkingArea = System.Windows.SystemParameters.WorkArea; - this.Left = desktopWorkingArea.Right - this.Width; - this.Top = desktopWorkingArea.Bottom - this.Height; - - } - - private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) - { - Environment.Exit(0); - } - } -} diff --git a/WindowsUpgradeService/WindowsUpgradeService.csproj b/WindowsUpgradeService/WindowsUpgradeService.csproj index f33f831..e3f7463 100644 --- a/WindowsUpgradeService/WindowsUpgradeService.csproj +++ b/WindowsUpgradeService/WindowsUpgradeService.csproj @@ -1,188 +1,194 @@ - - - - - Debug - AnyCPU - {70C42B35-5B42-4495-92BE-29A72C9C61FE} - WinExe - WindowsUpgradeService - WindowsUpgradeService - v4.8 - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 - true - true - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - - - - - x64 - true - embedded - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - app.manifest - - - - ..\packages\LTRData.DiscUtils.Core.1.0.48\lib\net48\DiscUtils.Core.dll - - - ..\packages\LTRData.DiscUtils.Iso9660.1.0.48\lib\net48\DiscUtils.Iso9660.dll - - - ..\packages\LTRData.DiscUtils.Streams.1.0.48\lib\net48\DiscUtils.Streams.dll - - - ..\packages\LTRData.DiscUtils.Udf.1.0.48\lib\net48\DiscUtils.Udf.dll - - - ..\packages\LTRData.Extensions.1.0.13\lib\net48\LTRData.Extensions.dll - - - ..\packages\Microsoft.Bcl.HashCode.6.0.0\lib\net462\Microsoft.Bcl.HashCode.dll - - - - ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll - - - - - ..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll - - - - ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll - - - ..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll - - - ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll - - - ..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll - - - - - - - - - 4.0 - - - - - - - - MSBuild:Compile - Designer - - - Window1.xaml - - - MSBuild:Compile - Designer - - - App.xaml - Code - - - MainWindow.xaml - Code - - - Designer - MSBuild:Compile - - - - - Code - - - True - True - Resources.resx - - - True - Settings.settings - True - - - ResXFileCodeGenerator - Resources.Designer.cs - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - - - - False - Microsoft .NET Framework 4.8 %28x86 and x64%29 - true - - - False - .NET Framework 3.5 SP1 - false - - - - - 1.0.48 - - - 1.0.13 - - - 7.1.3 - - - + + + + + Debug + AnyCPU + {70C42B35-5B42-4495-92BE-29A72C9C61FE} + WinExe + WindowsUpgradeService + WindowsUpgradeService + v4.8 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + true + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + x64 + true + embedded + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + app.manifest + + + + ..\packages\LTRData.DiscUtils.Core.1.0.48\lib\net48\DiscUtils.Core.dll + + + ..\packages\LTRData.DiscUtils.Iso9660.1.0.48\lib\net48\DiscUtils.Iso9660.dll + + + ..\packages\LTRData.DiscUtils.Streams.1.0.48\lib\net48\DiscUtils.Streams.dll + + + ..\packages\LTRData.DiscUtils.Udf.1.0.48\lib\net48\DiscUtils.Udf.dll + + + ..\packages\LTRData.Extensions.1.0.13\lib\net48\LTRData.Extensions.dll + + + ..\packages\Microsoft.Bcl.HashCode.6.0.0\lib\net462\Microsoft.Bcl.HashCode.dll + + + + ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll + + + + + ..\packages\System.IO.4.3.0\lib\net462\System.IO.dll + True + True + + + ..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll + + + + ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll + + + ..\packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll + True + True + + + ..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll + + + ..\packages\System.Security.Cryptography.Algorithms.4.3.1\lib\net463\System.Security.Cryptography.Algorithms.dll + True + True + + + ..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll + True + True + + + ..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll + True + True + + + ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll + + + ..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + MainWindow.xaml + Code + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + False + Microsoft .NET Framework 4.8 %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 + false + + + \ No newline at end of file