diff --git a/Perfect11/App.config b/Perfect11/App.config index 4bfa005..b6d76df 100644 --- a/Perfect11/App.config +++ b/Perfect11/App.config @@ -1,6 +1,14 @@ - + - + + + + + + + + + diff --git a/Perfect11/Form1.Designer.cs b/Perfect11/Form1.Designer.cs index a2a0541..38646cc 100644 --- a/Perfect11/Form1.Designer.cs +++ b/Perfect11/Form1.Designer.cs @@ -37,6 +37,18 @@ this.poisonLabel2 = new ReaLTaiizor.Controls.PoisonLabel(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.poisonLabel1 = new ReaLTaiizor.Controls.PoisonLabel(); + this.upgradePage = new ReaLTaiizor.Controls.PoisonTabPage(); + this.statusLabel = new ReaLTaiizor.Controls.PoisonLabel(); + this.installProgress = new ReaLTaiizor.Controls.PoisonProgressBar(); + this.poisonLabel6 = new ReaLTaiizor.Controls.PoisonLabel(); + this.poisonLabel7 = new ReaLTaiizor.Controls.PoisonLabel(); + this.upgradeButton = new ReaLTaiizor.Controls.PoisonButton(); + this.automateOOBECheck = new ReaLTaiizor.Controls.PoisonCheckBox(); + this.bypassWin11RequirementsCheck = new ReaLTaiizor.Controls.PoisonCheckBox(); + this.poisonLabel5 = new ReaLTaiizor.Controls.PoisonLabel(); + this.upgradeMethod = new ReaLTaiizor.Controls.PoisonComboBox(); + this.poisonLabel3 = new ReaLTaiizor.Controls.PoisonLabel(); + this.poisonLabel4 = new ReaLTaiizor.Controls.PoisonLabel(); this.debloatPage = new ReaLTaiizor.Controls.PoisonTabPage(); this.BtnRunUninstaller = new ReaLTaiizor.Controls.PoisonButton(); this.LblRemoveCount = new ReaLTaiizor.Controls.PoisonLabel(); @@ -52,20 +64,13 @@ this.runTweaks = new ReaLTaiizor.Controls.PoisonButton(); this.tweaksList = new ReaLTaiizor.Controls.PoisonListView(); this.editionLabel = new ReaLTaiizor.Controls.PoisonLabel(); - this.upgradePage = new ReaLTaiizor.Controls.PoisonTabPage(); - this.poisonLabel3 = new ReaLTaiizor.Controls.PoisonLabel(); - this.poisonLabel4 = new ReaLTaiizor.Controls.PoisonLabel(); - this.upgradeMethod = new ReaLTaiizor.Controls.PoisonComboBox(); - this.poisonLabel5 = new ReaLTaiizor.Controls.PoisonLabel(); - this.bypassWin11RequirementsCheck = new ReaLTaiizor.Controls.PoisonCheckBox(); - this.automateOOBECheck = new ReaLTaiizor.Controls.PoisonCheckBox(); this.theme.SuspendLayout(); this.pages.SuspendLayout(); this.welcomePage.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + this.upgradePage.SuspendLayout(); this.debloatPage.SuspendLayout(); this.tweaksPage.SuspendLayout(); - this.upgradePage.SuspendLayout(); this.SuspendLayout(); // // theme @@ -185,6 +190,164 @@ this.poisonLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.poisonLabel1.UseCustomBackColor = true; // + // upgradePage + // + this.upgradePage.Controls.Add(this.statusLabel); + this.upgradePage.Controls.Add(this.installProgress); + this.upgradePage.Controls.Add(this.poisonLabel6); + this.upgradePage.Controls.Add(this.poisonLabel7); + this.upgradePage.Controls.Add(this.upgradeButton); + this.upgradePage.Controls.Add(this.automateOOBECheck); + this.upgradePage.Controls.Add(this.bypassWin11RequirementsCheck); + this.upgradePage.Controls.Add(this.poisonLabel5); + this.upgradePage.Controls.Add(this.upgradeMethod); + this.upgradePage.Controls.Add(this.poisonLabel3); + this.upgradePage.Controls.Add(this.poisonLabel4); + this.upgradePage.HorizontalScrollbarBarColor = true; + this.upgradePage.HorizontalScrollbarHighlightOnWheel = false; + this.upgradePage.HorizontalScrollbarSize = 10; + this.upgradePage.Location = new System.Drawing.Point(4, 38); + this.upgradePage.Name = "upgradePage"; + this.upgradePage.Size = new System.Drawing.Size(1315, 690); + this.upgradePage.TabIndex = 3; + this.upgradePage.Text = "Upgrade"; + this.upgradePage.VerticalScrollbarBarColor = true; + this.upgradePage.VerticalScrollbarHighlightOnWheel = false; + this.upgradePage.VerticalScrollbarSize = 10; + // + // statusLabel + // + this.statusLabel.AutoSize = true; + this.statusLabel.BackColor = System.Drawing.Color.Transparent; + this.statusLabel.Location = new System.Drawing.Point(516, 638); + this.statusLabel.Name = "statusLabel"; + this.statusLabel.Size = new System.Drawing.Size(48, 19); + this.statusLabel.TabIndex = 14; + this.statusLabel.Text = "$status"; + this.statusLabel.UseCustomBackColor = true; + // + // installProgress + // + this.installProgress.Location = new System.Drawing.Point(5, 660); + this.installProgress.Name = "installProgress"; + this.installProgress.Size = new System.Drawing.Size(1045, 27); + this.installProgress.TabIndex = 13; + // + // poisonLabel6 + // + this.poisonLabel6.AutoSize = true; + this.poisonLabel6.BackColor = System.Drawing.Color.Transparent; + this.poisonLabel6.Location = new System.Drawing.Point(5, 247); + this.poisonLabel6.Name = "poisonLabel6"; + this.poisonLabel6.Size = new System.Drawing.Size(436, 114); + this.poisonLabel6.TabIndex = 12; + this.poisonLabel6.Text = resources.GetString("poisonLabel6.Text"); + this.poisonLabel6.UseCustomBackColor = true; + // + // poisonLabel7 + // + this.poisonLabel7.AutoSize = true; + this.poisonLabel7.BackColor = System.Drawing.Color.Transparent; + this.poisonLabel7.FontSize = ReaLTaiizor.Extension.Poison.PoisonLabelSize.Tall; + this.poisonLabel7.Location = new System.Drawing.Point(5, 210); + this.poisonLabel7.Name = "poisonLabel7"; + this.poisonLabel7.Size = new System.Drawing.Size(218, 25); + this.poisonLabel7.TabIndex = 11; + this.poisonLabel7.Text = "Reasons to get Windows 11:"; + this.poisonLabel7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.poisonLabel7.UseCustomBackColor = true; + // + // upgradeButton + // + this.upgradeButton.Enabled = false; + this.upgradeButton.FontSize = ReaLTaiizor.Extension.Poison.PoisonButtonSize.Medium; + this.upgradeButton.Location = new System.Drawing.Point(1198, 645); + this.upgradeButton.Name = "upgradeButton"; + this.upgradeButton.Size = new System.Drawing.Size(112, 42); + this.upgradeButton.TabIndex = 10; + this.upgradeButton.Text = "Install"; + this.upgradeButton.UseSelectable = true; + this.upgradeButton.Click += new System.EventHandler(this.upgradeButton_Click); + // + // automateOOBECheck + // + this.automateOOBECheck.AutoSize = true; + this.automateOOBECheck.Enabled = false; + this.automateOOBECheck.Location = new System.Drawing.Point(5, 164); + this.automateOOBECheck.Name = "automateOOBECheck"; + this.automateOOBECheck.Size = new System.Drawing.Size(353, 15); + this.automateOOBECheck.TabIndex = 9; + this.automateOOBECheck.Text = "Automate OOBE (skips parts of the OOBE, useful if reinstalling)"; + this.automateOOBECheck.UseSelectable = true; + // + // bypassWin11RequirementsCheck + // + this.bypassWin11RequirementsCheck.AutoSize = true; + this.bypassWin11RequirementsCheck.Checked = true; + this.bypassWin11RequirementsCheck.CheckState = System.Windows.Forms.CheckState.Checked; + this.bypassWin11RequirementsCheck.Enabled = false; + this.bypassWin11RequirementsCheck.Location = new System.Drawing.Point(5, 131); + this.bypassWin11RequirementsCheck.Name = "bypassWin11RequirementsCheck"; + this.bypassWin11RequirementsCheck.Size = new System.Drawing.Size(418, 15); + this.bypassWin11RequirementsCheck.TabIndex = 8; + this.bypassWin11RequirementsCheck.Text = "Bypass Windows 11 requirements (including RAM, CPU, TPM, Secure Boot)"; + this.bypassWin11RequirementsCheck.UseSelectable = true; + // + // poisonLabel5 + // + this.poisonLabel5.AutoSize = true; + this.poisonLabel5.BackColor = System.Drawing.Color.Transparent; + this.poisonLabel5.Location = new System.Drawing.Point(5, 87); + this.poisonLabel5.Name = "poisonLabel5"; + this.poisonLabel5.Size = new System.Drawing.Size(114, 19); + this.poisonLabel5.TabIndex = 7; + this.poisonLabel5.Text = "Upgrade method:"; + this.poisonLabel5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.poisonLabel5.UseCustomBackColor = true; + // + // upgradeMethod + // + this.upgradeMethod.FormattingEnabled = true; + this.upgradeMethod.ItemHeight = 23; + this.upgradeMethod.Items.AddRange(new object[] { + "Upgrade to Windows 11 (recommended, all languages)", + "Install Windows 11 IoT Enterprise LTSC (English US only)", + "Install Mini11 LTS (English UK only)", + "Use a custom image (for advanced users)"}); + this.upgradeMethod.Location = new System.Drawing.Point(143, 87); + this.upgradeMethod.Name = "upgradeMethod"; + this.upgradeMethod.PromptText = "--Please select--"; + this.upgradeMethod.Size = new System.Drawing.Size(1067, 29); + this.upgradeMethod.TabIndex = 6; + this.upgradeMethod.UseSelectable = true; + this.upgradeMethod.SelectedIndexChanged += new System.EventHandler(this.poisonComboBox1_SelectedIndexChanged); + // + // poisonLabel3 + // + this.poisonLabel3.AutoSize = true; + this.poisonLabel3.BackColor = System.Drawing.Color.Transparent; + this.poisonLabel3.Location = new System.Drawing.Point(5, 54); + this.poisonLabel3.Name = "poisonLabel3"; + this.poisonLabel3.Size = new System.Drawing.Size(760, 19); + this.poisonLabel3.TabIndex = 5; + this.poisonLabel3.Text = "In this page, we\'ll get you on Windows 11 as Windows 10 is now end of life. This " + + "process can take some time, so please be patient!"; + this.poisonLabel3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.poisonLabel3.UseCustomBackColor = true; + // + // poisonLabel4 + // + this.poisonLabel4.AutoSize = true; + this.poisonLabel4.BackColor = System.Drawing.Color.Transparent; + this.poisonLabel4.FontSize = ReaLTaiizor.Extension.Poison.PoisonLabelSize.Tall; + this.poisonLabel4.Location = new System.Drawing.Point(5, 17); + this.poisonLabel4.Name = "poisonLabel4"; + this.poisonLabel4.Size = new System.Drawing.Size(227, 25); + this.poisonLabel4.TabIndex = 4; + this.poisonLabel4.Text = "Let\'s get you on Windows 11!"; + this.poisonLabel4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.poisonLabel4.UseCustomBackColor = true; + // // debloatPage // this.debloatPage.Controls.Add(this.BtnRunUninstaller); @@ -385,105 +548,6 @@ this.editionLabel.Text = "Perfect11 Community Edition"; this.editionLabel.UseCustomBackColor = true; // - // upgradePage - // - this.upgradePage.Controls.Add(this.automateOOBECheck); - this.upgradePage.Controls.Add(this.bypassWin11RequirementsCheck); - this.upgradePage.Controls.Add(this.poisonLabel5); - this.upgradePage.Controls.Add(this.upgradeMethod); - this.upgradePage.Controls.Add(this.poisonLabel3); - this.upgradePage.Controls.Add(this.poisonLabel4); - this.upgradePage.HorizontalScrollbarBarColor = true; - this.upgradePage.HorizontalScrollbarHighlightOnWheel = false; - this.upgradePage.HorizontalScrollbarSize = 10; - this.upgradePage.Location = new System.Drawing.Point(4, 38); - this.upgradePage.Name = "upgradePage"; - this.upgradePage.Size = new System.Drawing.Size(1315, 690); - this.upgradePage.TabIndex = 3; - this.upgradePage.Text = "Upgrade"; - this.upgradePage.VerticalScrollbarBarColor = true; - this.upgradePage.VerticalScrollbarHighlightOnWheel = false; - this.upgradePage.VerticalScrollbarSize = 10; - // - // poisonLabel3 - // - this.poisonLabel3.AutoSize = true; - this.poisonLabel3.BackColor = System.Drawing.Color.Transparent; - this.poisonLabel3.Location = new System.Drawing.Point(5, 54); - this.poisonLabel3.Name = "poisonLabel3"; - this.poisonLabel3.Size = new System.Drawing.Size(760, 19); - this.poisonLabel3.TabIndex = 5; - this.poisonLabel3.Text = "In this page, we\'ll get you on Windows 11 as Windows 10 is now end of life. This " + - "process can take some time, so please be patient!"; - this.poisonLabel3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - this.poisonLabel3.UseCustomBackColor = true; - // - // poisonLabel4 - // - this.poisonLabel4.AutoSize = true; - this.poisonLabel4.BackColor = System.Drawing.Color.Transparent; - this.poisonLabel4.FontSize = ReaLTaiizor.Extension.Poison.PoisonLabelSize.Tall; - this.poisonLabel4.Location = new System.Drawing.Point(5, 17); - this.poisonLabel4.Name = "poisonLabel4"; - this.poisonLabel4.Size = new System.Drawing.Size(227, 25); - this.poisonLabel4.TabIndex = 4; - this.poisonLabel4.Text = "Let\'s get you on Windows 11!"; - this.poisonLabel4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - this.poisonLabel4.UseCustomBackColor = true; - // - // upgradeMethod - // - this.upgradeMethod.FormattingEnabled = true; - this.upgradeMethod.ItemHeight = 23; - this.upgradeMethod.Items.AddRange(new object[] { - "Upgrade to Windows 11 (recommended, all languages)", - "Install Windows 11 IoT Enterprise LTSC (English US only)", - "Install Mini11 LTS (English UK only)", - "Use a custom image (for advanced users)"}); - this.upgradeMethod.Location = new System.Drawing.Point(143, 87); - this.upgradeMethod.Name = "upgradeMethod"; - this.upgradeMethod.PromptText = "--Please select--"; - this.upgradeMethod.Size = new System.Drawing.Size(1067, 29); - this.upgradeMethod.TabIndex = 6; - this.upgradeMethod.UseSelectable = true; - this.upgradeMethod.SelectedIndexChanged += new System.EventHandler(this.poisonComboBox1_SelectedIndexChanged); - // - // poisonLabel5 - // - this.poisonLabel5.AutoSize = true; - this.poisonLabel5.BackColor = System.Drawing.Color.Transparent; - this.poisonLabel5.Location = new System.Drawing.Point(5, 87); - this.poisonLabel5.Name = "poisonLabel5"; - this.poisonLabel5.Size = new System.Drawing.Size(114, 19); - this.poisonLabel5.TabIndex = 7; - this.poisonLabel5.Text = "Upgrade method:"; - this.poisonLabel5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - this.poisonLabel5.UseCustomBackColor = true; - // - // bypassWin11RequirementsCheck - // - this.bypassWin11RequirementsCheck.AutoSize = true; - this.bypassWin11RequirementsCheck.Checked = true; - this.bypassWin11RequirementsCheck.CheckState = System.Windows.Forms.CheckState.Checked; - this.bypassWin11RequirementsCheck.Enabled = false; - this.bypassWin11RequirementsCheck.Location = new System.Drawing.Point(5, 131); - this.bypassWin11RequirementsCheck.Name = "bypassWin11RequirementsCheck"; - this.bypassWin11RequirementsCheck.Size = new System.Drawing.Size(418, 15); - this.bypassWin11RequirementsCheck.TabIndex = 8; - this.bypassWin11RequirementsCheck.Text = "Bypass Windows 11 requirements (including RAM, CPU, TPM, Secure Boot)"; - this.bypassWin11RequirementsCheck.UseSelectable = true; - // - // automateOOBECheck - // - this.automateOOBECheck.AutoSize = true; - this.automateOOBECheck.Enabled = false; - this.automateOOBECheck.Location = new System.Drawing.Point(5, 164); - this.automateOOBECheck.Name = "automateOOBECheck"; - this.automateOOBECheck.Size = new System.Drawing.Size(353, 15); - this.automateOOBECheck.TabIndex = 9; - this.automateOOBECheck.Text = "Automate OOBE (skips parts of the OOBE, useful if reinstalling)"; - this.automateOOBECheck.UseSelectable = true; - // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 21F); @@ -499,6 +563,7 @@ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Perfect11"; this.TransparencyKey = System.Drawing.Color.Fuchsia; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); this.Load += new System.EventHandler(this.Form1_Load); this.theme.ResumeLayout(false); this.theme.PerformLayout(); @@ -506,11 +571,11 @@ this.welcomePage.ResumeLayout(false); this.welcomePage.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.upgradePage.ResumeLayout(false); + this.upgradePage.PerformLayout(); this.debloatPage.ResumeLayout(false); this.debloatPage.PerformLayout(); this.tweaksPage.ResumeLayout(false); - this.upgradePage.ResumeLayout(false); - this.upgradePage.PerformLayout(); this.ResumeLayout(false); } @@ -547,6 +612,11 @@ private ReaLTaiizor.Controls.PoisonComboBox upgradeMethod; private ReaLTaiizor.Controls.PoisonCheckBox bypassWin11RequirementsCheck; private ReaLTaiizor.Controls.PoisonCheckBox automateOOBECheck; + private ReaLTaiizor.Controls.PoisonLabel poisonLabel6; + private ReaLTaiizor.Controls.PoisonLabel poisonLabel7; + private ReaLTaiizor.Controls.PoisonButton upgradeButton; + private ReaLTaiizor.Controls.PoisonLabel statusLabel; + private ReaLTaiizor.Controls.PoisonProgressBar installProgress; } } diff --git a/Perfect11/Form1.cs b/Perfect11/Form1.cs index 4ee7eb6..0464c2a 100644 --- a/Perfect11/Form1.cs +++ b/Perfect11/Form1.cs @@ -12,6 +12,10 @@ using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; using System.Text.RegularExpressions; +using System.Net.Http; +using System.Threading; +using DiscUtils.Udf; +using System.Windows.Forms.Design; namespace Perfect11 { @@ -19,6 +23,10 @@ namespace Perfect11 { private List _listSystemApps = new List(); private List _tweaks = new List(); + private CancellationTokenSource _cts; + private bool _isDownloading = false; + string url = $"https://software-static.download.prss.microsoft.com/dbazure/888969d5-f34g-4e03-ac9d-1f9786c66749/26200.6584.250915-1905.25h2_ge_release_svc_refresh_CLIENT_CONSUMER_x64FRE_{Utilities.GetLanguageCode()}.iso"; + string destination = Path.Combine(@"C:\Temp", @"windows.iso"); private static string AppEdition = "Perfect11 Community Edition"; public Form1() { @@ -57,8 +65,6 @@ namespace Perfect11 LstUWP.BackColor = Color.FromArgb(17, 17, 17); LstUWPRemove.BackColor = Color.FromArgb(17, 17, 17); tweaksList.BackColor = Color.FromArgb(17, 17, 17); - poisonLabel1.ForeColor = Color.FromArgb(255, 255, 255); - poisonLabel2.ForeColor = Color.FromArgb(255, 255, 255); githubLink.Theme = ThemeStyle.Dark; upgradePage.Theme = ThemeStyle.Dark; poisonLabel3.Theme = ThemeStyle.Dark; @@ -67,6 +73,11 @@ namespace Perfect11 upgradeMethod.Theme = ThemeStyle.Dark; bypassWin11RequirementsCheck.Theme = ThemeStyle.Dark; automateOOBECheck.Theme = ThemeStyle.Dark; + poisonLabel6.Theme = ThemeStyle.Dark; + poisonLabel7.Theme = ThemeStyle.Dark; + upgradeButton.Theme = ThemeStyle.Dark; + statusLabel.Theme = ThemeStyle.Dark; + installProgress.Theme = ThemeStyle.Dark; } else { @@ -101,6 +112,11 @@ namespace Perfect11 upgradeMethod.Theme = ThemeStyle.Light; bypassWin11RequirementsCheck.Theme = ThemeStyle.Light; automateOOBECheck.Theme = ThemeStyle.Light; + poisonLabel6.Theme = ThemeStyle.Light; + poisonLabel7.Theme = ThemeStyle.Light; + upgradeButton.Theme = ThemeStyle.Light; + statusLabel.Theme = ThemeStyle.Light; + installProgress.Theme = ThemeStyle.Light; } } private void Form1_Load(object sender, EventArgs e) @@ -118,6 +134,8 @@ namespace Perfect11 int totalWidth2 = LstUWPRemove.ClientSize.Width; LstUWP.Columns[0].Width = totalWidth1; LstUWPRemove.Columns[0].Width = totalWidth2; + statusLabel.Visible = false; + installProgress.Visible = false; } private void GetUWP() { @@ -425,6 +443,11 @@ namespace Perfect11 private void pages_SelectedIndexChanged(object sender, EventArgs e) { #if !DEBUG // For UI Testing do not prevent using pages if not 11 + if (pages.SelectedTab != upgradePage && _cts != null) + { + MessageBox.Show("Upgrade to Windows 11 is in progress, cannot change tab.", "Perfect11", MessageBoxButtons.OK, MessageBoxIcon.Information); + pages.SelectedTab = upgradePage; + } if ((pages.SelectedTab == debloatPage || pages.SelectedTab == tweaksPage) && !Utilities.IsWindows11()) { MessageBox.Show("In order to use these features you need to upgrade to Windows 11.","Perfect11",MessageBoxButtons.OK,MessageBoxIcon.Information); @@ -442,20 +465,277 @@ namespace Perfect11 private void poisonComboBox1_SelectedIndexChanged(object sender, EventArgs e) { + statusLabel.Text = "Ready."; + installProgress.Value = 0; + upgradeButton.Enabled = true; + statusLabel.Visible = true; + installProgress.Visible = true; + if (upgradeMethod.SelectedIndex == 3) + { + OpenFileDialog ofd = new OpenFileDialog + { + Filter = "Disc Image File|*.iso", + Title = "Select custom ISO", + Multiselect = false + }; + if (ofd.ShowDialog() == DialogResult.OK) + { + foreach (string fileName in ofd.FileNames) + { + destination = fileName; + } + } + else + { + upgradeMethod.SelectedIndex = 0; + } + } if (upgradeMethod.SelectedIndex == 3 || upgradeMethod.SelectedIndex == 2) // Both Mini11 and custom ISO { automateOOBECheck.Enabled = false; + automateOOBECheck.Checked = false; bypassWin11RequirementsCheck.Enabled = false; + bypassWin11RequirementsCheck.Checked = false; } - else if (upgradeMethod.SelectedIndex != 0) // if not normal installation + else if (upgradeMethod.SelectedIndex == 1) // Windows 11 LTSC + { + automateOOBECheck.Enabled = true; + } + if (upgradeMethod.SelectedIndex != 0) // if not normal installation { bypassWin11RequirementsCheck.Enabled = false; + bypassWin11RequirementsCheck.Checked = false; } else { automateOOBECheck.Enabled = true; bypassWin11RequirementsCheck.Enabled = true; + bypassWin11RequirementsCheck.Checked = true; } } + + private async void upgradeButton_Click(object sender, EventArgs e) + { + if (upgradeMethod.SelectedIndex == 1) + { + url = "https://oemsoc.download.prss.microsoft.com/dbazure/X23-81951_26100.1742.240906-0331.ge_release_svc_refresh_CLIENT_ENTERPRISES_OEM_x64FRE_en-us.iso_640de540-87c4-427f-be87-e6d53a3a60b4?t=2c3b664b-b119-4088-9db1-ccff72c6d22e&P1=102816950270&P2=601&P3=2&P4=OC448onxqdmdUsBUApAiE8pj1FZ%2bEPTU3%2bC6Quq29MVwMyyDUtR%2fsbiy7RdVoZOHaZRndvzeOOnIwJZ2x3%2bmP6YK9cjJSP41Lvs0SulF4SVyL5C0DdDmiWqh2QW%2bcDPj2Xp%2bMrI9NOeElSBS5kkOWP8Eiyf2VkkQFM3g5vIk3HJVvu5sWo6pFKpFv4lML%2bHaIiTSuwbPMs5xwEQTfScuTKfigNlUZPdHRMp1B3uKLgIA3r0IbRpZgHYMXEwXQ%2fSLMdDNQthpqQvz1PThVkx7ObD55CXgt0GNSAWRfjdURWb8ywWk1gT7ozAgpP%2fKNm56U5nh33WZSuMZIuO1SBM2vw%3d%3d"; + } + else if (upgradeMethod.SelectedIndex == 2) + { + url = "https://archive.org/download/mini11-24h2/Mini11%20LTS%2024H2%20AIO%20v1%20Triton.iso"; + } +#if !DEBUG + // Se stiamo già scaricando → annulla + if (_isDownloading) + { + if (_cts != null && !_cts.IsCancellationRequested) + { + _cts.Cancel(); + statusLabel.Text = "Canceling..."; + upgradeButton.Enabled = false; + } + return; + } + try + { + upgradeMethod.Enabled = false; + bypassWin11RequirementsCheck.Enabled = false; + automateOOBECheck.Enabled = false; + string setupArguments = ""; + installProgress.Value = 0; + upgradeButton.Text = "Cancel"; + _isDownloading = true; + _cts = new CancellationTokenSource(); + if (!Directory.Exists("C:\\Temp")) + Directory.CreateDirectory("C:\\Temp"); + if (upgradeMethod.SelectedIndex != 3) + { + destination = Path.Combine(@"C:\Temp", @"windows.iso"); + statusLabel.Text = "Downloading ISO..."; + await DownloadFileAsync(url, destination, _cts.Token); + statusLabel.Text = "Download completed!"; + } + Thread.Sleep(1000); + statusLabel.Text = "Extracting..."; + await Task.Run(() => ExtractIsoWithProgress(destination, Path.Combine(@"C:\Temp","Perfect11_W11_TMP"), _cts.Token)); + statusLabel.Text = "Extraction complete!"; + Thread.Sleep(1000); + if (automateOOBECheck.Checked) + { + statusLabel.Text = "Applying OOBE automation tweak..."; + if (!Directory.Exists(Path.Combine(@"C:\Temp", @"Perfect11_W11_TMP\sources\$OEM$\$$\Panther"))) + { + Directory.CreateDirectory(Path.Combine(@"C:\Temp", @"Perfect11_W11_TMP\sources\$OEM$\$$\Panther")); + } + if (File.Exists(Path.Combine(@"C:\Temp", @"Perfect11_W11_TMP\sources\$OEM$\$$\Panther\unattend.xml"))) + { + File.Delete(Path.Combine(@"C:\Temp", @"Perfect11_W11_TMP\sources\$OEM$\$$\Panther\unattend.xml")); + } + File.WriteAllText(Path.Combine(@"C:\Temp", @"Perfect11_W11_TMP\sources\$OEM$\$$\Panther\unattend.xml"),Resources.unattend_OOBEAutomate); + } + statusLabel.Text = "Checking Windows 11 Setup... (ignore the Windows Server title and texts)"; + if (bypassWin11RequirementsCheck.Checked) + { + setupArguments += "/Product Server /Compat IgnoreWarning /MigrateDrivers All"; + } + ProcessStartInfo info = new ProcessStartInfo + { + FileName = Path.Combine(@"C:\Temp", @"Perfect11_W11_TMP\sources\setupprep.exe"), + Arguments = setupArguments + }; + using (var process = Process.Start(info)) + { + process?.WaitForExit(); + } + _cts = null; + MessageBox.Show("Almost done! Now follow the prompts to continue the Windows 11 installation! Perfect11 will now close.","Perfect11",MessageBoxButtons.OK,MessageBoxIcon.Information); + Application.Exit(); + } + catch (OperationCanceledException) + { + statusLabel.Text = "Installation aborted!"; + try + { + if (File.Exists(destination)) + File.Delete(destination); + if (Directory.Exists(Path.Combine(@"C:\Temp", "Perfect11_W11_TMP"))) + Directory.Delete(Path.Combine(@"C:\Temp", "Perfect11_W11_TMP"), true); + } + catch { } + } + catch (Exception ex) + { + statusLabel.Text = "Error: " + ex.Message; + try + { + if (File.Exists(destination)) + File.Delete(destination); + if (Directory.Exists(Path.Combine(@"C:\Temp", "Perfect11_W11_TMP"))) + Directory.Delete(Path.Combine(@"C:\Temp", "Perfect11_W11_TMP"), true); + } catch { } + } + finally + { + _isDownloading = false; + upgradeButton.Text = "Install"; + upgradeButton.Enabled = true; + upgradeMethod.Enabled = true; + if (upgradeMethod.SelectedIndex == 3 || upgradeMethod.SelectedIndex == 2) // Both Mini11 and custom ISO + { + automateOOBECheck.Enabled = false; + automateOOBECheck.Checked = false; + bypassWin11RequirementsCheck.Enabled = false; + bypassWin11RequirementsCheck.Checked = false; + } + else if (upgradeMethod.SelectedIndex == 1) // Windows 11 LTSC + { + automateOOBECheck.Enabled = true; + } + if (upgradeMethod.SelectedIndex != 0) // if not normal installation + { + bypassWin11RequirementsCheck.Enabled = false; + bypassWin11RequirementsCheck.Checked = false; + } + else + { + automateOOBECheck.Enabled = true; + bypassWin11RequirementsCheck.Enabled = true; + bypassWin11RequirementsCheck.Checked = true; + } + _cts = null; + } +#else + MessageBox.Show(destination + " " + url, "Perfect11"); +#endif + } + public async Task DownloadFileAsync(string url, string destinationPath, CancellationToken token) + { + using (HttpClient client = new HttpClient { Timeout = TimeSpan.FromHours(2) }) + using (HttpResponseMessage response = await client.GetAsync(url, HttpCompletionOption.ResponseHeadersRead, token)) + using (Stream contentStream = await response.Content.ReadAsStreamAsync()) + using (FileStream fileStream = new FileStream(destinationPath, FileMode.Create, FileAccess.Write, FileShare.None, 8192, true)) + { + long? totalBytes = response.Content.Headers.ContentLength; + long totalRead = 0; + byte[] buffer = new byte[8192]; + int bytesRead; + DateTime lastUpdate = DateTime.Now; + + while ((bytesRead = await contentStream.ReadAsync(buffer, 0, buffer.Length, token)) > 0) + { + await fileStream.WriteAsync(buffer, 0, bytesRead, token); + totalRead += bytesRead; + + if (totalBytes.HasValue) + { + int progress = (int)((totalRead * 100L) / totalBytes.Value); + if (progress > 100) progress = 100; + + installProgress.Value = progress; + statusLabel.Text = $"ISO Download Progress: {progress}%"; + + // Aggiorna la UI ogni ~200ms + if ((DateTime.Now - lastUpdate).TotalMilliseconds > 200) + { + Application.DoEvents(); + lastUpdate = DateTime.Now; + } + } + } + } + } + private void ExtractIsoWithProgress(string isoPath, string extractPath, CancellationToken token) + { + if (!Directory.Exists(extractPath)) + { + Directory.CreateDirectory(extractPath); + } + using (FileStream isoStream = File.OpenRead(isoPath)) + { + UdfReader reader = new UdfReader(isoStream); + + var allFiles = reader.GetFiles("", "*", SearchOption.AllDirectories).ToList(); + int totalFiles = allFiles.Count; + int extractedCount = 0; + + Invoke(new Action(() => + { + installProgress.Maximum = totalFiles; + installProgress.Value = 0; + })); + + foreach (string file in allFiles) + { + token.ThrowIfCancellationRequested(); + + // Percorso originale da UdfReader per aprire il file + string sourcePath = file; + + // Percorso locale sul disco + string localPath = Path.Combine(extractPath, file.TrimStart('/').Replace('/', '\\')); + Directory.CreateDirectory(Path.GetDirectoryName(localPath)); + + using (Stream src = reader.OpenFile(sourcePath, FileMode.Open)) + using (FileStream dst = File.Create(localPath)) + { + src.CopyTo(dst); + } + + extractedCount++; + + Invoke(new Action(() => + { + installProgress.Value = extractedCount/totalFiles; + statusLabel.Text = $"Extracting ({extractedCount}/{totalFiles})..."; + })); + } + } + } + + private void Form1_FormClosing(object sender, FormClosingEventArgs e) + { + if (_cts != null) + e.Cancel = true; + } } } diff --git a/Perfect11/Form1.resx b/Perfect11/Form1.resx index d5feb54..18588ca 100644 --- a/Perfect11/Form1.resx +++ b/Perfect11/Form1.resx @@ -120,6 +120,14 @@ True + + 1. It's completely free and you can revert to Windows 10 if you don't like it +2. Better security +3. A new UI +4. Better productivity +5. Features for developers: Sudo and Dev Drives +6. Compatible with all apps running on Windows 10 + diff --git a/Perfect11/Library/Utilities.cs b/Perfect11/Library/Utilities.cs index a21d509..6c3652e 100644 --- a/Perfect11/Library/Utilities.cs +++ b/Perfect11/Library/Utilities.cs @@ -1,4 +1,5 @@ -using Microsoft.Win32; +using DiscUtils.Udf; +using Microsoft.Win32; using Newtonsoft.Json; using Perfect11.TweaksInterface; using System; @@ -127,7 +128,7 @@ namespace Perfect11.Library { if (stream == null) { - Console.WriteLine("❌ Risorsa non trovata: " + resourceName); + Console.WriteLine("Resource not found: " + resourceName); return new List(); } @@ -141,7 +142,7 @@ namespace Perfect11.Library } catch (Exception ex) { - Console.WriteLine("❌ Errore parsing JSON: " + ex.Message); + Console.WriteLine("Error parsing JSON: " + ex.Message); return new List(); } } diff --git a/Perfect11/Perfect11.csproj b/Perfect11/Perfect11.csproj index c4a1aef..98965f0 100644 --- a/Perfect11/Perfect11.csproj +++ b/Perfect11/Perfect11.csproj @@ -59,6 +59,18 @@ + + ..\packages\DiscUtils.Core.0.16.13\lib\net45\DiscUtils.Core.dll + + + ..\packages\DiscUtils.Iso9660.0.16.13\lib\net45\DiscUtils.Iso9660.dll + + + ..\packages\DiscUtils.Streams.0.16.13\lib\net45\DiscUtils.Streams.dll + + + ..\packages\DiscUtils.Udf.0.16.13\lib\net45\DiscUtils.Udf.dll + ..\packages\Newtonsoft.Json.13.0.4\lib\net45\Newtonsoft.Json.dll @@ -134,6 +146,7 @@ + diff --git a/Perfect11/Properties/Resources.Designer.cs b/Perfect11/Properties/Resources.Designer.cs index 8cbf514..dff6377 100644 --- a/Perfect11/Properties/Resources.Designer.cs +++ b/Perfect11/Properties/Resources.Designer.cs @@ -61,7 +61,40 @@ namespace Perfect11.Properties { } /// - /// Looks up a localized string similar to . + /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?> + ///<unattend xmlns="urn:schemas-microsoft-com:unattend"> + /// <settings pass="oobeSystem"> + /// <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + /// <OOBE> + /// <HideEULAPage>true</HideEULAPage> + /// <HideOEMRegistrat [rest of string was truncated]";. + /// + internal static string unattend_OOBEAutomate { + get { + return ResourceManager.GetString("unattend_OOBEAutomate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 1527c705-839a-4832-9118-54d4Bd6a0c89 + ///c5e2524a-ea46-4f67-841f-6a9465d9d515 + ///E2A4F912-2574-4A75-9BB0-0D023378592B + ///F46D4000-FD22-4DB4-AC8E-4E1DDDE828FE + ///InputApp + ///Microsoft.AAD.BrokerPlugin + ///Microsoft.AccountsControl + ///Microsoft.Advertising.Xaml + ///Microsoft.AsyncTextService + ///Microsoft.BioEnrollment + ///Microsoft.CredDialogHost + ///Microsoft.ECApp + ///Microsoft.LockApp + ///Microsoft.MicrosoftEdge + ///Microsoft.MicrosoftEdgeDevToolsClient + ///Microsoft.NET + ///Microsoft.PPIProjection + ///Microsoft.Services.Store.Engagement + ///Microsoft.V [rest of string was truncated]";. /// internal static string UWPSystemAppList { get { diff --git a/Perfect11/Properties/Resources.resx b/Perfect11/Properties/Resources.resx index 9ad68c4..2ab0e56 100644 --- a/Perfect11/Properties/Resources.resx +++ b/Perfect11/Properties/Resources.resx @@ -118,6 +118,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\unattend-OOBEAutomate.xml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + ..\Resources\UWPSystemAppList.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 diff --git a/Perfect11/Resources/unattend-OOBEAutomate.xml b/Perfect11/Resources/unattend-OOBEAutomate.xml new file mode 100644 index 0000000..38c5e05 --- /dev/null +++ b/Perfect11/Resources/unattend-OOBEAutomate.xml @@ -0,0 +1,14 @@ + + + + + + true + true + true + true + 3 + + + + diff --git a/Perfect11/packages.config b/Perfect11/packages.config index 211862b..5511ae1 100644 --- a/Perfect11/packages.config +++ b/Perfect11/packages.config @@ -1,5 +1,9 @@  + + + + \ No newline at end of file