diff --git a/Rectify11Installer/Core/Helpers.cs b/Rectify11Installer/Core/Helpers.cs index 081a9542d..2c429aead 100644 --- a/Rectify11Installer/Core/Helpers.cs +++ b/Rectify11Installer/Core/Helpers.cs @@ -2,6 +2,7 @@ using Microsoft.VisualBasic; using Microsoft.Win32; using Rectify11Installer.Pages; +using Rectify11Installer.Win32; using System; using System.Collections.Generic; using System.Globalization; @@ -81,6 +82,134 @@ public static StringBuilder FinalText() return finalstr; } + public static bool CheckUBR() + { + return ((NativeMethods.GetUbr() != -1 + && NativeMethods.GetUbr() < 51 + && Environment.OSVersion.Version.Build == 22000) + || Environment.OSVersion.Version.Build is < 22000 and >= 21996); + } + + public static bool CheckIfUpdate() + { + try + { + // more priority + var build = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Rectify11", false)?.GetValue("Build"); + if (build != null && int.Parse(build.ToString()) < Assembly.GetEntryAssembly().GetName().Version.Build) + return true; + + var r11 = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Rectify11", false)?.GetValue("OSVersion"); + Version ver = Version.Parse(r11.ToString()); + if (Environment.OSVersion.Version.Build > ver.Build || NativeMethods.GetUbr() > ver.Revision) + { + Variables.WindowsUpdate = true; + return true; + } + + return false; + } + catch + { + return false; + } + } + public static void UpdateSideImageOptns(string name, FrmWizard _frmWizard) + { + switch (name) + { + case "shellNode": + _frmWizard.UpdateSideImage = Properties.Resources.menus; + if (Theme.IsUsingDarkMode) _frmWizard.UpdateSideImage = Properties.Resources.menusD; + break; + case "gadgetsNode": + _frmWizard.UpdateSideImage = Properties.Resources.gadgets; + break; + case "asdfNode": + _frmWizard.UpdateSideImage = Properties.Resources.asdf; + break; + case "wallpapersNode": + _frmWizard.UpdateSideImage = Properties.Resources.wallpapers; + break; + case "useravNode": + _frmWizard.UpdateSideImage = Properties.Resources.avatars; + break; + case "soundNode": + _frmWizard.UpdateSideImage = Properties.Resources.sound; ; + break; + // disabled until i will make them work + // case "sysiconsNode": + // _frmWizard.UpdateSideImage = global::Rectify11Installer.Properties.Resources.iconnewtree; + // break; + // case "themesNode": + // _frmWizard.UpdateSideImage = global::Rectify11Installer.Properties.Resources.theme; + // break; + default: + _frmWizard.UpdateSideImage = Properties.Resources.installoptns; + break; + } + } + + public static string FixString(string path, bool x86) + { + if (path.Contains("mun")) + { + return path.Replace(@"%sysresdir%", Variables.sysresdir); + } + else if (path.Contains("%sys32%")) + { + if (x86) + { + return path.Replace(@"%sys32%", Variables.sysWOWFolder); + } + else + { + return path.Replace(@"%sys32%", Variables.sys32Folder); + } + } + else if (path.Contains("%lang%")) + { + return path.Replace(@"%lang%", Path.Combine(Variables.sys32Folder, CultureInfo.CurrentUICulture.Name)); + } + else if (path.Contains("%en-US%")) + { + return path.Replace(@"%en-US%", Path.Combine(Variables.sys32Folder, "en-US")); + } + else if (path.Contains("%windirLang%")) + { + return path.Replace(@"%windirLang%", Path.Combine(Variables.Windir, CultureInfo.CurrentUICulture.Name)); + } + else if (path.Contains("%windirEn-US%")) + { + return path.Replace(@"%windirEn-US%", Path.Combine(Variables.Windir, "en-US")); + } + else if (path.Contains("%branding%")) + { + return path.Replace(@"%branding%", Variables.BrandingFolder); + } + else if (path.Contains("%prog%")) + { + if (x86) + { + return path.Replace(@"%prog%", Variables.progfiles86); + } + else + { + return path.Replace(@"%prog%", Variables.progfiles); + } + } + else if (path.Contains("%windir%")) + { + return path.Replace(@"%windir%", Variables.Windir); + } + else if (path.Contains("%diag%")) + { + return path.Replace("%diag%", Variables.diag); + } + return path; + } + + #endregion #region Private Methods private static bool RebootRequired() @@ -129,16 +258,15 @@ public class RectifyPages } public class TabPages { + public static Controls.DarkAwareTabPage eulPage; public static Controls.DarkAwareTabPage installPage; public static Controls.DarkAwareTabPage themePage; public static Controls.DarkAwareTabPage cmenupage; - public static Controls.DarkAwareTabPage summaryPage; - public static Controls.DarkAwareTabPage progressPage; - public static Controls.DarkAwareTabPage rebootPage; - public static Controls.DarkAwareTabPage wlcmPage; - public static Controls.DarkAwareTabPage eulPage; public static Controls.DarkAwareTabPage debPage; public static Controls.DarkAwareTabPage uninstPage; + public static Controls.DarkAwareTabPage progressPage; + public static Controls.DarkAwareTabPage summaryPage; + public static Controls.DarkAwareTabPage wlcmPage; } public class InstallOptions { diff --git a/Rectify11Installer/Pages/InstallOptnsPage.cs b/Rectify11Installer/Pages/InstallOptnsPage.cs index 200133a16..384c2e30f 100644 --- a/Rectify11Installer/Pages/InstallOptnsPage.cs +++ b/Rectify11Installer/Pages/InstallOptnsPage.cs @@ -1,47 +1,44 @@ -using Microsoft.Win32; -using Rectify11Installer.Core; +using Rectify11Installer.Core; using System; -using System.Globalization; using System.IO; using System.Linq; -using System.Reflection; using System.Windows.Forms; namespace Rectify11Installer.Pages { - public partial class InstallOptnsPage : WizardPage - { - #region Variables - private readonly FrmWizard _frmWizard; - private bool ExtrasSel = false; - bool idleinit; - #endregion - #region Main - public InstallOptnsPage(FrmWizard Frm) - { - _frmWizard = Frm; - InitializeComponent(); - Application.Idle += Application_Idle; - treeView1.AfterSelect += TreeView1_AfterSelect; - NavigationHelper.OnNavigate += NavigationHelper_OnNavigate; - } + public partial class InstallOptnsPage : WizardPage + { + #region Variables + private readonly FrmWizard _frmWizard; + private bool ExtrasSel = false; + bool idleinit; + #endregion + #region Main + public InstallOptnsPage(FrmWizard Frm) + { + _frmWizard = Frm; + InitializeComponent(); + Application.Idle += Application_Idle; + treeView1.AfterSelect += TreeView1_AfterSelect; + NavigationHelper.OnNavigate += NavigationHelper_OnNavigate; + } - private void NavigationHelper_OnNavigate(object sender, EventArgs e) - { - if ((WizardPage)sender == RectifyPages.InstallOptnsPage) - { - _frmWizard.nextButton.Enabled = Variables.IsItemsSelected; - } - } + private void NavigationHelper_OnNavigate(object sender, EventArgs e) + { + if ((WizardPage)sender == RectifyPages.InstallOptnsPage) + { + _frmWizard.nextButton.Enabled = Variables.IsItemsSelected; + } + } - void Application_Idle(object sender, System.EventArgs e) - { - if (!idleinit) - { - var list = PatchesParser.GetAll(); - var ok = list.Items; - var basicNode = treeView1.Nodes[0].Nodes[0]; - var advNode = treeView1.Nodes[0].Nodes[1]; + void Application_Idle(object sender, System.EventArgs e) + { + if (!idleinit) + { + var list = PatchesParser.GetAll(); + var ok = list.Items; + var basicNode = treeView1.Nodes[0].Nodes[0]; + var advNode = treeView1.Nodes[0].Nodes[1]; var themeNode = treeView1.Nodes[1]; var extra = treeView1.Nodes[2]; var shell = treeView1.Nodes[2].Nodes[0]; @@ -50,397 +47,243 @@ void Application_Idle(object sender, System.EventArgs e) var wall = treeView1.Nodes[2].Nodes[3]; var av = treeView1.Nodes[2].Nodes[4]; UpdateListView(ok, basicNode, advNode); - if (basicNode.Nodes.Count == 0) - treeView1.Nodes.Remove(basicNode); - if (advNode.Nodes.Count == 0) - treeView1.Nodes.Remove(advNode); - if (treeNode1.Nodes.Count == 0) - treeView1.Nodes.Remove(treeNode1); - // ugh - bool skip = false; - try + if (basicNode.Nodes.Count == 0) + treeView1.Nodes.Remove(basicNode); + if (advNode.Nodes.Count == 0) + treeView1.Nodes.Remove(advNode); + if (treeNode1.Nodes.Count == 0) + treeView1.Nodes.Remove(treeNode1); + // ugh + bool skip = false; + if (Helper.CheckIfUpdate()) skip = true; + + if (!skip) + { + if (Directory.Exists(Path.Combine(Variables.Windir, "Resources", "Themes", "Rectified"))) + treeView1.Nodes.Remove(themeNode); + + if (Directory.Exists(Path.Combine(Variables.Windir, "nilesoft"))) + treeView1.Nodes.Remove(shell); + + if (Directory.Exists(Path.Combine(Variables.r11Folder, "extras", "AccentColorizer"))) + treeView1.Nodes.Remove(asdf); + + if (File.Exists(Path.Combine(Variables.Windir, "web", "wallpaper", "Rectified", "img41.jpg"))) + treeView1.Nodes.Remove(wall); + + if (Directory.Exists(Path.Combine(Variables.progdata, "Microsoft", "User Account Pictures", "Default Pictures"))) + treeView1.Nodes.Remove(av); + + if (File.Exists(Path.Combine(Variables.progfiles, "Windows Sidebar", "sidebar.exe"))) + treeView1.Nodes.Remove(gad); + + if (extra.Nodes.Count == 0) + treeView1.Nodes.Remove(extra); + } + idleinit = true; + } + } + + #endregion + #region Private Methods + private static void UpdateListView(PatchesPatch[] patch, TreeNode basicNode, TreeNode advNode) + { + string path = Path.Combine(Variables.r11Folder, "backup"); + if (Helper.CheckIfUpdate()) path = Variables.r11Folder; + for (var i = 0; i < patch.Length; i++) + { + if (!File.Exists(Path.Combine(path, patch[i].Mui))) { - var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Rectify11", false); - if (key != null) + if (!patch[i].HardlinkTarget.Contains("%diag%")) { - var build = key.GetValue("Build"); - if (build != null && int.Parse(build.ToString()) < Assembly.GetEntryAssembly().GetName().Version.Build) + var newpath = Helper.FixString(patch[i].HardlinkTarget, !string.IsNullOrWhiteSpace(patch[i].x86)); + if (File.Exists(newpath)) { - // kinda disable the whole check - skip = true; + if (newpath.Contains("mun")) basicNode.Nodes.Add(patch[i].Mui); + else advNode.Nodes.Add(patch[i].Mui); } } - key.Dispose(); } - catch { } - try + if (patch[i].HardlinkTarget.Contains("%diag%")) { - var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Rectify11", false); - if (key != null) + var name = patch[i].Mui.Replace("Troubleshooter: ", "DiagPackage") + ".dll"; + if (!File.Exists(Path.Combine(path, "Diag", name))) { - var build = key.GetValue("OSVersion"); - Version ver = Version.Parse(build.ToString()); - if (build != null) + var newpath = Helper.FixString(patch[i].HardlinkTarget, false); + if (File.Exists(newpath)) + advNode.Nodes.Add(patch[i].Mui); + } + } + } + } + private void treeView1_AfterCheck(object sender, TreeViewEventArgs e) + { + if (e.Action != TreeViewAction.Unknown) + { + if (e.Node.Name == "basicNode") + { + e.Node.Descendants().ToList().ForEach(x => + { + x.Checked = e.Node.Checked; + if (e.Node.Checked) { - if (Environment.OSVersion.Version.Build > ver.Build || Win32.NativeMethods.GetUbr() > ver.Revision) - { - skip = true; - } + InstallOptions.iconsList.Add(x.Text); + Variables.InstallIcons = true; } - } - key.Dispose(); + else + { + InstallOptions.iconsList.Remove(x.Text); + Variables.InstallIcons = false; + } + }); } - catch { } - if (!skip) - { - if (Directory.Exists(Path.Combine(Variables.Windir, "Resources", "Themes", "Rectified"))) - { - treeView1.Nodes.Remove(themeNode); - } - if (Directory.Exists(Path.Combine(Variables.Windir, "nilesoft"))) - { - treeView1.Nodes.Remove(shell); - } - if (Directory.Exists(Path.Combine(Variables.r11Folder, "extras", "AccentColorizer"))) - { - treeView1.Nodes.Remove(asdf); - } - if (File.Exists(Path.Combine(Variables.Windir, "web", "wallpaper", "Rectified", "img41.jpg"))) - { - treeView1.Nodes.Remove(wall); - } - if (Directory.Exists(Path.Combine(Variables.progdata, "Microsoft", "User Account Pictures", "Default Pictures"))) - { - treeView1.Nodes.Remove(av); - } - if (File.Exists(Path.Combine(Variables.progfiles, "Windows Sidebar", "sidebar.exe"))) - { - treeView1.Nodes.Remove(gad); - } - if (extra.Nodes.Count == 0) - { - treeView1.Nodes.Remove(extra); - } - } - idleinit = true; - } - } - - #endregion - #region Private Methods - private static void UpdateListView(PatchesPatch[] patch, TreeNode basicNode, TreeNode advNode) - { - string path = Path.Combine(Variables.r11Folder, "backup"); - try - { - var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Rectify11", false); - if (key != null) - { - var build = key.GetValue("Build"); - if (build != null && int.Parse(build.ToString()) < Assembly.GetEntryAssembly().GetName().Version.Build) - { - // kinda disable the whole check - path = Variables.r11Folder; - } - } - key.Dispose(); - } - catch { } - try - { - var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Rectify11", false); - if (key != null) + if (e.Node.Name == "sysIconsNode") { - var build = key.GetValue("OSVersion"); - Version ver = Version.Parse(build.ToString()); - if (build != null) + e.Node.Descendants().ToList().ForEach(x => { - if (Environment.OSVersion.Version.Build > ver.Build || Win32.NativeMethods.GetUbr() > ver.Revision) - { - // kinda disable the whole check - path = Variables.r11Folder; - Variables.WindowsUpdate = true; + x.Checked = e.Node.Checked; + if (e.Node.Checked && (x.Name != "basicNode") && (x.Name != "advancedNode")) + { + InstallOptions.iconsList.Add(x.Text); + Variables.InstallIcons = true; } - } + else if ((x.Name != "basicNode") && (x.Name != "advancedNode")) + { + InstallOptions.iconsList.Remove(x.Text); + Variables.InstallIcons = false; + } + }); } - key.Dispose(); - } - catch { } - /* - key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Rectify11", false); - if (key != null) - { - var osver = key.GetValue("OSVersion"); - if (osver != null) - { - Version ver = Version.Parse(osver.ToString()); - if (Environment.OSVersion.Version.Build > ver.Build) - { - path = Variables.r11Folder; + if (e.Node.Name == "advancedNode") + { + e.Node.Descendants().ToList().ForEach(x => + { + x.Checked = e.Node.Checked; + if (e.Node.Checked) + { + InstallOptions.iconsList.Add(x.Text); + Variables.InstallIcons = true; + } + else + { + InstallOptions.iconsList.Remove(x.Text); + Variables.InstallIcons = false; + } + }); + } + if (e.Node.Name == "extraNode") + { + e.Node.Descendants().ToList().ForEach(x => + { + x.Checked = e.Node.Checked; + if (e.Node.Checked) + { + InstallOptions.iconsList.Add(x.Name); + } + else + { + InstallOptions.iconsList.Remove(x.Name); + } + }); + } + e.Node.Ancestors().ToList().ForEach(x => + { + x.Checked = x.Descendants().ToList().Any(y => y.Checked); + if (e.Node.Checked) + { + if (x.Name == "extraNode") + { + InstallOptions.iconsList.Add(e.Node.Name); + } + else if (x.Name == "basicNode") + { + InstallOptions.iconsList.Add(e.Node.Text); + Variables.InstallIcons = true; + } + else if (x.Name == "advancedNode") + { + InstallOptions.iconsList.Add(e.Node.Text); + Variables.InstallIcons = true; + } } - } - } - */ - for (var i = 0; i < patch.Length; i++) - { - if (!File.Exists(Path.Combine(path, patch[i].Mui))) - { - if (patch[i].HardlinkTarget.Contains("%sys32%")) - { - var newpath = patch[i].HardlinkTarget.Replace(@"%sys32%", Variables.sys32Folder); - if (File.Exists(newpath)) - advNode.Nodes.Add(patch[i].Mui); - } - else if (patch[i].HardlinkTarget.Contains("%lang%")) - { - var newpath = patch[i].HardlinkTarget.Replace(@"%lang%", Path.Combine(Variables.sys32Folder, CultureInfo.CurrentUICulture.Name)); - if (File.Exists(newpath)) - advNode.Nodes.Add(patch[i].Mui); - } - else if (patch[i].HardlinkTarget.Contains("%en-US%")) - { - var newpath = patch[i].HardlinkTarget.Replace(@"%en-US%", Path.Combine(Variables.sys32Folder, "en-US")); - if (File.Exists(newpath)) - advNode.Nodes.Add(patch[i].Mui); - } - else if (patch[i].HardlinkTarget.Contains("%windirEn-US%")) - { - var newpath = patch[i].HardlinkTarget.Replace(@"%windirEn-US%", Path.Combine(Variables.Windir, "en-US")); - if (File.Exists(newpath)) - advNode.Nodes.Add(patch[i].Mui); - } - else if (patch[i].HardlinkTarget.Contains("%windirLang%")) - { - var newpath = patch[i].HardlinkTarget.Replace(@"%windirLang%", Path.Combine(Variables.Windir, CultureInfo.CurrentUICulture.Name)); - if (File.Exists(newpath)) - advNode.Nodes.Add(patch[i].Mui); - } - else if (patch[i].Mui.Contains("mun")) - { - var newpath = patch[i].HardlinkTarget.Replace(@"%sysresdir%", Variables.sysresdir); - if (File.Exists(newpath)) - basicNode.Nodes.Add(patch[i].Mui); - } - else if (patch[i].HardlinkTarget.Contains("%windir%")) - { - var newpath = patch[i].HardlinkTarget.Replace(@"%windir%", Variables.Windir); - if (File.Exists(newpath)) - advNode.Nodes.Add(patch[i].Mui); - } - else if (patch[i].HardlinkTarget.Contains("%branding%")) - { - var newpath = patch[i].HardlinkTarget.Replace(@"%branding%", Variables.BrandingFolder); - if (File.Exists(newpath)) - advNode.Nodes.Add(patch[i].Mui); - } - else if (patch[i].HardlinkTarget.Contains("%prog%")) - { - var newpath = patch[i].HardlinkTarget.Replace(@"%prog%", Variables.progfiles); - if (File.Exists(newpath)) - advNode.Nodes.Add(patch[i].Mui); - } - - } - if (patch[i].HardlinkTarget.Contains("%diag%")) - { - var name = patch[i].Mui.Replace("Troubleshooter: ", "DiagPackage") + ".dll"; - if (!File.Exists(Path.Combine(path, "Diag", name))) - { - var newpath = patch[i].HardlinkTarget.Replace(@"%diag%", Variables.diag); - if (File.Exists(newpath)) - advNode.Nodes.Add(patch[i].Mui); - } - } - } - } - private void treeView1_AfterCheck(object sender, TreeViewEventArgs e) - { - if (e.Action != TreeViewAction.Unknown) - { - if (e.Node.Name == "basicNode") - { - e.Node.Descendants().ToList().ForEach(x => - { - x.Checked = e.Node.Checked; - if (e.Node.Checked) - { - InstallOptions.iconsList.Add(x.Text); - Variables.InstallIcons = true; - } - else - { - InstallOptions.iconsList.Remove(x.Text); - Variables.InstallIcons = false; - } - }); - } - if (e.Node.Name == "sysIconsNode") - { - e.Node.Descendants().ToList().ForEach(x => - { - x.Checked = e.Node.Checked; - if (e.Node.Checked && (x.Name != "basicNode") && (x.Name != "advancedNode")) - { - InstallOptions.iconsList.Add(x.Text); - Variables.InstallIcons = true; - } - else if ((x.Name != "basicNode") && (x.Name != "advancedNode")) - { - InstallOptions.iconsList.Remove(x.Text); - Variables.InstallIcons = false; - } - }); - } - if (e.Node.Name == "advancedNode") - { - e.Node.Descendants().ToList().ForEach(x => - { - x.Checked = e.Node.Checked; - if (e.Node.Checked) - { - InstallOptions.iconsList.Add(x.Text); - Variables.InstallIcons = true; - } - else - { - InstallOptions.iconsList.Remove(x.Text); - Variables.InstallIcons = false; - } - }); - } - if (e.Node.Name == "extraNode") - { - e.Node.Descendants().ToList().ForEach(x => - { - x.Checked = e.Node.Checked; - if (e.Node.Checked) - { - InstallOptions.iconsList.Add(x.Name); - } - else - { - InstallOptions.iconsList.Remove(x.Name); - } - }); - } - e.Node.Ancestors().ToList().ForEach(x => - { - x.Checked = x.Descendants().ToList().Any(y => y.Checked); - if (e.Node.Checked) - { - if (x.Name == "extraNode") - { - InstallOptions.iconsList.Add(e.Node.Name); - } - else if (x.Name == "basicNode") - { - InstallOptions.iconsList.Add(e.Node.Text); - Variables.InstallIcons = true; - } - else if (x.Name == "advancedNode") - { - InstallOptions.iconsList.Add(e.Node.Text); - Variables.InstallIcons = true; - } - } - else - { - if (x.Name == "extraNode") - { - InstallOptions.iconsList.Remove(e.Node.Name); - } - else if (x.Name == "basicNode") - { - InstallOptions.iconsList.Remove(e.Node.Text); - Variables.InstallIcons = false; - } - else if (x.Name == "advancedNode") - { - InstallOptions.iconsList.Remove(e.Node.Text); - Variables.InstallIcons = false; - } - } - }); - if (e.Node.Name == "themeNode") - { - if (e.Node.Checked) - { - InstallOptions.iconsList.Add(e.Node.Name); - } - else - { - InstallOptions.iconsList.Remove(e.Node.Name); - } - } - if ((!_frmWizard.nextButton.Enabled) && (InstallOptions.iconsList.Count > 0)) - { - _frmWizard.nextButton.Enabled = true; - Variables.IsItemsSelected = true; - - } - else if (InstallOptions.iconsList.Count == 0) - { - _frmWizard.nextButton.Enabled = false; - Variables.IsItemsSelected = false; - } - } - } + else + { + if (x.Name == "extraNode") + { + InstallOptions.iconsList.Remove(e.Node.Name); + } + else if (x.Name == "basicNode") + { + InstallOptions.iconsList.Remove(e.Node.Text); + Variables.InstallIcons = false; + } + else if (x.Name == "advancedNode") + { + InstallOptions.iconsList.Remove(e.Node.Text); + Variables.InstallIcons = false; + } + } + }); + if (e.Node.Name == "themeNode") + { + if (e.Node.Checked) + { + InstallOptions.iconsList.Add(e.Node.Name); + } + else + { + InstallOptions.iconsList.Remove(e.Node.Name); + } + } + if ((!_frmWizard.nextButton.Enabled) && (InstallOptions.iconsList.Count > 0)) + { + _frmWizard.nextButton.Enabled = true; + Variables.IsItemsSelected = true; - // Add extras preview cause e - private void TreeView1_AfterSelect(object sender, TreeViewEventArgs e) - { - // Check if the selected TreeNode is in ExtrasOptions.cs list - foreach (var option in ExtrasOptions.GetExtras()) - { - if (option.Name == e.Node.Name) - { - ExtrasSel = true; - // Update the Image property of the PictureBox based on the selected TreeNode - switch (e.Node.Name) - { - case "shellNode": - _frmWizard.UpdateSideImage = global::Rectify11Installer.Properties.Resources.menus; - if (Theme.IsUsingDarkMode) _frmWizard.UpdateSideImage = global::Rectify11Installer.Properties.Resources.menusD; - break; - case "gadgetsNode": - _frmWizard.UpdateSideImage = global::Rectify11Installer.Properties.Resources.gadgets; - break; - case "asdfNode": - _frmWizard.UpdateSideImage = global::Rectify11Installer.Properties.Resources.asdf; - break; - case "wallpapersNode": - _frmWizard.UpdateSideImage = global::Rectify11Installer.Properties.Resources.wallpapers; - break; - case "useravNode": - _frmWizard.UpdateSideImage = global::Rectify11Installer.Properties.Resources.avatars; - break; - case "soundNode": - _frmWizard.UpdateSideImage = global::Rectify11Installer.Properties.Resources.sound;; - break; - // disabled until i will make them work - // case "sysiconsNode": - // _frmWizard.UpdateSideImage = global::Rectify11Installer.Properties.Resources.iconnewtree; - // break; - // case "themesNode": - // _frmWizard.UpdateSideImage = global::Rectify11Installer.Properties.Resources.theme; - // break; - default: - _frmWizard.UpdateSideImage = global::Rectify11Installer.Properties.Resources.installoptns; - break; - } - return; - } - else - { - if (ExtrasSel) - { - _frmWizard.UpdateSideImage = global::Rectify11Installer.Properties.Resources.installoptns; - ExtrasSel = false; - } - } - } - } + } + else if (InstallOptions.iconsList.Count == 0) + { + _frmWizard.nextButton.Enabled = false; + Variables.IsItemsSelected = false; + } + } + var list = ExtrasOptions.GetExtras(); + for (int i = 0; i < list.Count; i++) + { + if (list[i].Name == e.Node.Name) + { + ExtrasSel = true; + // Update the Image property of the PictureBox based on the selected TreeNode + Helper.UpdateSideImageOptns(e.Node.Name, _frmWizard); + return; + } + else if (ExtrasSel) + { + _frmWizard.UpdateSideImage = Properties.Resources.installoptns; + ExtrasSel = false; + } + } + } - #endregion - } + private void TreeView1_AfterSelect(object sender, TreeViewEventArgs e) + { + var list = ExtrasOptions.GetExtras(); + for (int i = 0; i < list.Count; i++) + { + if (list[i].Name == e.Node.Name) + { + ExtrasSel = true; + // Update the Image property of the PictureBox based on the selected TreeNode + Helper.UpdateSideImageOptns(e.Node.Name, _frmWizard); + return; + } + else if (ExtrasSel) + { + _frmWizard.UpdateSideImage = Properties.Resources.installoptns; + ExtrasSel = false; + } + } + } + #endregion + } } diff --git a/Rectify11Installer/Pages/UninstallPage.cs b/Rectify11Installer/Pages/UninstallPage.cs index 9e348e4bd..9b885811b 100644 --- a/Rectify11Installer/Pages/UninstallPage.cs +++ b/Rectify11Installer/Pages/UninstallPage.cs @@ -1,6 +1,5 @@ using Rectify11Installer.Core; using System; -using System.Globalization; using System.IO; using System.Linq; using System.Windows.Forms; @@ -8,166 +7,120 @@ namespace Rectify11Installer.Pages { public partial class UninstallPage : WizardPage - { - #region Variables - private readonly FrmWizard _frmWizard; - bool idleinit; - #endregion - #region Main - public UninstallPage(FrmWizard Frm) - { - _frmWizard = Frm; - InitializeComponent(); - Application.Idle += Application_Idle; - NavigationHelper.OnNavigate += NavigationHelper_OnNavigate; - } + { + #region Variables + private readonly FrmWizard _frmWizard; + bool idleinit; + #endregion + #region Main + public UninstallPage(FrmWizard Frm) + { + _frmWizard = Frm; + InitializeComponent(); + Application.Idle += Application_Idle; + NavigationHelper.OnNavigate += NavigationHelper_OnNavigate; + } - private void NavigationHelper_OnNavigate(object sender, EventArgs e) - { - if ((WizardPage)sender == RectifyPages.UninstallPage) - { - _frmWizard.nextButton.Enabled = Variables.IsItemsSelected; - } - } + private void NavigationHelper_OnNavigate(object sender, EventArgs e) + { + if ((WizardPage)sender == RectifyPages.UninstallPage) + { + _frmWizard.nextButton.Enabled = Variables.IsItemsSelected; + } + } - void Application_Idle(object sender, System.EventArgs e) - { - if (!idleinit) - { - //overwriteUpdatedFiles(); - var list = PatchesParser.GetAll(); - var ok = list.Items; - var basicNode = treeView1.Nodes[0].Nodes[0]; - var advNode = treeView1.Nodes[0].Nodes[1]; + void Application_Idle(object sender, System.EventArgs e) + { + if (!idleinit) + { + //overwriteUpdatedFiles(); + var list = PatchesParser.GetAll(); + var ok = list.Items; + var basicNode = treeView1.Nodes[0].Nodes[0]; + var advNode = treeView1.Nodes[0].Nodes[1]; var themeNode = treeView1.Nodes[1]; - var extra = treeView1.Nodes[2]; + var extra = treeView1.Nodes[2]; var shell = treeView1.Nodes[2].Nodes[0]; var gad = treeView1.Nodes[2].Nodes[1]; var asdf = treeView1.Nodes[2].Nodes[2]; var wall = treeView1.Nodes[2].Nodes[3]; var av = treeView1.Nodes[2].Nodes[4]; UpdateListView(ok, basicNode, advNode); - if (basicNode.Nodes.Count == 0) - treeView1.Nodes.Remove(basicNode); - if (advNode.Nodes.Count == 0) - treeView1.Nodes.Remove(advNode); - if (treeNode1.Nodes.Count == 0) - treeView1.Nodes.Remove(treeNode1); + if (basicNode.Nodes.Count == 0) + treeView1.Nodes.Remove(basicNode); + if (advNode.Nodes.Count == 0) + treeView1.Nodes.Remove(advNode); + if (treeNode1.Nodes.Count == 0) + treeView1.Nodes.Remove(treeNode1); - // ugh - if (!Directory.Exists(Path.Combine(Variables.Windir, "Resources", "Themes", "Rectified"))) - { - treeView1.Nodes.Remove(themeNode); - } + // ugh + if (!Directory.Exists(Path.Combine(Variables.Windir, "Resources", "Themes", "Rectified"))) + { + treeView1.Nodes.Remove(themeNode); + } if (!Directory.Exists(Path.Combine(Variables.Windir, "nilesoft"))) - { - treeView1.Nodes.Remove(shell); - } + { + treeView1.Nodes.Remove(shell); + } if (!Directory.Exists(Path.Combine(Variables.r11Folder, "extras", "AccentColorizer"))) - { + { treeView1.Nodes.Remove(asdf); } if (!File.Exists(Path.Combine(Variables.Windir, "web", "wallpaper", "Rectified", "img41.jpg"))) - { - treeView1.Nodes.Remove(wall); - } + { + treeView1.Nodes.Remove(wall); + } if (!Directory.Exists(Path.Combine(Variables.progdata, "Microsoft", "User Account Pictures", "Default Pictures"))) - { - treeView1.Nodes.Remove(av); - } - if (!File.Exists(Path.Combine(Variables.progfiles, "Windows Sidebar","sidebar.exe"))) - { - treeView1.Nodes.Remove(gad); - } - if (extra.Nodes.Count == 0) - { - treeView1.Nodes.Remove(extra); - } + { + treeView1.Nodes.Remove(av); + } + if (!File.Exists(Path.Combine(Variables.progfiles, "Windows Sidebar", "sidebar.exe"))) + { + treeView1.Nodes.Remove(gad); + } + if (extra.Nodes.Count == 0) + { + treeView1.Nodes.Remove(extra); + } idleinit = true; - } - } - - #endregion - #region Private Methods - private static void UpdateListView(PatchesPatch[] patch, TreeNode basicNode, TreeNode advNode) - { - for (var i = 0; i < patch.Length; i++) - { - if (File.Exists(Path.Combine(Variables.r11Folder, "backup", patch[i].Mui))) - { - if (patch[i].HardlinkTarget.Contains("%sys32%")) - { - var newpath = patch[i].HardlinkTarget.Replace(@"%sys32%", Variables.sys32Folder); - if (File.Exists(newpath)) - advNode.Nodes.Add(patch[i].Mui); - } - else if (patch[i].HardlinkTarget.Contains("%lang%")) - { - var newpath = patch[i].HardlinkTarget.Replace(@"%lang%", Path.Combine(Variables.sys32Folder, CultureInfo.CurrentUICulture.Name)); - if (File.Exists(newpath)) - advNode.Nodes.Add(patch[i].Mui); - } - else if (patch[i].HardlinkTarget.Contains("%en-US%")) - { - var newpath = patch[i].HardlinkTarget.Replace(@"%en-US%", Path.Combine(Variables.sys32Folder, "en-US")); - if (File.Exists(newpath)) - advNode.Nodes.Add(patch[i].Mui); - } - else if (patch[i].HardlinkTarget.Contains("%windirEn-US%")) - { - var newpath = patch[i].HardlinkTarget.Replace(@"%windirEn-US%", Path.Combine(Variables.Windir, "en-US")); - if (File.Exists(newpath)) - advNode.Nodes.Add(patch[i].Mui); - } - else if (patch[i].HardlinkTarget.Contains("%windirLang%")) - { - var newpath = patch[i].HardlinkTarget.Replace(@"%windirLang%", Path.Combine(Variables.Windir, CultureInfo.CurrentUICulture.Name)); - if (File.Exists(newpath)) - advNode.Nodes.Add(patch[i].Mui); - } - else if (patch[i].Mui.Contains("mun")) - { - var newpath = patch[i].HardlinkTarget.Replace(@"%sysresdir%", Variables.sysresdir); - if (File.Exists(newpath)) - basicNode.Nodes.Add(patch[i].Mui); - } - else if (patch[i].HardlinkTarget.Contains("%windir%")) - { - var newpath = patch[i].HardlinkTarget.Replace(@"%windir%", Variables.Windir); - if (File.Exists(newpath)) - advNode.Nodes.Add(patch[i].Mui); - } - else if (patch[i].HardlinkTarget.Contains("%branding%")) - { - var newpath = patch[i].HardlinkTarget.Replace(@"%branding%", Variables.BrandingFolder); - if (File.Exists(newpath)) - advNode.Nodes.Add(patch[i].Mui); - } - else if (patch[i].HardlinkTarget.Contains("%prog%")) - { - var newpath = patch[i].HardlinkTarget.Replace(@"%prog%", Variables.progfiles); - if (File.Exists(newpath)) - advNode.Nodes.Add(patch[i].Mui); - } + } + } - } - if (patch[i].HardlinkTarget.Contains("%diag%")) - { - var name = patch[i].Mui.Replace("Troubleshooter: ", "DiagPackage") + ".dll"; - if (File.Exists(Path.Combine(Variables.r11Folder, "backup", "Diag", name))) - { - var newpath = patch[i].HardlinkTarget.Replace(@"%diag%", Variables.diag); - if (File.Exists(newpath)) - advNode.Nodes.Add(patch[i].Mui); - } - } - } - } - private void treeView1_AfterCheck(object sender, TreeViewEventArgs e) - { - if (e.Action != TreeViewAction.Unknown) - { - if (e.Node.Name == "basicNode") + #endregion + #region Private Methods + private static void UpdateListView(PatchesPatch[] patch, TreeNode basicNode, TreeNode advNode) + { + for (var i = 0; i < patch.Length; i++) + { + if (File.Exists(Path.Combine(Variables.r11Folder, "backup", patch[i].Mui))) + { + if (!patch[i].HardlinkTarget.Contains("%diag%")) + { + var newpath = Helper.FixString(patch[i].HardlinkTarget, !string.IsNullOrWhiteSpace(patch[i].x86)); + if (File.Exists(newpath)) + { + if (newpath.Contains("mun")) basicNode.Nodes.Add(patch[i].Mui); + else advNode.Nodes.Add(patch[i].Mui); + } + } + } + if (patch[i].HardlinkTarget.Contains("%diag%")) + { + var name = patch[i].Mui.Replace("Troubleshooter: ", "DiagPackage") + ".dll"; + if (File.Exists(Path.Combine(Variables.r11Folder, "backup", "Diag", name))) + { + var newpath = Helper.FixString(patch[i].HardlinkTarget, false); + if (File.Exists(newpath)) + advNode.Nodes.Add(patch[i].Mui); + } + } + } + } + private void treeView1_AfterCheck(object sender, TreeViewEventArgs e) + { + if (e.Action != TreeViewAction.Unknown) + { + if (e.Node.Name == "basicNode") { if (e.Node.Checked) { @@ -178,24 +131,24 @@ private void treeView1_AfterCheck(object sender, TreeViewEventArgs e) UninstallOptions.uninstDummylist.Remove(e.Node.Text); } e.Node.Descendants().ToList().ForEach(x => - { - x.Checked = e.Node.Checked; - if (e.Node.Checked) - { - UninstallOptions.uninstIconsList.Add(x.Text); - UninstallOptions.uninstDummylist.Add(x.Text); + { + x.Checked = e.Node.Checked; + if (e.Node.Checked) + { + UninstallOptions.uninstIconsList.Add(x.Text); + UninstallOptions.uninstDummylist.Add(x.Text); Variables.InstallIcons = true; - } - else - { - UninstallOptions.uninstIconsList.Remove(x.Text); - UninstallOptions.uninstDummylist.Remove(x.Text); + } + else + { + UninstallOptions.uninstIconsList.Remove(x.Text); + UninstallOptions.uninstDummylist.Remove(x.Text); Variables.InstallIcons = false; - } - }); - } - if (e.Node.Name == "sysIconsNode") - { + } + }); + } + if (e.Node.Name == "sysIconsNode") + { if (e.Node.Checked) { UninstallOptions.uninstDummylist.Add(e.Node.Text); @@ -205,33 +158,33 @@ private void treeView1_AfterCheck(object sender, TreeViewEventArgs e) UninstallOptions.uninstDummylist.Remove(e.Node.Text); } e.Node.Descendants().ToList().ForEach(x => - { - x.Checked = e.Node.Checked; - if (e.Node.Checked && (x.Name != "basicNode") && (x.Name != "advancedNode")) - { - UninstallOptions.uninstIconsList.Add(x.Text); - UninstallOptions.uninstDummylist.Add(x.Text); + { + x.Checked = e.Node.Checked; + if (e.Node.Checked && (x.Name != "basicNode") && (x.Name != "advancedNode")) + { + UninstallOptions.uninstIconsList.Add(x.Text); + UninstallOptions.uninstDummylist.Add(x.Text); Variables.InstallIcons = true; - } - else if ((x.Name != "basicNode") && (x.Name != "advancedNode")) - { - UninstallOptions.uninstIconsList.Remove(x.Text); - UninstallOptions.uninstDummylist.Remove(x.Text); + } + else if ((x.Name != "basicNode") && (x.Name != "advancedNode")) + { + UninstallOptions.uninstIconsList.Remove(x.Text); + UninstallOptions.uninstDummylist.Remove(x.Text); Variables.InstallIcons = false; - } - else if (e.Node.Checked && ((x.Name == "basicNode") || (x.Name == "advancedNode"))) - { + } + else if (e.Node.Checked && ((x.Name == "basicNode") || (x.Name == "advancedNode"))) + { UninstallOptions.uninstDummylist.Add(x.Text); } - else if (((x.Name == "basicNode") || (x.Name == "advancedNode"))) - { + else if (((x.Name == "basicNode") || (x.Name == "advancedNode"))) + { UninstallOptions.uninstDummylist.Remove(x.Text); } }); - } - if (e.Node.Name == "advancedNode") - { + } + if (e.Node.Name == "advancedNode") + { if (e.Node.Checked) { UninstallOptions.uninstDummylist.Add(e.Node.Text); @@ -241,134 +194,134 @@ private void treeView1_AfterCheck(object sender, TreeViewEventArgs e) UninstallOptions.uninstDummylist.Remove(e.Node.Text); } e.Node.Descendants().ToList().ForEach(x => - { - x.Checked = e.Node.Checked; - if (e.Node.Checked) - { - UninstallOptions.uninstIconsList.Add(x.Text); - UninstallOptions.uninstDummylist.Add(x.Text); + { + x.Checked = e.Node.Checked; + if (e.Node.Checked) + { + UninstallOptions.uninstIconsList.Add(x.Text); + UninstallOptions.uninstDummylist.Add(x.Text); Variables.InstallIcons = true; - } - else - { + } + else + { UninstallOptions.uninstIconsList.Remove(x.Text); UninstallOptions.uninstDummylist.Remove(x.Text); - Variables.InstallIcons = false; - } - }); - } - if (e.Node.Name == "extraNode") - { - if (e.Node.Checked) - { + Variables.InstallIcons = false; + } + }); + } + if (e.Node.Name == "extraNode") + { + if (e.Node.Checked) + { UninstallOptions.uninstDummylist.Add(e.Node.Text); } - else - { + else + { UninstallOptions.uninstDummylist.Remove(e.Node.Text); } e.Node.Descendants().ToList().ForEach(x => - { - x.Checked = e.Node.Checked; - if (e.Node.Checked) - { - UninstallOptions.uninstExtrasList.Add(x.Name); - UninstallOptions.uninstDummylist.Add(x.Name); + { + x.Checked = e.Node.Checked; + if (e.Node.Checked) + { + UninstallOptions.uninstExtrasList.Add(x.Name); + UninstallOptions.uninstDummylist.Add(x.Name); } - else - { + else + { UninstallOptions.uninstExtrasList.Remove(x.Name); UninstallOptions.uninstDummylist.Remove(x.Name); } }); - } - e.Node.Ancestors().ToList().ForEach(x => - { - x.Checked = x.Descendants().ToList().Any(y => y.Checked); - if (e.Node.Checked) - { - if (x.Name == "extraNode") - { + } + e.Node.Ancestors().ToList().ForEach(x => + { + x.Checked = x.Descendants().ToList().Any(y => y.Checked); + if (e.Node.Checked) + { + if (x.Name == "extraNode") + { UninstallOptions.uninstExtrasList.Add(e.Node.Name); UninstallOptions.uninstDummylist.Add(e.Node.Name); } else if (x.Name == "basicNode") - { - UninstallOptions.uninstIconsList.Add(e.Node.Text); - UninstallOptions.uninstDummylist.Add(e.Node.Text); + { + UninstallOptions.uninstIconsList.Add(e.Node.Text); + UninstallOptions.uninstDummylist.Add(e.Node.Text); Variables.InstallIcons = true; - } - else if (x.Name == "advancedNode") - { - UninstallOptions.uninstIconsList.Add(e.Node.Text); - UninstallOptions.uninstDummylist.Add(e.Node.Text); + } + else if (x.Name == "advancedNode") + { + UninstallOptions.uninstIconsList.Add(e.Node.Text); + UninstallOptions.uninstDummylist.Add(e.Node.Text); Variables.InstallIcons = true; - } - else if (x.Name == "sysIconsNode") - { + } + else if (x.Name == "sysIconsNode") + { UninstallOptions.uninstDummylist.Add(x.Text); } } - else - { - if (x.Name == "extraNode") - { + else + { + if (x.Name == "extraNode") + { UninstallOptions.uninstExtrasList.Remove(e.Node.Name); UninstallOptions.uninstDummylist.Remove(e.Node.Name); } else if (x.Name == "basicNode") - { - UninstallOptions.uninstIconsList.Remove(e.Node.Text); - UninstallOptions.uninstDummylist.Remove(e.Node.Text); + { + UninstallOptions.uninstIconsList.Remove(e.Node.Text); + UninstallOptions.uninstDummylist.Remove(e.Node.Text); Variables.InstallIcons = false; - } - else if (x.Name == "advancedNode") - { - UninstallOptions.uninstIconsList.Remove(e.Node.Text); + } + else if (x.Name == "advancedNode") + { + UninstallOptions.uninstIconsList.Remove(e.Node.Text); UninstallOptions.uninstDummylist.Remove(e.Node.Text); Variables.InstallIcons = false; - } + } else if (x.Name == "sysIconsNode") { UninstallOptions.uninstDummylist.Remove(x.Text); } } - }); - if (e.Node.Name == "themeNode") - { - if (e.Node.Checked) - { - UninstallOptions.UninstallThemes = true; + }); + if (e.Node.Name == "themeNode") + { + if (e.Node.Checked) + { + UninstallOptions.UninstallThemes = true; UninstallOptions.uninstDummylist.Add(e.Node.Text); } else - { - UninstallOptions.UninstallThemes = false; + { + UninstallOptions.UninstallThemes = false; UninstallOptions.uninstDummylist.Remove(e.Node.Text); } } - if (!_frmWizard.nextButton.Enabled && UninstallOptions.uninstDummylist.Count > 0) - { - _frmWizard.nextButton.Enabled = true; - Variables.IsItemsSelected = true; + if (!_frmWizard.nextButton.Enabled && UninstallOptions.uninstDummylist.Count > 0) + { + _frmWizard.nextButton.Enabled = true; + Variables.IsItemsSelected = true; - } - else if (UninstallOptions.uninstDummylist.Count == 0) - { - _frmWizard.nextButton.Enabled = false; - Variables.IsItemsSelected = false; - } - if (UninstallOptions.uninstDummylist.Count == treeView1.GetNodeCount(true)) - { - Variables.CompleteUninstall = true; - } - else - { - Variables.CompleteUninstall = false; - } + } + else if (UninstallOptions.uninstDummylist.Count == 0) + { + _frmWizard.nextButton.Enabled = false; + Variables.IsItemsSelected = false; + } + if (UninstallOptions.uninstDummylist.Count == treeView1.GetNodeCount(true)) + { + Variables.CompleteUninstall = true; + } + else + { + Variables.CompleteUninstall = false; + } } - } + } - #endregion - } + #endregion + } } diff --git a/Rectify11Installer/Pages/WelcomePage.cs b/Rectify11Installer/Pages/WelcomePage.cs index f9009f24b..ed58744ae 100644 --- a/Rectify11Installer/Pages/WelcomePage.cs +++ b/Rectify11Installer/Pages/WelcomePage.cs @@ -1,9 +1,5 @@ -using Microsoft.Win32; -using Rectify11Installer.Controls; +using Rectify11Installer.Controls; using Rectify11Installer.Core; -using System; -using System.IO; -using System.Reflection; namespace Rectify11Installer.Pages { @@ -22,45 +18,17 @@ public FakeCommandLink UninstallButton public WelcomePage() { InitializeComponent(); - // update - try + // update + if (InstallStatus.IsRectify11Installed) + { + cmbInstall.Text = Strings.Rectify11.modifyTitle; + cmbInstall.Note = Strings.Rectify11.modifyNote; + } + if (Helper.CheckIfUpdate()) { - if (InstallStatus.IsRectify11Installed) - { - cmbInstall.Text = Strings.Rectify11.modifyTitle; - cmbInstall.Note = Strings.Rectify11.modifyNote; - } - var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Rectify11", false); - if (key != null) - { - var build = key.GetValue("Build"); - if (build != null && int.Parse(build.ToString()) < Assembly.GetEntryAssembly().GetName().Version.Build) - { - cmbInstall.Text = Strings.Rectify11.updateTitle; - cmbInstall.Note = Strings.Rectify11.updateNote; - } - } - key.Dispose(); + cmbInstall.Text = Strings.Rectify11.updateTitle; + cmbInstall.Note = Strings.Rectify11.updateNote; } - catch { } - try - { - var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Rectify11", false); - if (key != null) - { - var build = key.GetValue("OSVersion"); - Version ver = Version.Parse(build.ToString()); - if (build != null) - { - if (Environment.OSVersion.Version.Build > ver.Build || Win32.NativeMethods.GetUbr() > ver.Revision) - { - cmbInstall.Text = Strings.Rectify11.updateTitle; - cmbInstall.Note = Strings.Rectify11.updateNote; - } - } - } - } - catch { } - } + } } } diff --git a/Rectify11Installer/frmWizard.Designer.cs b/Rectify11Installer/frmWizard.Designer.cs index 5168dd5ed..48817abdf 100644 --- a/Rectify11Installer/frmWizard.Designer.cs +++ b/Rectify11Installer/frmWizard.Designer.cs @@ -45,7 +45,6 @@ private void InitializeComponent() Core.TabPages.cmenupage = new Rectify11Installer.Controls.DarkAwareTabPage(); Core.TabPages.summaryPage = new Rectify11Installer.Controls.DarkAwareTabPage(); Core.TabPages.progressPage = new Rectify11Installer.Controls.DarkAwareTabPage(); - Core.TabPages.rebootPage = new Rectify11Installer.Controls.DarkAwareTabPage(); Core.TabPages.uninstPage = new Rectify11Installer.Controls.DarkAwareTabPage(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.progressLabel = new Controls.DarkAwareLabel(); @@ -176,7 +175,6 @@ private void InitializeComponent() this.navPane.Controls.Add(Core.TabPages.cmenupage); this.navPane.Controls.Add(Core.TabPages.summaryPage); this.navPane.Controls.Add(Core.TabPages.progressPage); - this.navPane.Controls.Add(Core.TabPages.rebootPage); this.navPane.Controls.Add(Core.TabPages.uninstPage); this.navPane.ItemSize = new System.Drawing.Size(10, 20); this.navPane.Location = new System.Drawing.Point(280, 0); @@ -284,16 +282,6 @@ private void InitializeComponent() Core.TabPages.progressPage.TabIndex = 6; Core.TabPages.progressPage.Text = "Progress"; // - // rebootPage - // - Core.TabPages.rebootPage.BackColor = System.Drawing.Color.White; - Core.TabPages.rebootPage.ForeColor = System.Drawing.Color.Black; - Core.TabPages.rebootPage.Location = new System.Drawing.Point(4, 44); - Core.TabPages.rebootPage.Name = "rebootPage"; - Core.TabPages.rebootPage.Size = new System.Drawing.Size(333, 284); - Core.TabPages.rebootPage.TabIndex = 7; - Core.TabPages.rebootPage.Text = "Reboot"; - // // uninstPage // Core.TabPages.uninstPage.BackColor = System.Drawing.Color.White; diff --git a/Rectify11Installer/frmWizard.cs b/Rectify11Installer/frmWizard.cs index a03b3990c..396c3d836 100644 --- a/Rectify11Installer/frmWizard.cs +++ b/Rectify11Installer/frmWizard.cs @@ -63,7 +63,7 @@ public EventHandler SetRebootHandler #region Main public FrmWizard() { - SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true); + SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.CacheText, true); if (System.Globalization.CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft) { RightToLeftLayout = true; @@ -71,10 +71,7 @@ public FrmWizard() } InitializeComponent(); DarkMode.RefreshTitleBarColor(Handle); - if (Theme.IsUsingDarkMode) - { - DarkMode.UpdateFrame(this, true); - } + if (Theme.IsUsingDarkMode) DarkMode.UpdateFrame(this, true); Shown += FrmWizard_Shown; FormClosing += FrmWizard_FormClosing; Application.Idle += Application_Idle; @@ -99,6 +96,7 @@ private void Application_Idle(object sender, EventArgs e) TabPages.uninstPage.Controls.Add(RectifyPages.UninstallPage); TabPages.progressPage.Controls.Add(RectifyPages.ProgressPage); TabPages.summaryPage.Controls.Add(RectifyPages.InstallConfirmation); + RectifyPages.WelcomePage.InstallButton.Click += InstallButton_Click; RectifyPages.WelcomePage.UninstallButton.Click += UninstallButton_Click; nextButton.Click += NextButton_Click; @@ -122,10 +120,7 @@ private void FrmWizard_Shown(object sender, EventArgs e) BackColor = Color.White; ForeColor = Color.Black; headerText.ForeColor = Color.Black; - if ((NativeMethods.GetUbr() != -1 - && NativeMethods.GetUbr() < 51 - && Environment.OSVersion.Version.Build == 22000) - || Environment.OSVersion.Version.Build is < 22000 and >= 21996) + if (Helper.CheckUBR()) { tableLayoutPanel1.BackColor = Color.White; tableLayoutPanel2.BackColor = Color.White; @@ -297,17 +292,7 @@ private void InstallButton_Click(object sender, EventArgs e) private void UninstallButton_Click(object sender, EventArgs e) { - if (Helper.CheckIfUpdatesPending()) - { - /* - TaskDialog.Show(text: "Uninstalling Rectify11 is not yet supported. You can run sfc /scannow to revert icon changes.", - instruction: "Incomplete Software", - title: "Rectify11 Setup", - buttons: TaskDialogButtons.OK, - icon: TaskDialogStandardIcon.SecurityErrorRedBar); - */ - Navigate(RectifyPages.UninstallPage); - } + if (Helper.CheckIfUpdatesPending()) Navigate(RectifyPages.UninstallPage); } private void VersionLabel_Click(object sender, EventArgs e)