diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d30f3088b..0f4086ded 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,15 +21,14 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} submodules: true lfs: true - - name: Git Sumbodule Update - run: | - git submodule update --init --recursive - git submodule update --recursive --remote - name: Add MSBuild to PATH uses: microsoft/setup-msbuild@v1.1.3 - name: Restore NuGet Packages run: | nuget restore Rectify11Installer.sln + nuget restore Rectify11ControlCenter\Rectify11ControlCenter.sln + - name: Build R11 Control Centre + run: msbuild Rectify11ControlCenter\Rectify11ControlCenter.sln /p:Configuration=Release - name: Build run: msbuild Rectify11Installer.sln /p:Configuration=Release /p:platform=x64 - name: Create single exe @@ -41,4 +40,4 @@ jobs: name: Rectify11Installer (x64) # A file, directory or wildcard pattern that describes what to upload path: Rectify11Installer\bin\output\Release\Rectify11Installer.exe - + \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index ab13db36a..d42a45dfa 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "RectifyControlPanel2"] - path = RectifyControlPanel2 - url = https://github.com/Rectify11/RectifyControlPanel2.git +[submodule "rectify11controlcenter"] + path = rectify11controlcenter + url = https://github.com/ojask/rectify11controlcenter.git diff --git a/Rectify11.Phase2/Resources/rectify11.xml b/Rectify11.Phase2/Resources/rectify11.xml index e08fd36b5..6ffd7f2a5 100644 --- a/Rectify11.Phase2/Resources/rectify11.xml +++ b/Rectify11.Phase2/Resources/rectify11.xml @@ -266,7 +266,7 @@ - + @@ -319,7 +319,7 @@ - + @@ -377,6 +377,7 @@ + diff --git a/Rectify11Installer.sln b/Rectify11Installer.sln index c1a975ed7..fbf3c0d80 100644 --- a/Rectify11Installer.sln +++ b/Rectify11Installer.sln @@ -4,17 +4,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 VisualStudioVersion = 17.7.34031.279 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rectify11Installer", "Rectify11Installer\Rectify11Installer.csproj", "{F1F7B13F-9EF7-4B77-9500-B062CC9DB17D}" - ProjectSection(ProjectDependencies) = postProject - {0B7DE49A-33C6-41B1-A9CE-D353031F8454} = {0B7DE49A-33C6-41B1-A9CE-D353031F8454} - {50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A} = {50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A} - EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rectify11.Phase2", "Rectify11.Phase2\Rectify11.Phase2.csproj", "{8D66B017-3A76-439B-847B-C7379191E109}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Rectify11CPL", "RectifyControlPanel2\Rectify11CPL\Rectify11CPL.vcxproj", "{50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectUI", "RectifyControlPanel2\dui70\DirectUI\DirectUI.vcxproj", "{0B7DE49A-33C6-41B1-A9CE-D353031F8454}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/Rectify11Installer/Core/Backend/Common.cs b/Rectify11Installer/Core/Backend/Common.cs index b40f500fc..24f30a11b 100644 --- a/Rectify11Installer/Core/Backend/Common.cs +++ b/Rectify11Installer/Core/Backend/Common.cs @@ -22,7 +22,7 @@ public static bool WriteFiles(bool icons, bool themes) { if (icons) { - if (!Helper.SafeFileOperation(Path.Combine(Variables.r11Folder, "wsudo.exe"), Properties.Resources.wsudo, Helper.OperationType.Write)) + if (!Helper.SafeFileOperation(Path.Combine(Variables.r11Folder, "NSudoL.exe"), Properties.Resources.NSudoL, Helper.OperationType.Write)) return false; if (!Helper.SafeFileOperation(Path.Combine(Variables.r11Folder, "Rectify11.Phase2.exe"), Properties.Resources.Rectify11Phase2, Helper.OperationType.Write)) return false; @@ -235,7 +235,7 @@ public static bool Cleanup() Helper.SafeDirectoryDeletion(Path.Combine(Variables.r11Folder, "themes"), false); Helper.SafeFileDeletion(Path.Combine(Variables.r11Folder, "themes.7z")); Helper.SafeFileDeletion(Path.Combine(Variables.r11Folder, "7za.exe")); - Helper.SafeFileDeletion(Path.Combine(Variables.r11Folder, "wsudo.exe")); + Helper.SafeFileDeletion(Path.Combine(Variables.r11Folder, "NSudoL.exe")); Helper.SafeFileDeletion(Path.Combine(Variables.r11Folder, "ResourceHacker.exe")); Helper.SafeFileDeletion(Path.Combine(Variables.r11Folder, "ResourceHacker.ini")); Helper.SafeFileDeletion(Path.Combine(Variables.r11Folder, "Rectify11.Phase2.exe")); diff --git a/Rectify11Installer/Core/Backend/Icons.cs b/Rectify11Installer/Core/Backend/Icons.cs index 0daa172db..08c171573 100644 --- a/Rectify11Installer/Core/Backend/Icons.cs +++ b/Rectify11Installer/Core/Backend/Icons.cs @@ -1,4 +1,5 @@ -using Microsoft.VisualBasic; +using KPreisser.UI; +using Microsoft.VisualBasic; using Microsoft.Win32; using System; using System.Collections.Generic; @@ -96,7 +97,7 @@ public static bool Install(FrmWizard frm) if (InstallOptions.iconsList.Contains("mmc.exe.mui")) { if (!MMCHelper.PatchAll()) - return false;; + return false; } if (InstallOptions.iconsList.Contains("odbcad32.exe")) @@ -108,7 +109,9 @@ public static bool Install(FrmWizard frm) // reg files for various file extensions Helper.ImportReg(Path.Combine(Variables.r11Files, "icons.reg")); - Variables.RestartRequired = true; + ClearIconCache(); + + Variables.RestartRequired = true; Logger.WriteLine("Icons.Install() succeeded."); Logger.WriteLine("══════════════════════════════════════════════"); return true; @@ -143,7 +146,7 @@ public static bool Uninstall() } Helper.SafeFileDeletion(Path.Combine(Variables.r11Folder, "Rectify11.Phase2.exe")); - Helper.SafeFileDeletion(Path.Combine(Variables.r11Folder, "wsudo.exe")); + Helper.SafeFileDeletion(Path.Combine(Variables.r11Folder, "NSudoL.exe")); Logger.WriteLine("Icons.Uninstall() succeeded."); Logger.WriteLine("══════════════════════════════════════════════"); @@ -329,8 +332,35 @@ private static bool MatchAndApplyRule(PatchesPatch patch) return true; } - #region Internal functions - private static void PatchCmd(PatchType type, string filename, string name, string tempfolder, string filepath, string mask) + /// + /// clears *.db cache files + /// + private static void ClearIconCache() + { + try + { + DirectoryInfo di = new(Path.Combine(GetFolderPath(SpecialFolder.LocalApplicationData), "microsoft", "windows", "explorer")); + var files = di.GetFiles("*.db"); + + for (var i = 0; i < files.Length; i++) + { + files[i].Attributes = FileAttributes.Normal; + if (File.Exists(files[i].FullName)) + { + Helper.SafeFileDeletion(files[i].FullName); + } + } + var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce", true); + key?.SetValue("ResetIconCache", Path.Combine(Variables.sys32Folder, "ie4uinit.exe") + " -show", RegistryValueKind.String); + key.Close(); + } + catch (Exception ex) + { + Logger.Warn("Clearing icon cache failed", ex); + } + } + #region Internal functions + private static void PatchCmd(PatchType type, string filename, string name, string tempfolder, string filepath, string mask) { if (type == PatchType.x86) { diff --git a/Rectify11Installer/Core/Backend/Installer.cs b/Rectify11Installer/Core/Backend/Installer.cs index 73a6c2114..bbc5322f3 100644 --- a/Rectify11Installer/Core/Backend/Installer.cs +++ b/Rectify11Installer/Core/Backend/Installer.cs @@ -32,8 +32,8 @@ public bool Install(FrmWizard frm) { try { - frm.InstallerProgress = "Begin creating a restore point"; - CreateSystemRestorePoint(false); + frm.InstallerProgress = "Creating a restore point"; + CreateSystemRestorePoint(); } catch (Exception ex) { @@ -87,22 +87,9 @@ public bool Install(FrmWizard frm) frm.InstallerProgress = "Creating uninstaller"; Common.CreateUninstall(); - InstallStatus.IsRectify11Installed = true; + InstallStatus.IsRectify11Installed = true; Logger.WriteLine("══════════════════════════════════════════════"); - if (Variables.CreateRestorePoint) - { - try - { - frm.InstallerProgress = "End creating a restore point"; - CreateSystemRestorePoint(true); - } - catch - { - //ignored - } - } - // cleanup frm.InstallerProgress = "Cleaning up..."; Common.Cleanup(); diff --git a/Rectify11Installer/Core/Backend/Themes.cs b/Rectify11Installer/Core/Backend/Themes.cs index 7f37fd1d8..8f95ab1ac 100644 --- a/Rectify11Installer/Core/Backend/Themes.cs +++ b/Rectify11Installer/Core/Backend/Themes.cs @@ -65,7 +65,19 @@ public static bool Install() // mmc dpi fix Process.Start(Path.Combine(Variables.sys32Folder, "reg.exe"), @" ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide /v PreferExternalManifest /t REG_DWORD /d 1 /f"); - Helper.SafeFileOperation(Path.Combine(Variables.r11Files, "mmc.exe.manifest"), Path.Combine(Variables.sys32Folder, "mmc.exe.manifest"), Helper.OperationType.Copy); + Helper.SvExtract(true, "themes.7z", "mmc.exe.manifest"); + Helper.SafeFileOperation(Path.Combine(Variables.r11Folder, "mmc.exe.manifest"), Path.Combine(Variables.sys32Folder, "mmc.exe.manifest"), Helper.OperationType.Copy); + File.Delete(Path.Combine(Variables.r11Folder, "mmc.exe.manifest")); + + try + { + ApplyScheme(); + Logger.WriteLine("ApplyScheme() succeeded."); + } + catch (Exception ex) + { + Logger.Warn("ApplyScheme() failed", ex); + } Variables.RestartRequired = true; Logger.WriteLine("Themes.Install() succeeded."); @@ -192,19 +204,15 @@ private static bool InstallThemes() public static void InstallR11Cpl() { UninstallR11Cpl(); - string cplPath = Path.Combine(Variables.r11Folder, "Rectify11CPL", "Rectify11CPL.dll"); - - //create files - Directory.CreateDirectory(Path.Combine(Variables.r11Folder, "Rectify11CPL")); - - File.WriteAllBytes(cplPath, Properties.Resources.Rectify11CPL); + Helper.SafeDirectoryDeletion(Path.Combine(Variables.r11Folder, "Rectify11ControlCenter"), false); + Directory.CreateDirectory(Path.Combine(Variables.r11Folder, "Rectify11ControlCenter")); + File.WriteAllBytes(Path.Combine(Variables.r11Folder, "Rectify11ControlCenter", "Rectify11ControlCenter.exe"), Properties.Resources.Rectify11CPL); // create shortcut using ShellLink shortcut = new(); - shortcut.Target = Path.Combine(Variables.sys32Folder, "control.exe"); - shortcut.Arguments = "/name Rectify11.SettingsCPL"; - shortcut.WorkingDirectory = @"%windir%\system32"; - shortcut.IconPath = Path.Combine(Variables.r11Folder, "Rectify11CPL", "Rectify11CPL.dll"); + shortcut.Target = Path.Combine(Variables.r11Folder, "Rectify11ControlCenter", "Rectify11ControlCenter.exe"); + shortcut.WorkingDirectory = @"%windir%\Rectify11\Rectify11ControlCenter"; + shortcut.IconPath = Path.Combine(Variables.r11Folder, "Rectify11ControlCenter", "Rectify11ControlCenter.exe"); shortcut.IconIndex = 0; shortcut.DisplayMode = ShellLink.LinkDisplayMode.edmNormal; @@ -219,18 +227,7 @@ public static void InstallR11Cpl() Logger.Warn("Error while saving shortcut: " + ex); } shortcut.Save(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Rectify11 Control Center.lnk")); - - // register CPL - var proc = new Process(); - proc.StartInfo.FileName = "regsvr32.exe"; - proc.StartInfo.Arguments = "/s \"" + cplPath + "\""; - proc.Start(); - proc.WaitForExit(); - - if (proc.ExitCode != 0) - { - Logger.WriteLine("Error while registering CPL: " + proc.ExitCode); - } + } /// /// uninstalls control center @@ -245,19 +242,22 @@ private static void UninstallR11Cpl() Helper.SafeFileDeletion(startmenuShortcut); Helper.SafeFileDeletion(desktopShortcut); - if (!File.Exists(cplPath)) return; - - // unregister CPL - var proc = new Process(); - proc.StartInfo.FileName = "regsvr32.exe"; - proc.StartInfo.Arguments = "/s /u \"" + cplPath + "\""; - proc.Start(); - proc.WaitForExit(); - - if (proc.ExitCode != 0) + if (File.Exists(cplPath)) { - Logger.Warn("Error while unregistering CPL: " + proc.ExitCode); + // unregister CPL + var proc = new Process(); + proc.StartInfo.FileName = "regsvr32.exe"; + proc.StartInfo.Arguments = "/s /u \"" + cplPath + "\""; + proc.Start(); + proc.WaitForExit(); + + if (proc.ExitCode != 0) + { + Logger.Warn("Error while unregistering CPL: " + proc.ExitCode); + } } + // nuke r11cp + Helper.SafeDirectoryDeletion(Path.Combine(Variables.r11Folder, "Rectify11ControlCenter"), false); //delete folder Helper.SafeDirectoryDeletion(Path.Combine(Variables.r11Folder, "Rectify11CPL"), false); @@ -278,6 +278,7 @@ private static void InstallMfe() string val = ""; if (InstallOptions.ThemeLight) val = t + "lightrectified.conf"; else if (InstallOptions.ThemeDark) val = t + "darkrectified.conf"; + else if (InstallOptions.ThemePDark) val = t + "darkrectified.conf"; else if (InstallOptions.ThemeBlack) { val = t + "black.conf"; @@ -392,7 +393,8 @@ private static bool UninstallMsstyles() "black.theme", "darkcolorized.theme", "darkrectified.theme", - "lightrectified.theme" + "lightrectified.theme", + "darkpartial.theme" }; try { @@ -436,7 +438,7 @@ private static bool InstallMsstyles() { try { - if (Environment.OSVersion.Version.Build >= 22543 + if (Environment.OSVersion.Version.Build >= 22543 && !msstyleDirList[i].Name.Contains("Legacy")) { Directory.Move(msstyleDirList[i].FullName, Path.Combine(Variables.Windir, "Resources", "Themes", msstyleDirList[i].Name)); @@ -474,6 +476,41 @@ private static bool UninstallMfe() } catch { return false; } } + + /// + /// applies the theme just before restart to set the mouse cursor properly + /// + private static void ApplyScheme() + { + var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce", true); + string s = "e"; + if (key != null) + { + if (InstallOptions.ThemeLight) + { + Process.Start(Path.Combine(Variables.Windir, "Resources", "Themes", "lightrectified.theme")); + s = Path.Combine(Variables.r11Folder, "SecureUXHelper.exe") + " apply " + '"' + "Rectify11 light theme" + '"'; + } + else if (InstallOptions.ThemeDark) + { + Process.Start(Path.Combine(Variables.Windir, "Resources", "Themes", "darkrectified.theme")); + s = Path.Combine(Variables.r11Folder, "SecureUXHelper.exe") + " apply " + '"' + "Rectify11 dark theme" + '"'; + } + else if (InstallOptions.ThemePDark) + { + Process.Start(Path.Combine(Variables.Windir, "Resources", "Themes", "darkpartial.theme")); + s = Path.Combine(Variables.r11Folder, "SecureUXHelper.exe") + " apply " + '"' + "Rectify11 partial dark theme" + '"'; + } + else + { + Process.Start(Path.Combine(Variables.Windir, "Resources", "Themes", "black.theme")); + s = Path.Combine(Variables.r11Folder, "SecureUXHelper.exe") + " apply " + '"' + "Rectify11 Dark theme with Mica" + '"'; + } + } + key.SetValue("ApplyTheme", s, RegistryValueKind.String); + key.SetValue("DeleteJunk", "rmdir /s /q " + Path.Combine(Environment.SpecialFolder.LocalApplicationData.ToString(), "junk"), RegistryValueKind.String); + key.Close(); + } #endregion } } diff --git a/Rectify11Installer/Core/Helpers.cs b/Rectify11Installer/Core/Helpers.cs index 0c1ddf1e3..e932c61d9 100644 --- a/Rectify11Installer/Core/Helpers.cs +++ b/Rectify11Installer/Core/Helpers.cs @@ -68,27 +68,41 @@ public static StringBuilder FinalText() finalstr.AppendLine(); finalstr.AppendLine(); if (Variables.InstallIcons) - finalstr.AppendLine(Strings.Rectify11.installIcons); + finalstr.AppendLine("+ " + Strings.Rectify11.installIcons); + else if (UninstallOptions.uninstIconsList.Count > 0) + finalstr.AppendLine("- " + Strings.Rectify11.installIcons); if (InstallOptions.iconsList.Contains("themeNode")) - finalstr.AppendLine(Strings.Rectify11.installThemes); + finalstr.AppendLine("+ " + Strings.Rectify11.installThemes); + else if (UninstallOptions.UninstallThemes) + finalstr.AppendLine("- " + Strings.Rectify11.installThemes); if (InstallOptions.iconsList.Contains("asdfNode")) - finalstr.AppendLine(Strings.Rectify11.installASDF); + finalstr.AppendLine("+ " + Strings.Rectify11.installASDF); + else if (UninstallOptions.uninstExtrasList.Contains("asdfNode")) + finalstr.AppendLine("- " + Strings.Rectify11.installASDF); if (InstallOptions.iconsList.Contains("shellNode")) - finalstr.AppendLine(Strings.Rectify11.installShell); + finalstr.AppendLine("+ " + Strings.Rectify11.installShell); + else if (UninstallOptions.uninstExtrasList.Contains("shellNode")) + finalstr.AppendLine("- " + Strings.Rectify11.installShell); if (InstallOptions.iconsList.Contains("gadgetsNode")) - finalstr.AppendLine(Strings.Rectify11.installGadgets); + finalstr.AppendLine("+ " + Strings.Rectify11.installGadgets); + else if (UninstallOptions.uninstExtrasList.Contains("gadgetsNode")) + finalstr.AppendLine("- " + Strings.Rectify11.installGadgets); if (InstallOptions.iconsList.Contains("wallpapersNode")) - finalstr.AppendLine(Strings.Rectify11.installWallpapers); + finalstr.AppendLine("+ " + Strings.Rectify11.installWallpapers); + else if (UninstallOptions.uninstExtrasList.Contains("wallpapersNode")) + finalstr.AppendLine("- " + Strings.Rectify11.installWallpapers); if (InstallOptions.iconsList.Contains("useravNode")) - finalstr.AppendLine(Strings.Rectify11.installUserAV); + finalstr.AppendLine("+ " + Strings.Rectify11.installUserAV); + else if (UninstallOptions.uninstExtrasList.Contains("useravNode")) + finalstr.AppendLine("- " + Strings.Rectify11.installUserAV); - return finalstr; + return finalstr; } public static bool CheckUBR() @@ -357,8 +371,8 @@ public static bool SafeDirectoryDeletion(string path, bool ischild) } public static void RunAsTI(string file,string param) { - Interaction.Shell(Path.Combine(Variables.r11Folder, "wsudo.exe") - + " -T " + file + Interaction.Shell(Path.Combine(Variables.r11Folder, "NSudoL.exe") + + " -U:T -P:E -Wait -UseCurrentConsole " + file + " " + param, AppWinStyle.NormalFocus, true); } #endregion @@ -406,7 +420,6 @@ public class RectifyPages public static InstallConfirmation InstallConfirmation; public static ProgressPage ProgressPage; public static DebugPage DebugPage = new(); - public static UninstallPage UninstallPage; } public class TabPages { @@ -415,7 +428,6 @@ public class TabPages public static Controls.DarkAwareTabPage themePage; public static Controls.DarkAwareTabPage cmenupage; 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; @@ -431,14 +443,17 @@ public class InstallOptions public static bool ThemeDark { get; set; } public static bool ThemeBlack { get; set; } public static bool ThemeLight { get; set; } - public static bool InstallShell { get; set; } + public static bool ThemePDark { get; set; } + public static bool InstallShell { get; set; } public static bool InstallSounds { get; set; } public static bool SkipMFE { get; set; } public static bool TabbedNotMica { get; set; } public static bool userAvatars { get; set; } public static int CMenuStyle = 1; public static List iconsList = new(); - public static bool InstallExtras() + public static List origList = new(); + + public static bool InstallExtras() { return InstallEP || InstallASDF @@ -478,7 +493,7 @@ public static void WriteLine(string s, Exception ex) => Text += s + ". " + ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + Environment.NewLine; public static void CommitLog() - => File.WriteAllText(System.IO.Path.Combine(Variables.r11Folder, "installer.log"), Text); + => File.WriteAllText(Path.Combine(Variables.r11Folder, "installer.log"), Text); public static void Warn(string v) => WriteLine("[WARNING] " + v); diff --git a/Rectify11Installer/Core/Variables.cs b/Rectify11Installer/Core/Variables.cs index f7fa25419..faa0c3abf 100644 --- a/Rectify11Installer/Core/Variables.cs +++ b/Rectify11Installer/Core/Variables.cs @@ -49,5 +49,7 @@ public class Variables public static bool WindowsUpdate { get; set; } = false; public static bool CompleteUninstall { get; set;} = false; public static bool CreateRestorePoint { get; set; } = true; + public static bool RunInstaller { get; set; } = false; + public static bool RunUninstaller { get; set; } = false; } } \ No newline at end of file diff --git a/Rectify11Installer/Core/rectify11.xml b/Rectify11Installer/Core/rectify11.xml index e08fd36b5..4629a8137 100644 --- a/Rectify11Installer/Core/rectify11.xml +++ b/Rectify11Installer/Core/rectify11.xml @@ -266,7 +266,7 @@ - + @@ -319,7 +319,7 @@ - + @@ -360,9 +360,7 @@ - - @@ -377,6 +375,7 @@ + diff --git a/Rectify11Installer/Pages/InstallOptnsPage.Designer.cs b/Rectify11Installer/Pages/InstallOptnsPage.Designer.cs index e30f829ea..3222af650 100644 --- a/Rectify11Installer/Pages/InstallOptnsPage.Designer.cs +++ b/Rectify11Installer/Pages/InstallOptnsPage.Designer.cs @@ -1,4 +1,6 @@ -namespace Rectify11Installer.Pages +using Rectify11Installer.Core; + +namespace Rectify11Installer.Pages { partial class InstallOptnsPage { @@ -60,11 +62,14 @@ private void InitializeComponent() this.label1.Size = new System.Drawing.Size(361, 40); this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.label1.TabIndex = 1; - this.label1.Text = Rectify11Installer.Strings.Rectify11.installChoiceDescription; - // - // treeView1 - // - this.treeView1.BackColor = System.Drawing.Color.White; + if (InstallStatus.IsRectify11Installed && !Helper.CheckIfUpdate()) + this.label1.Text = Rectify11Installer.Strings.Rectify11.modifyNote; + else + this.label1.Text = Rectify11Installer.Strings.Rectify11.installChoiceDescription; + // + // treeView1 + // + this.treeView1.BackColor = System.Drawing.Color.White; this.treeView1.BorderStyle = System.Windows.Forms.BorderStyle.None; this.treeView1.CheckBoxes = true; this.treeView1.ForeColor = System.Drawing.Color.Black; @@ -97,8 +102,11 @@ private void InitializeComponent() this.Controls.Add(this.groupBox1); this.Name = "InstallOptnsPage"; this.SideImage = global::Rectify11Installer.Properties.Resources.installoptns; - this.WizardHeader = Rectify11Installer.Strings.Rectify11.installChoiceTitle; - this.HeaderVisible = true; + if (InstallStatus.IsRectify11Installed && !Helper.CheckIfUpdate()) + this.WizardHeader = Rectify11Installer.Strings.Rectify11.modifyTitle; + else + this.WizardHeader = Rectify11Installer.Strings.Rectify11.installChoiceTitle; + this.HeaderVisible = true; this.FooterVisible = true; this.UpdateFrame = true; this.Page = Rectify11Installer.Core.TabPages.installPage; diff --git a/Rectify11Installer/Pages/InstallOptnsPage.cs b/Rectify11Installer/Pages/InstallOptnsPage.cs index efb025377..e9dbc3df4 100644 --- a/Rectify11Installer/Pages/InstallOptnsPage.cs +++ b/Rectify11Installer/Pages/InstallOptnsPage.cs @@ -6,284 +6,398 @@ 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]; - var themeNode = treeView1.Nodes[1]; - 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); - // ugh - bool skip = false; - if (Helper.CheckIfUpdate()) skip = true; + void Application_Idle(object sender, 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]; + 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 (!skip) - { - if (Directory.Exists(Path.Combine(Variables.Windir, "Resources", "Themes", "Rectified"))) - treeView1.Nodes.Remove(themeNode); + // ugh + bool skip = false; + if (Helper.CheckIfUpdate()) skip = true; - if (Directory.Exists(Path.Combine(Variables.Windir, "nilesoft"))) - treeView1.Nodes.Remove(shell); + // make a list with installed stuff + // and check installed stuff + if (!skip) + { + if (Directory.Exists(Path.Combine(Variables.Windir, "Resources", "Themes", "Rectified"))) + { + themeNode.Checked = true; + InstallOptions.origList.Add("themeNode"); + } - if (Directory.Exists(Path.Combine(Variables.r11Folder, "extras", "AccentColorizer"))) - treeView1.Nodes.Remove(asdf); + if (Directory.Exists(Path.Combine(Variables.Windir, "nilesoft"))) + { + shell.Checked = true; + InstallOptions.origList.Add("shellNode"); + } - if (File.Exists(Path.Combine(Variables.Windir, "web", "wallpaper", "Rectified", "img41.jpg"))) - treeView1.Nodes.Remove(wall); + if (Directory.Exists(Path.Combine(Variables.r11Folder, "extras", "AccentColorizer"))) + { + asdf.Checked = true; + InstallOptions.origList.Add("asdfNode"); + } - if (Directory.Exists(Path.Combine(Variables.progdata, "Microsoft", "User Account Pictures", "Default Pictures"))) - treeView1.Nodes.Remove(av); + if (File.Exists(Path.Combine(Variables.Windir, "web", "wallpaper", "Rectified", "img41.jpg"))) + { + wall.Checked = true; + InstallOptions.origList.Add("wallpapersNode"); + } - if (File.Exists(Path.Combine(Variables.progfiles, "Windows Sidebar", "sidebar.exe"))) - treeView1.Nodes.Remove(gad); + if (Directory.Exists(Path.Combine(Variables.progdata, "Microsoft", "User Account Pictures", "Default Pictures"))) + { + av.Checked = true; + InstallOptions.origList.Add("useravNode"); + } - if (extra.Nodes.Count == 0) - treeView1.Nodes.Remove(extra); - } - idleinit = true; - } - } + if (File.Exists(Path.Combine(Variables.progfiles, "Windows Sidebar", "sidebar.exe"))) + { + gad.Checked = true; + InstallOptions.origList.Add("gadgetsNode"); + } + if (shell.Checked || asdf.Checked || wall.Checked || av.Checked || gad.Checked) + { + shell.Ancestors()[0].Checked = true; + } + } + 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))) - { - 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(path, "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") - { - 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; + #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 (!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")) + { + var tree = basicNode.Nodes.Add(patch[i].Mui); + if (File.Exists(Path.Combine(path, patch[i].Mui))) + { + tree.Checked = true; + tree.Ancestors()[0].Checked = true; + tree.Ancestors()[0].Ancestors()[0].Checked = true; + InstallOptions.origList.Add(patch[i].Mui); + } + } + else + { + var tree = advNode.Nodes.Add(patch[i].Mui); + if (File.Exists(Path.Combine(path, patch[i].Mui))) + { + tree.Checked = true; + tree.Ancestors()[0].Checked = true; + InstallOptions.origList.Add(patch[i].Mui); + } + } + } - } - 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; - } - } - } + } + if (patch[i].HardlinkTarget.Contains("%diag%")) + { + var name = patch[i].Mui.Replace("Troubleshooter: ", "DiagPackage") + ".dll"; + var newpath = Helper.FixString(patch[i].HardlinkTarget, false); + if (File.Exists(newpath)) + { + var tree = advNode.Nodes.Add(patch[i].Mui); + if (File.Exists(Path.Combine(path, "Diag", name))) + { + tree.Checked = true; + tree.Ancestors()[0].Checked = true; + tree.Ancestors()[0].Ancestors()[0].Checked = true; + InstallOptions.origList.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 (!InstallOptions.origList.Contains(x.Text)) + { + InstallOptions.iconsList.Add(x.Text); + } + UninstallOptions.uninstIconsList.Remove(x.Text); + Variables.InstallIcons = true; + } + else + { + InstallOptions.iconsList.Remove(x.Text); + if (InstallOptions.origList.Contains(x.Text)) + { + UninstallOptions.uninstIconsList.Add(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")) + { + if (!InstallOptions.origList.Contains(x.Text)) + { + InstallOptions.iconsList.Add(x.Text); + } + UninstallOptions.uninstIconsList.Remove(x.Text); + Variables.InstallIcons = true; + } + else if ((x.Name != "basicNode") && (x.Name != "advancedNode")) + { + InstallOptions.iconsList.Remove(x.Text); + if (InstallOptions.origList.Contains(x.Text)) + { + UninstallOptions.uninstIconsList.Add(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) + { + if (!InstallOptions.origList.Contains(x.Text)) + { + InstallOptions.iconsList.Add(x.Text); + } + UninstallOptions.uninstIconsList.Remove(x.Text); + Variables.InstallIcons = true; + } + else + { + InstallOptions.iconsList.Remove(x.Text); + if (InstallOptions.origList.Contains(x.Text)) + { + UninstallOptions.uninstIconsList.Add(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) + { + if (!InstallOptions.origList.Contains(x.Name)) + { + InstallOptions.iconsList.Add(x.Name); + } + UninstallOptions.uninstExtrasList.Remove(x.Name); + } + else + { + InstallOptions.iconsList.Remove(x.Name); + if (InstallOptions.origList.Contains(x.Name)) + { + UninstallOptions.uninstExtrasList.Add(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") + { + if (!InstallOptions.origList.Contains(e.Node.Name)) + { + InstallOptions.iconsList.Add(e.Node.Name); + } + UninstallOptions.uninstExtrasList.Remove(e.Node.Name); + } + else if (x.Name == "basicNode") + { + if (!InstallOptions.origList.Contains(e.Node.Text)) + { + InstallOptions.iconsList.Add(e.Node.Text); + } + UninstallOptions.uninstIconsList.Remove(e.Node.Text); + Variables.InstallIcons = true; + } + else if (x.Name == "advancedNode") + { + if (!InstallOptions.origList.Contains(e.Node.Text)) + { + InstallOptions.iconsList.Add(e.Node.Text); + } + UninstallOptions.uninstIconsList.Remove(e.Node.Text); + Variables.InstallIcons = true; + } + } + else + { + if (x.Name == "extraNode") + { + InstallOptions.iconsList.Remove(e.Node.Name); + if (InstallOptions.origList.Contains(e.Node.Name)) + { + UninstallOptions.uninstExtrasList.Add(e.Node.Name); + } + } + else if (x.Name == "basicNode") + { + InstallOptions.iconsList.Remove(e.Node.Text); + if (InstallOptions.origList.Contains(e.Node.Text)) + { + UninstallOptions.uninstIconsList.Add(e.Node.Text); + } + Variables.InstallIcons = false; + } + else if (x.Name == "advancedNode") + { + InstallOptions.iconsList.Remove(e.Node.Text); + if (InstallOptions.origList.Contains(e.Node.Text)) + { + UninstallOptions.uninstIconsList.Add(e.Node.Text); + } + Variables.InstallIcons = false; + } + } + }); + if (e.Node.Name == "themeNode") + { + if (e.Node.Checked) + { + if (!InstallOptions.origList.Contains(e.Node.Name)) + { + InstallOptions.iconsList.Add(e.Node.Name); + } + UninstallOptions.UninstallThemes = false; + } + else + { + InstallOptions.iconsList.Remove(e.Node.Name); + if (InstallOptions.origList.Contains(e.Node.Name)) + { + UninstallOptions.UninstallThemes = true; + } + } + } + bool enable = InstallOptions.iconsList.Count > 0 + || UninstallOptions.uninstIconsList.Count > 0 + || UninstallOptions.uninstExtrasList.Count > 0 + || UninstallOptions.UninstallThemes; - 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 - } + if (InstallOptions.iconsList.Count > 0) Variables.RunInstaller = true; + if (UninstallOptions.uninstIconsList.Count > 0 + ||UninstallOptions.uninstExtrasList.Count > 0 + || UninstallOptions.UninstallThemes) Variables.RunUninstaller = true; + + _frmWizard.nextButton.Enabled = enable; + Variables.IsItemsSelected = enable; + + 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; + } + } + } + } + + private void TreeView1_AfterSelect(object sender, TreeViewEventArgs e) + { + if (e.Action != TreeViewAction.Unknown) + { + 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/ProgressPage.Designer.cs b/Rectify11Installer/Pages/ProgressPage.Designer.cs index d753e161c..103de4025 100644 --- a/Rectify11Installer/Pages/ProgressPage.Designer.cs +++ b/Rectify11Installer/Pages/ProgressPage.Designer.cs @@ -30,6 +30,8 @@ private void InitializeComponent() { this.progressText = new Rectify11Installer.Controls.DarkAwareLabel(); this.progressInfo = new Rectify11Installer.Controls.DarkAwareLabel(); + this.r1 = new Controls.DarkAwareRadioButton(); + this.r2 = new Controls.DarkAwareRadioButton(); //this.progressBar1 = new Rectify11Installer.Controls.CustomProgressBar(); this.timer1 = new System.Windows.Forms.Timer(); this.SuspendLayout(); @@ -50,6 +52,31 @@ private void InitializeComponent() // this.timer1.Interval = 10000; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + // + // r1 + // + this.r1.BackColor = System.Drawing.Color.Transparent; + this.r1.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.r1.ForeColor = System.Drawing.Color.Black; + this.r1.Location = new System.Drawing.Point(2, 120); + this.r1.Name = "r1"; + this.r1.Size = new System.Drawing.Size(200, 20); + this.r1.Text = "Restart now"; + this.r1.Visible = false; + this.r1.Checked = true; + + // + // r2 + // + this.r2.BackColor = System.Drawing.Color.Transparent; + this.r2.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.r2.ForeColor = System.Drawing.Color.Black; + this.r2.Location = new System.Drawing.Point(2, 145); + this.r2.Name = "r2"; + this.r2.Size = new System.Drawing.Size(200, 20); + this.r2.Text = "Restart later"; + this.r2.Visible = false; + // // progressInfo // @@ -67,7 +94,9 @@ private void InitializeComponent() this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; //this.Controls.Add(this.progressBar1); - this.Controls.Add(this.progressText); + this.Controls.Add(this.r1); + this.Controls.Add(this.r2); + this.Controls.Add(this.progressText); this.Controls.Add(this.progressInfo); this.Name = "ProgressPage"; this.SideImage = global::Rectify11Installer.Properties.Resources.install; @@ -83,6 +112,8 @@ private void InitializeComponent() private Controls.DarkAwareLabel progressText; private Controls.DarkAwareLabel progressInfo; + private Controls.DarkAwareRadioButton r1; + private Controls.DarkAwareRadioButton r2; private System.Windows.Forms.Timer timer1; } } diff --git a/Rectify11Installer/Pages/ProgressPage.cs b/Rectify11Installer/Pages/ProgressPage.cs index fd58a2fd3..df2a2c91d 100644 --- a/Rectify11Installer/Pages/ProgressPage.cs +++ b/Rectify11Installer/Pages/ProgressPage.cs @@ -1,10 +1,7 @@ using KPreisser.UI; -using Microsoft.VisualBasic; -using Microsoft.Win32; using Rectify11Installer.Core; using Rectify11Installer.Win32; using System; -using System.Diagnostics; using System.Drawing; using System.IO; using System.Threading.Tasks; @@ -15,8 +12,6 @@ public partial class ProgressPage : WizardPage { #region Variables private FrmWizard frmwiz; - private Timer timer2; - private int duration = 30; private int CurrentTextIndex = -1; private static readonly InstallerTexts[] Rectify11InstallerTexts = { @@ -49,11 +44,6 @@ public InstallerTexts(string Title, string Description, Bitmap image) public ProgressPage(FrmWizard frm) { InitializeComponent(); - timer2 = new() - { - Interval = 1000 - }; - timer2.Tick += Timer2_Tick; frmwiz = frm; NavigationHelper.OnNavigate += NavigationHelper_OnNavigate; } @@ -64,15 +54,15 @@ public void StartReset() progressText.Text = "Restarting your PC"; if (Variables.IsUninstall) { - progressInfo.Text = "Rectify11 has finished uninstalling. Your device needs to restart in order to complete the uninstallation, it will automatically restart in " + duration.ToString() + " seconds"; + progressInfo.Text = "Rectify11 has finished uninstalling. Your device needs to restart in order to complete the uninstallation"; } else { - progressInfo.Text = "Rectify11 has finished installing. Your device needs to restart in order to complete the installation, it will automatically restart in " + duration.ToString() + " seconds"; + progressInfo.Text = "Rectify11 has finished installing. Your device needs to restart in order to complete the installation"; } - frmwiz.InstallerProgress = "Restarting in " + duration.ToString() + " seconds"; + frmwiz.InstallerProgress = ""; frmwiz.UpdateSideImage = Properties.Resources.done; - timer2.Start(); + r1.Visible = r2.Visible = true; frmwiz.ShowRebootButton = true; frmwiz.SetRebootHandler = rebootButton_Click; } @@ -90,154 +80,163 @@ private async void NavigationHelper_OnNavigate(object sender, EventArgs e) { if (Variables.IsUninstall) { - frmwiz.versionLabel.Visible = false; - frmwiz.pictureBox1.Visible = true; - frmwiz.progressLabel.Visible = true; - RectifyPages.ProgressPage.Start(); - NativeMethods.SetCloseButton(frmwiz, false); - Uninstaller uninstaller = new(); - if (!await Task.Run(() => uninstaller.Uninstall(frmwiz))) - { - Common.Cleanup(); - Logger.CommitLog(); - TaskDialog.Show(text: "Rectify11 setup encountered an error, for more information, see the log in " + Path.Combine(Variables.r11Folder, "installer.log") + ", and report it to rectify11 development server", - title: "Error", - buttons: TaskDialogButtons.OK, - icon: TaskDialogStandardIcon.Error); - Application.Exit(); - } - - if (Variables.RestartRequired) + if (Directory.Exists(Path.Combine(Variables.Windir, "Resources", "Themes", "Rectified"))) + UninstallOptions.UninstallThemes = true; + + if (Directory.Exists(Path.Combine(Variables.Windir, "nilesoft"))) + UninstallOptions.uninstExtrasList.Add("shellNode"); + + if (Directory.Exists(Path.Combine(Variables.r11Folder, "extras", "AccentColorizer"))) + UninstallOptions.uninstExtrasList.Add("asdfNode"); + + if (File.Exists(Path.Combine(Variables.Windir, "web", "wallpaper", "Rectified", "img41.jpg"))) + UninstallOptions.uninstExtrasList.Add("wallpapersNode"); + + if (Directory.Exists(Path.Combine(Variables.progdata, "Microsoft", "User Account Pictures", "Default Pictures"))) + UninstallOptions.uninstExtrasList.Add("useravNode"); + + if (File.Exists(Path.Combine(Variables.progfiles, "Windows Sidebar", "sidebar.exe"))) + UninstallOptions.uninstExtrasList.Add("gadgetsNode"); + var list = PatchesParser.GetAll(); + var patch = list.Items; + string path = Path.Combine(Variables.r11Folder, "backup"); + for (var i = 0; i < patch.Length; i++) { - NativeMethods.SetCloseButton(frmwiz, false); - RectifyPages.ProgressPage.StartReset(); + 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")) + { + if (File.Exists(Path.Combine(path, patch[i].Mui))) + { + UninstallOptions.uninstIconsList.Add(patch[i].Mui); + } + } + else + { + if (File.Exists(Path.Combine(path, patch[i].Mui))) + { + UninstallOptions.uninstIconsList.Add(patch[i].Mui); + } + } + } + + } + if (patch[i].HardlinkTarget.Contains("%diag%")) + { + var name = patch[i].Mui.Replace("Troubleshooter: ", "DiagPackage") + ".dll"; + var newpath = Helper.FixString(patch[i].HardlinkTarget, false); + if (File.Exists(newpath)) + { + if (File.Exists(Path.Combine(path, "Diag", name))) + { + UninstallOptions.uninstIconsList.Add(patch[i].Mui); + } + } + } } - else - { - timer1.Stop(); - NativeMethods.SetCloseButton(frmwiz, true); - frmwiz.InstallerProgress = "Done, you can close this window"; - } - } - else - { + Variables.CompleteUninstall = true; frmwiz.versionLabel.Visible = false; ExtrasOptions.FinalizeIRectify11(); frmwiz.pictureBox1.Visible = true; frmwiz.progressLabel.Visible = true; RectifyPages.ProgressPage.Start(); NativeMethods.SetCloseButton(frmwiz, false); - Variables.isInstall = true; - Installer installer = new(); - //Logger.CommitLog(); - if (!await Task.Run(() => installer.Install(frmwiz))) + Uninstaller uninstaller = new(); + if (!await Task.Run(() => uninstaller.Uninstall(frmwiz))) { Common.Cleanup(); Logger.CommitLog(); - TaskDialog.Show(text: "Rectify11 setup encountered an error, for more information, see the log in " + Path.Combine(Variables.r11Folder, "installer.log") + ", and report it to rectify11 development server", + TaskDialog.Show(text: "Rectify11 setup encountered an error, for more information, see the log in " + Path.Combine(Variables.r11Folder, "installer.log") + ", and report it to rectify11 development server", title: "Error", buttons: TaskDialogButtons.OK, icon: TaskDialogStandardIcon.Error); Application.Exit(); } - else + //Logger.CommitLog(); + if (Variables.RestartRequired) { - Logger.CommitLog(); - if (Variables.RestartRequired) - { - RectifyPages.ProgressPage.StartReset(); - } - else - { - NativeMethods.SetCloseButton(frmwiz, true); - Variables.isInstall = false; - Variables.IsUninstall = true; - timer1.Stop(); - frmwiz.InstallerProgress = "Done, you can close this window"; - } - } - } - } - } - - /// - /// clears *.db cache files - /// - private async void ClearIconCache() - { - await Task.Run(() => Interaction.Shell("taskkill.exe /f /im explorer.exe", AppWinStyle.Hide, true)); - try - { - - DirectoryInfo di = new(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "microsoft", "windows", "explorer")); - var files = di.GetFiles("*.db"); - - for (var i = 0; i < files.Length; i++) - { - files[i].Attributes = FileAttributes.Normal; - if (File.Exists(files[i].FullName)) + NativeMethods.SetCloseButton(frmwiz, false); + RectifyPages.ProgressPage.StartReset(); + } + else { - File.Delete(files[i].FullName); + NativeMethods.SetCloseButton(frmwiz, true); + timer1.Stop(); + frmwiz.InstallerProgress = "Done, you can close this window"; } } - var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce", true); - key?.SetValue("ResetIconCache", Path.Combine(Variables.sys32Folder, "ie4uinit.exe") + " -show", RegistryValueKind.String); - key.Close(); - } - catch - { - TaskDialog.Show(text: "deleting icon cache failed", - title: "Rectify11 Setup", - buttons: TaskDialogButtons.OK, - icon: TaskDialogStandardIcon.Information); - } - } - - /// - /// applies the theme just before restart to set the mouse cursor properly - /// - private async void ApplyScheme() - { - if (InstallOptions.InstallThemes) - { - var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce", true); - string s = "e"; - if (key != null) + else { - if (InstallOptions.ThemeLight) + frmwiz.versionLabel.Visible = false; + ExtrasOptions.FinalizeIRectify11(); + frmwiz.pictureBox1.Visible = true; + frmwiz.progressLabel.Visible = true; + RectifyPages.ProgressPage.Start(); + NativeMethods.SetCloseButton(frmwiz, false); + Variables.isInstall = true; + if (Variables.RunUninstaller) + { + Uninstaller uninstaller = new(); + if (!await Task.Run(() => uninstaller.Uninstall(frmwiz))) + { + Common.Cleanup(); + Logger.CommitLog(); + TaskDialog.Show(text: "Rectify11 setup encountered an error, for more information, see the log in " + Path.Combine(Variables.r11Folder, "installer.log") + ", and report it to rectify11 development server", + title: "Error", + buttons: TaskDialogButtons.OK, + icon: TaskDialogStandardIcon.Error); + Application.Exit(); + } + Logger.CommitLog(); + } + if (Variables.RunInstaller) { - await Task.Run(() => Process.Start(Path.Combine(Variables.Windir, "Resources", "Themes", "lightrectified.theme"))); - s = Path.Combine(Variables.r11Folder, "SecureUXHelper.exe") + " apply " + '"' + "Rectify11 light theme" + '"'; + Installer installer = new(); + if (!await Task.Run(() => installer.Install(frmwiz))) + { + Common.Cleanup(); + Logger.CommitLog(); + TaskDialog.Show(text: "Rectify11 setup encountered an error, for more information, see the log in " + Path.Combine(Variables.r11Folder, "installer.log") + ", and report it to rectify11 development server", + title: "Error", + buttons: TaskDialogButtons.OK, + icon: TaskDialogStandardIcon.Error); + Application.Exit(); + } + Logger.CommitLog(); } - else if (InstallOptions.ThemeDark) + if (Variables.RestartRequired) { - await Task.Run(() => Process.Start(Path.Combine(Variables.Windir, "Resources", "Themes", "darkrectified.theme"))); - s = Path.Combine(Variables.r11Folder, "SecureUXHelper.exe") + " apply " + '"' + "Rectify11 dark theme" + '"'; + NativeMethods.SetCloseButton(frmwiz, false); + RectifyPages.ProgressPage.StartReset(); } else { - await Task.Run(() => Process.Start(Path.Combine(Variables.Windir, "Resources", "Themes", "black.theme"))); - s = Path.Combine(Variables.r11Folder, "SecureUXHelper.exe") + " apply " + '"' + "Rectify11 Dark theme with Mica" + '"'; + NativeMethods.SetCloseButton(frmwiz, true); + Variables.isInstall = false; + Variables.IsUninstall = true; + timer1.Stop(); + frmwiz.InstallerProgress = "Done, you can close this window"; } } - key.SetValue("ApplyTheme", s, RegistryValueKind.String); - key.SetValue("DeleteJunk", "rmdir /s /q " + Path.Combine(Environment.SpecialFolder.LocalApplicationData.ToString(), "junk"), RegistryValueKind.String); - key.Close(); } } + /// /// goes to the next text in the list to be shown /// private void NextText() { if (Variables.IsUninstall) - { - progressText.Text = "Thanks for using Rectify11"; - progressInfo.Text = "Uninstallation will be done in a few moments."; + { + progressText.Text = "Thanks for using Rectify11"; + progressInfo.Text = "Uninstallation will be done in a few moments."; - } - else + } + else { CurrentTextIndex++; if (CurrentTextIndex >= Rectify11InstallerTexts.Length) @@ -258,11 +257,16 @@ private void NextText() /// private void RestartRoutine() { - timer2.Stop(); - frmwiz.InstallerProgress = "Restarting..."; - ApplyScheme(); - ClearIconCache(); - Win32.NativeMethods.Reboot(); + //ApplyScheme(); + //ClearIconCache(); + Variables.isInstall = false; + Variables.IsUninstall = true; + if (r1.Checked) + { + NativeMethods.Reboot(); + } + else if (r2.Checked) + Application.Exit(); } private void timer1_Tick(object sender, EventArgs e) @@ -275,15 +279,6 @@ private async void rebootButton_Click(object sender, EventArgs e) await Task.Run(() => RestartRoutine()); } - private async void Timer2_Tick(object sender, EventArgs e) - { - duration -= 1; - frmwiz.InstallerProgress = "Restarting in " + duration.ToString() + " seconds"; - if (duration == 0) - { - await Task.Run(() => RestartRoutine()); - } - } #endregion } } diff --git a/Rectify11Installer/Pages/ThemeChoicePage.Designer.cs b/Rectify11Installer/Pages/ThemeChoicePage.Designer.cs index f8b0ec0f1..84975c2a4 100644 --- a/Rectify11Installer/Pages/ThemeChoicePage.Designer.cs +++ b/Rectify11Installer/Pages/ThemeChoicePage.Designer.cs @@ -117,6 +117,7 @@ private void InitializeComponent() this.themeSel.Items.Add(Rectify11Installer.Strings.Rectify11.themeLight); this.themeSel.Items.Add(Rectify11Installer.Strings.Rectify11.themeDark); this.themeSel.Items.Add(Rectify11Installer.Strings.Rectify11.themeBlack); + this.themeSel.Items.Add("Partial dark"); this.themeSel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; // // ThemeChoicePage diff --git a/Rectify11Installer/Pages/ThemeChoicePage.cs b/Rectify11Installer/Pages/ThemeChoicePage.cs index 69e728894..27e793b80 100644 --- a/Rectify11Installer/Pages/ThemeChoicePage.cs +++ b/Rectify11Installer/Pages/ThemeChoicePage.cs @@ -82,6 +82,13 @@ void themeSel_SelectedIndexChanged(object sender, System.EventArgs e) InstallOptions.ThemeDark = false; InstallOptions.ThemeBlack = true; break; + case 3: + themePreview.BackgroundImage = global::Rectify11Installer.Properties.Resources.darkPreview; + InstallOptions.ThemeLight = false; + InstallOptions.ThemeDark = false; + InstallOptions.ThemeBlack = false; + InstallOptions.ThemePDark = true; + break; default: themePreview.BackgroundImage = global::Rectify11Installer.Properties.Resources.lightPreview; InstallOptions.ThemeLight = true; diff --git a/Rectify11Installer/Pages/UninstallPage.Designer.cs b/Rectify11Installer/Pages/UninstallPage.Designer.cs deleted file mode 100644 index d794364ed..000000000 --- a/Rectify11Installer/Pages/UninstallPage.Designer.cs +++ /dev/null @@ -1,121 +0,0 @@ -namespace Rectify11Installer.Pages -{ - partial class UninstallPage - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - System.Windows.Forms.TreeNode treeNode2 = new System.Windows.Forms.TreeNode("Basic"); - System.Windows.Forms.TreeNode treeNode3 = new System.Windows.Forms.TreeNode("Advanced"); - treeNode1 = new System.Windows.Forms.TreeNode(Rectify11Installer.Strings.Rectify11.optionIcons, new System.Windows.Forms.TreeNode[]{ - treeNode2, - treeNode3}); - treeNode4 = new System.Windows.Forms.TreeNode(Rectify11Installer.Strings.Rectify11.optionThemes); - System.Windows.Forms.TreeNode treeNode5 = new System.Windows.Forms.TreeNode(Rectify11Installer.Strings.Rectify11.optionExtra, Rectify11Installer.Core.ExtrasOptions.GetExtras().ToArray()); - this.groupBox1 = new Rectify11Installer.Controls.GroupBox(); - this.label1 = new Rectify11Installer.Controls.DarkAwareLabel(); - this.treeView1 = new Rectify11Installer.Controls.DarkAwareTreeView(); - this.uninstAppChk = new Rectify11Installer.Controls.DarkAwareCheckBox(); - this.SuspendLayout(); - // - // groupBox1 - // - this.groupBox1.BackColor = System.Drawing.Color.Transparent; - this.groupBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.groupBox1.Location = new System.Drawing.Point(0, 48); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(345, 294); - this.groupBox1.TabIndex = 0; - this.groupBox1.Text = "groupBox1"; - // - // label1 - // - this.label1.BackColor = System.Drawing.Color.Transparent; - this.label1.Font = new System.Drawing.Font("Segoe UI Semibold", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label1.ForeColor = System.Drawing.Color.Black; - this.label1.Location = new System.Drawing.Point(0, 5); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(361, 40); - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.label1.TabIndex = 1; - this.label1.Text = Rectify11Installer.Strings.Rectify11.uninstallChoiceDescription; - // - // treeView1 - // - this.treeView1.BackColor = System.Drawing.Color.White; - this.treeView1.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.treeView1.CheckBoxes = true; - this.treeView1.ForeColor = System.Drawing.Color.Black; - this.treeView1.Location = new System.Drawing.Point(1, 58); - this.treeView1.Name = "treeView1"; - treeNode1.Name = "sysIconsNode"; - treeNode1.Text = Rectify11Installer.Strings.Rectify11.optionIcons; - treeNode5.Name = "extraNode"; - treeNode5.Text = Rectify11Installer.Strings.Rectify11.optionExtra; - treeNode4.Name = "themeNode"; - treeNode4.Text = Rectify11Installer.Strings.Rectify11.optionThemes; - treeNode2.Name = "basicNode"; - treeNode2.Text = "Basic"; - treeNode3.Name = "advancedNode"; - treeNode3.Text = "Advanced"; - this.treeView1.Nodes.AddRange(new System.Windows.Forms.TreeNode[] { - treeNode1, - treeNode4, - treeNode5}); - this.treeView1.Size = new System.Drawing.Size(342, 270); - this.treeView1.TabIndex = 2; - this.treeView1.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterCheck); - // - // InstallOptnsPage - // - this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.Controls.Add(this.treeView1); - this.Controls.Add(this.label1); - this.Controls.Add(this.groupBox1); - this.Name = "UninstallPage"; - this.SideImage = global::Rectify11Installer.Properties.Resources.installoptns; - this.WizardHeader = "Uninstall"; - this.HeaderVisible = true; - this.FooterVisible = true; - this.UpdateFrame = true; - this.Page = Rectify11Installer.Core.TabPages.uninstPage; - this.NextButtonText = Rectify11Installer.Strings.Rectify11.buttonNext; - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private Controls.GroupBox groupBox1; - private Controls.DarkAwareLabel label1; - private Controls.DarkAwareTreeView treeView1; - private Controls.DarkAwareCheckBox uninstAppChk; - public System.Windows.Forms.TreeNode treeNode4; - public System.Windows.Forms.TreeNode treeNode1; - } -} diff --git a/Rectify11Installer/Pages/UninstallPage.cs b/Rectify11Installer/Pages/UninstallPage.cs deleted file mode 100644 index add31ac41..000000000 --- a/Rectify11Installer/Pages/UninstallPage.cs +++ /dev/null @@ -1,327 +0,0 @@ -using Rectify11Installer.Core; -using System; -using System.IO; -using System.Linq; -using System.Windows.Forms; - -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; - } - - 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]; - var themeNode = treeView1.Nodes[1]; - 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); - - // 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); - } - 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) - { - 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) - { - UninstallOptions.uninstDummylist.Add(e.Node.Text); - } - else - { - 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); - Variables.InstallIcons = true; - } - else - { - UninstallOptions.uninstIconsList.Remove(x.Text); - UninstallOptions.uninstDummylist.Remove(x.Text); - Variables.InstallIcons = false; - } - }); - } - if (e.Node.Name == "sysIconsNode") - { - if (e.Node.Checked) - { - UninstallOptions.uninstDummylist.Add(e.Node.Text); - } - else - { - 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); - Variables.InstallIcons = true; - } - 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"))) - { - UninstallOptions.uninstDummylist.Add(x.Text); - } - else if (((x.Name == "basicNode") || (x.Name == "advancedNode"))) - { - UninstallOptions.uninstDummylist.Remove(x.Text); - } - - }); - } - if (e.Node.Name == "advancedNode") - { - if (e.Node.Checked) - { - UninstallOptions.uninstDummylist.Add(e.Node.Text); - } - else - { - 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); - Variables.InstallIcons = true; - } - else - { - UninstallOptions.uninstIconsList.Remove(x.Text); - UninstallOptions.uninstDummylist.Remove(x.Text); - Variables.InstallIcons = false; - } - }); - } - if (e.Node.Name == "extraNode") - { - if (e.Node.Checked) - { - UninstallOptions.uninstDummylist.Add(e.Node.Text); - } - 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); - } - 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") - { - 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); - Variables.InstallIcons = true; - } - 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") - { - UninstallOptions.uninstDummylist.Add(x.Text); - } - } - 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); - Variables.InstallIcons = false; - } - 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; - UninstallOptions.uninstDummylist.Add(e.Node.Text); - } - else - { - UninstallOptions.UninstallThemes = false; - UninstallOptions.uninstDummylist.Remove(e.Node.Text); - } - } - 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; - } - } - } - - #endregion - } -} diff --git a/Rectify11Installer/Properties/AssemblyInfo.cs b/Rectify11Installer/Properties/AssemblyInfo.cs index 85bce08ca..f3e2114a8 100644 --- a/Rectify11Installer/Properties/AssemblyInfo.cs +++ b/Rectify11Installer/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Rectify11")] [assembly: AssemblyProduct("Rectify11 Installer")] -[assembly: AssemblyCopyright("Copyright © 2022 The Rectify11 Team")] +[assembly: AssemblyCopyright("Copyright © 2023 The Rectify11 Team")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,6 +32,6 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("3.0.42.0")] -[assembly: AssemblyFileVersion("3.0.42.0")] +[assembly: AssemblyVersion("3.0.48.0")] +[assembly: AssemblyFileVersion("3.0.48.0")] [assembly: NeutralResourcesLanguage("")] diff --git a/Rectify11Installer/Properties/Resources.Designer.cs b/Rectify11Installer/Properties/Resources.Designer.cs index 901829291..edc78f399 100644 --- a/Rectify11Installer/Properties/Resources.Designer.cs +++ b/Rectify11Installer/Properties/Resources.Designer.cs @@ -201,46 +201,35 @@ internal static System.Drawing.Bitmap blackPreview { } /// - /// Looks up a localized string similar to shell + /// Looks up a localized string similar to settings ///{ - /// var + /// priority=1 + /// exclude.where = !process.is_explorer + /// showdelay = 100 + /// // Options to allow modification of system items + /// modify.remove.duplicate=1 + /// tip /// { - /// isw11=sys.is11 - /// } - /// - /// set - /// { - /// theme - /// { - /// name="modern" - /// background - /// { - /// //opacity=85 - /// //effect=1 - /// } - /// image.align = 2// 0 = checked, 1 = image, 2 = both - /// image.color = [color.default,color.accent_light1] - /// } - /// - /// tip - /// { - /// enabled=1 - /// opacity=100 - /// width=400 - /// radius=1 - /// time=1.25 - /// padding=[10,10] - /// } - /// - /// exclude.where = !process.is_explorer - /// showdelay=100 + /// enabled=1 + /// opacity=100 + /// width=400 + /// radius=1 + /// time=1.25 + /// padding=[10,10] /// } + ///} + ///theme + ///{ + /// name="modern" + ///} + ///import 'imports/theme.nss' + ///import 'imports/images.nss' /// - /// images import 'imports/images.nss' + ///import 'imports/modify.nss' + ///modify(where=this.title.length > 15 menu=title.more_options) /// - /// static - /// { - /// impor [rest of string was truncated]";. + ///menu(mode="multiple" title="Pin/Unpin" image=icon.pin) {} + ///menu(mod [rest of string was truncated]";. /// internal static string config1 { get { @@ -249,46 +238,34 @@ internal static string config1 { } /// - /// Looks up a localized string similar to shell + /// Looks up a localized string similar to settings ///{ - /// var + /// priority=1 + /// exclude.where = !process.is_explorer + /// showdelay = 100 + /// // Options to allow modification of system items + /// modify.remove.duplicate=1 + /// tip /// { - /// isw11=sys.is11 - /// } - /// - /// set - /// { - /// theme - /// { - /// name="modern" - /// background - /// { - /// //opacity=85 - /// //effect=1 - /// } - /// image.align = 2// 0 = checked, 1 = image, 2 = both - /// image.color = [color.default,color.accent_light1] - /// } - /// - /// tip - /// { - /// enabled=1 - /// opacity=100 - /// width=400 - /// radius=1 - /// time=1.25 - /// padding=[10,10] - /// } - /// - /// exclude.where = !process.is_explorer - /// showdelay=100 + /// enabled=1 + /// opacity=100 + /// width=400 + /// radius=1 + /// time=1.25 + /// padding=[10,10] /// } + ///} + ///theme + ///{ + /// name="modern" + ///} + ///import 'imports/theme.nss' + ///import 'imports/images.nss' /// - /// images import 'imports/images.nss' + ///import 'imports/modify.nss' /// - /// static - /// { - /// impor [rest of string was truncated]";. + ///menu(mode="multiple" title="Pin/Unpin" image=icon.pin) {} + ///menu(mode="multiple" title=title.more_options image=icon.more_options) [rest of string was truncated]";. /// internal static string config2 { get { @@ -516,6 +493,16 @@ internal static System.Drawing.Bitmap menusD { } } + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] NSudoL { + get { + object obj = ResourceManager.GetObject("NSudoL", resourceCulture); + return ((byte[])(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -673,15 +660,5 @@ internal static System.Drawing.Bitmap wallpapers { return ((System.Drawing.Bitmap)(obj)); } } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] wsudo { - get { - object obj = ResourceManager.GetObject("wsudo", resourceCulture); - return ((byte[])(obj)); - } - } } } diff --git a/Rectify11Installer/Properties/Resources.resx b/Rectify11Installer/Properties/Resources.resx index 9bb6dcb00..98cbce574 100644 --- a/Rectify11Installer/Properties/Resources.resx +++ b/Rectify11Installer/Properties/Resources.resx @@ -2495,7 +2495,7 @@ ..\Resources\extras.7z;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - ..\Resources\Rectify11CPL.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + ..\Resources\Rectify11ControlCenter.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -28576,7 +28576,7 @@ TY14mjisajrlCxmPVc5bnLVylTXPyW8YzOkrKa7THEUMS4gjAREKqiihDBsRWnVSLCRpX+rgH3H9CXIp 5CqBkWMBFWiQXT/4G/zu1spPTXpJQQnoenGcjzGgexdo1Bzn+9hxGieA/xm40lv+Sh2Y+yS91tLCR8DA NnBx3dKUPeByBxh+MmRTdiU/TSGfB97P6JmywOAt0Lvm9dbcx+kDkKaulm+Ag0NgvEDZ6x3u3dPe25// - uP1B+gHVcHLOYev7uAAAAAlwSFlzAAALDQAACw0B7QfALAAAAAd0SU1FB+cEFRUPCihyFL0AAEggSURB + uP1B+gHVcHLOYev7uAAAAAlwSFlzAAALDAAACwwBP0AiyAAAAAd0SU1FB+cEFRUPCihyFL0AAEggSURB VHhe7d13dxznlSbw+QJ7dv7Zs/vHnrMfZdaenZn1jiWLJHIics4Ac1K0skRFy7JkW9LIY1mSbXlk2ZKD PLZlW6SYSYAASJDIOQOMkN699w1Vb1W/BTaKDaBBPs85z2kkAqCo+uHiVnX33yEIgiAIgiAIgiAIgiAI giAIgiAIgiAIgiAIgiAIgiAIgiAIgiAIgiAIgiAIgiAIgiAIgiAIgiAIgiAIgiAIgiAIgiAIgiAIgiAI @@ -29200,7 +29200,7 @@ iVBORw0KGgoAAAANSUhEUgAAANsAAADTCAYAAAAI0GYtAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL - DgAACw4BQL7hQQAAfFdJREFUeF7tvQm4ZVV17X9vXqIgSgERjREFe2lMUIMCojSidEoXsU0U/GtEoFqK + DQAACw0B7QfALAAAfFdJREFUeF7tvQm4ZVV17X9vXqIgSgERjREFe2lMUIMCojSidEoXsU0U/GtEoFqK ouhL897zvcSo7yUamyj4bBDpRGwQ1BIUsaEHwR5RAbGjU2OXu/9jzDXH3HOts8+tWzRVXLibb3xr7bX3 OdS9Z//umHOutfeZmNvmtrltbpvb5ra5bW6b2+a2uW1um9vmtrltbpvb7uq2YsVOEyveeMLEijeshK6D ujndq3ULhM9qxdugrf1TnNvu1ZtBZoANfaBzmj0ieDv5pzq33au2FSs2gJO9deBDm9OsFj9TfLZz271k @@ -29737,7 +29737,7 @@ iVBORw0KGgoAAAANSUhEUgAAAQEAAAExCAYAAAB8lhdQAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - vgAADr4B6kKxwAAAEhlJREFUeF7t3emLHNXbxvH6OxRcEEERBN8oCoqCLwQVF1zBFUXjvqEGt6jR4BKN + vQAADr0BR/uQrQAAEhlJREFUeF7t3emLHNXbxvH6OxRcEEERBN8oCoqCLwQVF1zBFUXjvqEGt6jR4BKN uMQ9btGoMRE1mIhb1GjUaNyNBpe4a8wyJmMWEM6P6/CcpqZTM/bEO/dTPff3wIdMV1VXhzP3ubqquqdO tXLN+hTNqrUbtojVgxuBvlM1FTN609ShQL8hBP5PU+cAEVRNCwHEQQgAwRECQHCEABAcIQAERwgAwREC QHCEABAcIQAERwgAwRECQHCEABAcIQAERwgAwRECQHCEABAcIQAERwgAwRECQHCEABAcIQAERwgAwREC @@ -32533,7 +32533,7 @@ iVBORw0KGgoAAAANSUhEUgAAANMAAAC6CAYAAAA0/HhLAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL - DgAACw4BQL7hQQAAfbVJREFUeF7tnQeYFMXWhn+VnGR3ATNiVswEASNGkJxz2pxzzrtszsQl5yA5J1EE + DQAACw0B7QfALAAAfbVJREFUeF7tnQeYFMXWhn+VnGR3ATNiVswEASNGkJxz2pxzzrtszsQl5yA5J1EE QTCAgCg5ZxAV9V7v1eu9ff5zTlX11Mw20QURp5/ne6qnu6ZnYOrd75zT1d3/9xdbbm3cuHHFBg0aVMH1 mvd16HX3y+8fzXn90/Mn3/j8Z3h90w+7X152IPHhLl734v7bUTWkal2o7z3v9uW+derUqUmidau+r6zY n0B9XVxc+Lh169al497u9kb3e/S+LbW+tJ/6oiyP69C3luxreVz+Dqtsx6XPl9+hFvV9ddXBXP249G97 @@ -33075,7 +33075,7 @@ iVBORw0KGgoAAAANSUhEUgAAAvMAAAHtCAYAAACUMfGhAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL - DgAACw4BQL7hQQAA/7JJREFUeF7svQe8JVWV7z9KztCCQJORIKigEhRMmEVUEMXsKGLEBAIdgW5yzjnn + DQAACw0B7QfALAAA/7JJREFUeF7svQe8JVWV7z9KztCCQJORIKigEhRMmEVUEMXsKGLEBAIdgW5yzjnn 1IAkCU0nkoyjjDpjmHGc8N7z+f4zOgp0Nyix/uu3av32WXvVrnNvN6Bw2efz+d4dKpw6Ffb+nnV31fmb +qqv+qqv+qqv+qqv+qqv+qqvv9TrJfjTNI0W5KVlplKP9CVIMY+V9WXL6HRk7NWXH/oK62U+S3093tu9 f0r9euSV5W2aLuvKuoxbLi1j8/Glyxr6CtP11VOXvZdWuvXIi+vV+dw6/DzZq299tnzvNEuR4MXpePl5 @@ -37197,7 +37197,7 @@ kmMJDwp3ZSxb8gOpMmcUryu28qvmzz3VC8OL9sy00mV2MsEkMeJoGKyyTJ4ifbLaorgkZD9aw9/h++Pi MsS1jCmOMVaw0H0/6g9+d+tmB/rLSeEo1D953ls3NGzD15bnfR563tcRBB/hwq74V0ow/C76VkXrOoCW DTi7rGjGDpxvQvtDQXd0XwrKDGSz8Hoi35SGtmtomiv39rPP8R0kpaupK9jbh56cZM/XeHdjdW9/nvH7 - I/oNLm9yi2geETYAAAAJcEhZcwAACw4AAAsOAUC+4UEAAAAHdElNRQfnBBIIDDalGTNjAABVT0lEQVR4 + I/oNLm9yi2geETYAAAAJcEhZcwAACw0AAAsNAe0HwCwAAAAHdElNRQfnBBIIDDalGTNjAABVT0lEQVR4 Xu29d5Qd133nKVkjWWPLVs4SRYo5gkkSZQXLMxuOdzwb5uzOH97Z1dnZszNWIiUq2ZZly9mWx7JIRUqk mMQAJmSgu4HOOecc0MgASUQCJEiEu9/vDVW3qm7Vq/f6VXeDur9zPmyw++VXn++9t+6tqtf48uXLly9f vnz58uXLly9fvnz58uXLly9fvnz58uXLly9fvnz58uXLly9fvnz58uXLly9fvnz58uXLly9fvnz58uXL @@ -37574,7 +37574,7 @@ K44lPCDclbRsyQ/MljipeEOxlcmbP/dUL2xetmemlS6zkygTxJhCwyDPKhlyhGW1RXGJy36kir/D90+J yxDXKqY4xljDQvf9qD/43a2b6u8rJTVHoP7Z8967oWEbigXP+zryvOIx1D7BpV32rx3C8IfohbLWdQCt m3B+VdaMHbjYgtBjVnd0X6qVGUil4O1UvmkO2m6gaaHU288+J/eQkK4mr2FvH3rSkr1Y5d2Nlb39ecbv - j8g36+Fy14kyuVkAAAAJcEhZcwAADr0AAA69AUf7kK0AAAAHdElNRQfnBBMWGRoOcFCLAABekElEQVR4 + j8g36+Fy14kyuVkAAAAJcEhZcwAADrwAAA68AZW8ckkAAAAHdElNRQfnBBMWGRoOcFCLAABekElEQVR4 Xu29baxt13Ud5jZp06RJk7z3SH1YpMgnyhIpkrIoUaRcy7ZgSQX0SMm2KJlfkoM+ErYlNSZpRErFyrVF SolkxzbJgJRFGiQtiqICCAhSgAQaQLbYAm0RiD+Khm3aAkzk8ofTokX6o/x5usY+a+w7zrhzrr3PeU9u Ac4JDOy15hxzrrXvnmu8fe59790fKSsrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysr @@ -37990,7 +37990,7 @@ LjuWcL9wR8qyJT84U+KU4nXFVrZg/txTvbBhyZ6eUrrMdsYYZ5I4GgYFVsiSJyqrLYpLQvZjVfxtvj8u LkNcK5jiGGEVC933o/7gd7duuq+3lNQQg5pnz3vvhNptKG553teR5xWPIfQEl3bZv3oIgx+ib5W1jgNo 2oDzq7Jm7MDFJrQ+5nRH96WQzGA6DW+n8k2z0HwD9fOl3n72ObmHpHQ1cQ17+9CVkeyFKu+uq+ztzzN+ - f8S+AdWEcs7TDTOhAAAACXBIWXMAAA69AAAOvQFH+5CtAAAAB3RJTUUH5wQVEx0fOdb8NwAAIZlJREFU + f8S+AdWEcs7TDTOhAAAACXBIWXMAAA68AAAOvAGVvHJJAAAAB3RJTUUH5wQVEx0fOdb8NwAAIZlJREFU eF7tnV2IXeeVptUzmempVne6M51Md5KWYrczFz030tUw0Be+ihgjIxMhQ2gjYyPfSNgkTIcYD2MwEg4Z YiZYMMQ0pJBw6BiZBA8RKnJhbCQkJGJsHBLSuFCZgTY2Nm0SYjzESOz53n3WKq3z1T7fPqd+dn2q8zyw VPv//Ky3nvr2PqXauwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA @@ -38146,7 +38146,7 @@ cSzhAeHOpGVLfmC2xEnFG4qtTN78uad6YdOyPTOtdJkdRJkgxhQaBnlWyZCjV1ZbFJe47Eeq+Nt9/5S4 DHGtYopjjDUsdN+P+oPf3bqp/r5SUlME6p49770L6rehWPC8ryPPKx5D8Aku7bJ/7RCGP0QvlLXOA2jZ hPOrsmbswMUWtD1mdUf3paDMQCoFb6fyTXMQuoHGhVJvP/uc3ENCupq8hr196E5L9mKVdzdU9vbnGb8/ - It+t4nK+K+reqgAAAAlwSFlzAAAOvQAADr0BR/uQrQAAAAd0SU1FB+cEExU1L2O0QV8AANP7SURBVHhe + It+t4nK+K+reqgAAAAlwSFlzAAAOvAAADrwBlbxySQAAAAd0SU1FB+cEExU1L2O0QV8AANP7SURBVHhe 7P170Pb9Wtf3dctagBI1Cos0bqLAAgTXYhdRxCRKJoJNADdRRFyANi6lmejYsolpATUgoHGhIpuauIsa AcGp05n+EW07HVv0D/+pdKad0em006FDut8o/tOr5/u6z9f9fJ4vv+t+SGvbiOc185lj9zmO4/v7/n7f 4/6d1/089/mfe/w8fh4/j5/Hz/+Xfz78a5/+8w888MD//3A/io+f/3d/rjb1gQce+P8/7kf08fMT+bna @@ -39063,7 +39063,7 @@ LjuWcL9wR8qyJT84U+KU4nXFVrZg/txTvbBhyZ6eUrrMdsYYZ5I4GgYFVsiSJyqrLYpLQvZjVfxtvj8u LkNcK5jiGGEVC933o/7gd7duuq+3lNQQg5pnz3vvhNptKG553teR5xWPIfQEl3bZv3oIgx+ib5W1jgNo 2oDzq7Jm7MDFJrQ+5nRH96WQzGA6DW+n8k2z0HwD9fOl3n72ObmHpHQ1cQ17+9CVkeyFKu+uq+ztzzN+ - f8S+AdWEcs7TDTOhAAAACXBIWXMAAA69AAAOvQFH+5CtAAAAB3RJTUUH5wQVEx0MvWi96QAAL+lJREFU + f8S+AdWEcs7TDTOhAAAACXBIWXMAAA68AAAOvAGVvHJJAAAAB3RJTUUH5wQVEx0MvWi96QAAL+lJREFU eF7tnX+IXWWa52t2e3c2k56e6R17Z1on1fbYOzADi8E/hln6D/9YDJGEiGJoMSgz2LQkGJS2SXDpRkmh uNjYJLQoNgkJLhoiIw4JKSIGQ0JCQooJSstKQqqYpkMkoUVJiBhKzj7fc5+n8tyn3nN/nntz37rfD3yt 8+ue855T9/n4nnMr950ghBAyeP6IYZibGtInqYvKMMzND+mC1AVkGGb0QlqQumAx/4FhmKEmVYc+JEHq @@ -39970,7 +39970,7 @@ y44lPCTcnbFsyQ+mKpxRvK7YypfMn3uqF7Yu2bMzSpfZxSRTxIijYVBihTxF+mW1RXFJyH60jr/T98fF ZYhrBVMc46xioft+1B/87tbNDg5Uklqj0Pjsee890LQN5S3P+zryvPIxhJ7g0q76Vw9h5EP0rarWfQDh DTi/qmrGDlxsQsdjQXd0XwrJDGaz8HYq35SG9htoma/09rPPyT0kpavpa9jbh96cZC/UeXdzbW9/nvH7 - I/oNJw5yiL+bZvcAAAAJcEhZcwAACw4AAAsOAUC+4UEAAAAHdElNRQfnBBQPAyD2cdOkAABNs0lEQVR4 + I/oNJw5yiL+bZvcAAAAJcEhZcwAACw0AAAsNAe0HwCwAAAAHdElNRQfnBBQPAyD2cdOkAABNs0lEQVR4 Xu29CZglV3mmiRa0IKRCkoWW2qtUS+77vlbuS2VVbpVL7atqkUqSG6RC+y4h2dhjut3T7QHbYDMtY+hR A8YsBgkJEGAYYzzGbnqZ9nQ309PdIIRRaQHpzP+dOCfuiRN/xI24eaMyq3T+53mfvDe2vHkz3i9ORJyI eIcrV65cuXLlypUrV65cuXLlypUrV65cuXLlypUrV65cuXLlypUrV65cuXLlypUrV65cuXLlypUrV65c @@ -40314,7 +40314,7 @@ UyeeIY5oukH5QtZjjfMWZ71SZ+1z8huG88ZKmus0xxDHEhJIQoKKOsqowEaUVoMUCynal3v4R1x/klwq ucpg5FhAFToU1w/+Br+7tQrTU15SWAb6XhznYxwI7gKthuN8HztO6wTwPwNXRsdfbQJzn6Q3OlrkCBjc Bi6uO5q6B1zuAMNPNcVUXMlPUygUgPczeqYcMHQL9K95vbX3cfoAZKir5Rvg4BCYKFL2eo97h7p7+/Mf - tz/IP2K0cqCm0YrQAAAACXBIWXMAAAsOAAALDgFAvuFBAAAAB3RJTUUH5wQUCAkQLwgdBwAAXdlJREFU + tz/IP2K0cqCm0YrQAAAACXBIWXMAAAsNAAALDQHtB8AsAAAAB3RJTUUH5wQUCAkQLwgdBwAAXdlJREFU eF7tvXfQZdWV5anqru4xEcVMx/w9UxETY6pK1SUL6d3nvXfpSUzinQBhSgZV15RRqVoGhJCENwmZQJKk z/zSe2/wCFVJ1QJkWkLeIKRzZq299zn33Pvu+zITIdCT3olYsc817yXm/nLtve99576rPuqjPuqjPuqj PuqjPuqjPuqjPuqjPuqjPuqjPuqjPuqjPuqjPuqjPuqjPuqjPuqjPuqjPuqjPuqjPuqjPuqjPuqjPuqj @@ -40742,7 +40742,7 @@ iVBORw0KGgoAAAANSUhEUgAAAJEAAAB5CAYAAAA5z8PMAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL - EQAACxEBf2RfkQAAItNJREFUeF7tnQd4FVX6xocVRF0FLGthV81aEHVX2V1WXZd1wbIWVkBWcVWECCK9 + EAAACxABrSO9dQAAItNJREFUeF7tnQd4FVX6xocVRF0FLGthV81aEHVX2V1WXZd1wbIWVkBWcVWECCK9 SpEmofcO0oSE3qUYqmAoKsWCIKgrakBC6IYiISQk7//9zsy5nAwn5XKzJux/7vP8nrll7tybOb/7ft+Z uVwcfdmzZ0/lH374IYGkEAQE5IJ4Eu2p414oULekpCQcOXIEKSkpOHr0aEBAjhw+fBjii3ijBEpMTIyW OwJ5AsJBfBFv6E9lR6Lp0KFD1hUDAnJDEkn8EYmsKwQE5IWkEf1JCSQKiAjxJ5AoICICiQIiJpAoIGIC @@ -40894,7 +40894,7 @@ AElFTkSuQmCC - - ..\Resources\wsudo.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\NSudoL.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 \ No newline at end of file diff --git a/Rectify11Installer/Rectify11Installer.csproj b/Rectify11Installer/Rectify11Installer.csproj index d0661cba0..258234d3d 100644 --- a/Rectify11Installer/Rectify11Installer.csproj +++ b/Rectify11Installer/Rectify11Installer.csproj @@ -96,6 +96,7 @@ + @@ -181,12 +182,6 @@ InstallConfirmation.cs - - UserControl - - - UninstallPage.cs - UserControl @@ -366,6 +361,7 @@ + diff --git a/Rectify11Installer/Resources/NSudoL.exe b/Rectify11Installer/Resources/NSudoL.exe new file mode 100644 index 000000000..ba3756a11 Binary files /dev/null and b/Rectify11Installer/Resources/NSudoL.exe differ diff --git a/Rectify11Installer/Resources/config1.txt b/Rectify11Installer/Resources/config1.txt index 022a15149..ada2ca674 100644 --- a/Rectify11Installer/Resources/config1.txt +++ b/Rectify11Installer/Resources/config1.txt @@ -1,50 +1,30 @@ -shell +settings { - var + priority=1 + exclude.where = !process.is_explorer + showdelay = 100 + // Options to allow modification of system items + modify.remove.duplicate=1 + tip { - isw11=sys.is11 + enabled=1 + opacity=100 + width=400 + radius=1 + time=1.25 + padding=[10,10] } - - set - { - theme - { - name="modern" - background - { - //opacity=85 - //effect=1 - } - image.align = 2// 0 = checked, 1 = image, 2 = both - image.color = [color.default,color.accent_light1] - } - - tip - { - enabled=1 - opacity=100 - width=400 - radius=1 - time=1.25 - padding=[10,10] - } - - exclude.where = !process.is_explorer - showdelay=100 - } - - images import 'imports/images.nss' +} +theme +{ + name="modern" +} +import 'imports/theme.nss' +import 'imports/images.nss' - static - { - import 'imports/static.nss' - item(where=this.title.length > 15 menu=title.more_options) - } +import 'imports/modify.nss' +modify(where=this.title.length > 15 menu=title.more_options) - dynamic - { - menu(mode="multiple" title="Pin/Unpin" image=icon.pin) { } - menu(mode="multiple" title=title.more_options image=icon.more_options) { } - import 'imports/taskbar.nss' - } -} \ No newline at end of file +menu(mode="multiple" title="Pin/Unpin" image=icon.pin) {} +menu(mode="multiple" title=title.more_options image=icon.more_options) {} +import 'imports/taskbar.nss' diff --git a/Rectify11Installer/Resources/config2.txt b/Rectify11Installer/Resources/config2.txt index b22dab6a0..d2422a7c9 100644 --- a/Rectify11Installer/Resources/config2.txt +++ b/Rectify11Installer/Resources/config2.txt @@ -1,49 +1,29 @@ -shell +settings { - var + priority=1 + exclude.where = !process.is_explorer + showdelay = 100 + // Options to allow modification of system items + modify.remove.duplicate=1 + tip { - isw11=sys.is11 + enabled=1 + opacity=100 + width=400 + radius=1 + time=1.25 + padding=[10,10] } - - set - { - theme - { - name="modern" - background - { - //opacity=85 - //effect=1 - } - image.align = 2// 0 = checked, 1 = image, 2 = both - image.color = [color.default,color.accent_light1] - } - - tip - { - enabled=1 - opacity=100 - width=400 - radius=1 - time=1.25 - padding=[10,10] - } - - exclude.where = !process.is_explorer - showdelay=100 - } - - images import 'imports/images.nss' +} +theme +{ + name="modern" +} +import 'imports/theme.nss' +import 'imports/images.nss' - static - { - import 'imports/static.nss' - } +import 'imports/modify.nss' - dynamic - { - menu(mode="multiple" title="Pin/Unpin" image=icon.pin) { } - menu(mode="multiple" title=title.more_options image=icon.more_options) { } - import 'imports/taskbar.nss' - } -} \ No newline at end of file +menu(mode="multiple" title="Pin/Unpin" image=icon.pin) {} +menu(mode="multiple" title=title.more_options image=icon.more_options) {} +import 'imports/taskbar.nss' diff --git a/Rectify11Installer/Resources/extras.7z b/Rectify11Installer/Resources/extras.7z index be7c88e0b..288df1f48 100644 Binary files a/Rectify11Installer/Resources/extras.7z and b/Rectify11Installer/Resources/extras.7z differ diff --git a/Rectify11Installer/Resources/files.7z b/Rectify11Installer/Resources/files.7z index 4062ee0c6..a7c5212ac 100644 Binary files a/Rectify11Installer/Resources/files.7z and b/Rectify11Installer/Resources/files.7z differ diff --git a/Rectify11Installer/Resources/themes.7z b/Rectify11Installer/Resources/themes.7z index 066617fa2..ed57831b3 100644 Binary files a/Rectify11Installer/Resources/themes.7z and b/Rectify11Installer/Resources/themes.7z differ diff --git a/Rectify11Installer/Resources/wsudo.exe b/Rectify11Installer/Resources/wsudo.exe deleted file mode 100644 index 687d39856..000000000 Binary files a/Rectify11Installer/Resources/wsudo.exe and /dev/null differ diff --git a/Rectify11Installer/Strings/Rectify11.zh-cn.resx b/Rectify11Installer/Strings/Rectify11.zh-cn.resx index 8b6b3b503..5708f55a6 100644 --- a/Rectify11Installer/Strings/Rectify11.zh-cn.resx +++ b/Rectify11Installer/Strings/Rectify11.zh-cn.resx @@ -136,19 +136,19 @@ 在安装 Rectify11 之前,您必须同意此许可协议: - 纠正您当前的 Windows 安装。 + 改正您当前的系统 立即安装 - 恢复原始的 Windows 外观。 + 恢复原始的系统外观。 卸载 Rectify11 - 更新您现有的 Rectify11 安装。 + 更新 Rectify11 立即更新 @@ -160,10 +160,10 @@ 欢迎 - 安装程序将完成在 PC 上安装 Rectify11 所需的各个步骤,以获得更一致的体验。建议在继续之前关闭所有后台应用程序。选择所需的选项以继续。 + 安装程序将完成在此电脑上安装 Rectify11 所需的各个步骤,以获得更一致的体验。建议在继续之前关闭所有后台应用程序。选择所需的选项以继续。 - 您可以选择要纠正的内容。 + 您可以选择改正要的内容 选择要安装的内容 @@ -190,7 +190,7 @@ 使用增强型功能区 - 将云母(Mica)扩展到浏览器导航栏 + 将云母 (Mica) 扩展到浏览器导航栏 自定义桌面 @@ -208,10 +208,10 @@ Windows 11 默认 - 请关闭所有内容并保存您的工作,安装结束后需要重启。 + 请保存所有内容并关闭您的工作,安装结束后需要重启。 - 在此 Windows 安装上安装 Rectify11。 + 在此系统上安装 Rectify11。 您将要执行以下操作: @@ -246,66 +246,65 @@ 你确定要取消安装吗? - - Did you know + 你知道吗 - Restart now + 现在重启 - Accent Color Colorizing + 使用强调色主题 - Patch Icons + 安装图标包 - Install User avatars + 安装用户头像 - Context menu style + 自定义右键菜单 - Rectified Gadgets + 安装 Windows 桌面小工具 - Remastered user avatars + 安装 Fluent 样式用户头像 - You can choose what will be restored. + 你可以选择还原什么。 - Skip MicaForEveryone installation + 跳过安装 MicaForEveryone - Use Mica Alt instead of Mica + 使用云母 (Mica) Alt 代替云母 (Mica) - Classic Context Menus + 传统右键菜单 - Classic Menus with transparency + 透明的传统右键菜单 - Enhanced Fluent Menus (More Options) + 增强的 Fluent 右键菜单 (更多选项) - Enhanced Fluent Menus (All Items in root) + 增强的 Fluent 菜单 (所有选项都在第一层) - Add features to your existing installation. + 将新功能添加到目前系统中。 - Modify + 修改 - You cannot install Rectify11 as Windows Updates are pending. Please reboot your system. + 您无法在 Windows Updates 需要重新启动的情形下安装 Rectify11,请先重新启动。 - Create a restore point + 创建还原点 - Enhanced context menus + 增强的右键菜单 \ No newline at end of file diff --git a/Rectify11Installer/Win32/NativeMethods.cs b/Rectify11Installer/Win32/NativeMethods.cs index c90e4391b..be3d44dea 100644 --- a/Rectify11Installer/Win32/NativeMethods.cs +++ b/Rectify11Installer/Win32/NativeMethods.cs @@ -1,299 +1,297 @@ -using Microsoft.Win32; +using Microsoft.VisualBasic; +using Microsoft.Win32; +using Rectify11Installer.Core; using System; using System.ComponentModel; using System.Diagnostics; +using System.IO; +using System.Management; using System.Runtime.InteropServices; #nullable enable namespace Rectify11Installer.Win32 { - public class NativeMethods - { - #region P/Invoke - [DllImport("user32.dll")] - internal static extern bool SetProcessDPIAware(); - [DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)] - [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool LookupPrivilegeValue(string? lpSystemName, string lpName, out LUID lpLuid); + public class NativeMethods + { + #region P/Invoke + #region advapi32.dll + [DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool LookupPrivilegeValue(string? lpSystemName, string lpName, out LUID lpLuid); - [DllImport("advapi32.dll", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool AdjustTokenPrivileges(IntPtr TokenHandle, [MarshalAs(UnmanagedType.Bool)] bool DisableAllPrivileges, ref TOKEN_PRIVILEGES NewState, UInt32 Zero, IntPtr Null1, IntPtr Null2); + [DllImport("advapi32.dll", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool AdjustTokenPrivileges(IntPtr TokenHandle, [MarshalAs(UnmanagedType.Bool)] bool DisableAllPrivileges, ref TOKEN_PRIVILEGES NewState, UInt32 Zero, IntPtr Null1, IntPtr Null2); - [DllImport("kernel32.dll", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool CloseHandle(IntPtr hObject); + [DllImport("advapi32.dll", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool OpenProcessToken(IntPtr ProcessHandle, UInt32 DesiredAccess, out IntPtr TokenHandle); + #endregion + #region kernel32.dll + [DllImport("kernel32.dll", SetLastError = true)] + private static extern bool IsWow64Process2( + IntPtr process, + out ushort processMachine, + out ushort nativeMachine + ); + [return: MarshalAs(UnmanagedType.Bool)] + [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)] + public static extern bool MoveFileEx(string lpExistingFileName, string lpNewFileName, MoveFileFlags dwFlags); - [DllImport("user32.dll", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool ExitWindowsEx(ExitWindows uFlags, ShutdownReason dwReason); + [DllImport("kernel32.dll", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool CloseHandle(IntPtr hObject); + #endregion + #region user32.dll + [DllImport("user32.dll", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool ExitWindowsEx(ExitWindows uFlags, ShutdownReason dwReason); - [DllImport("advapi32.dll", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool OpenProcessToken(IntPtr ProcessHandle, UInt32 DesiredAccess, out IntPtr TokenHandle); + [DllImport("user32.dll")] + public static extern IntPtr GetSystemMenu(IntPtr hWnd, bool revert); - [DllImport("user32.dll")] - public static extern IntPtr GetSystemMenu(IntPtr hWnd, bool revert); + [DllImport("user32.dll")] + public static extern int EnableMenuItem(IntPtr hMenu, int IDEnableItem, int enable); + #endregion + #region gdi32.dll + [DllImport("gdi32.dll", ExactSpelling = true, SetLastError = true)] + internal static extern IntPtr CreateCompatibleDC(IntPtr hDC); + [DllImport("gdi32.dll")] + internal static extern unsafe IntPtr CreateDIBSection(IntPtr hdc, BITMAPINFO pbmi, uint iUsage, out int* ppvBits, IntPtr hSection, uint dwOffset); - [DllImport("user32.dll")] - public static extern int EnableMenuItem(IntPtr hMenu, int IDEnableItem, int enable); + [DllImport("gdi32.dll", EntryPoint = "SelectObject")] + internal static extern IntPtr SelectObject([In] IntPtr hdc, [In] IntPtr hgdiobj); - [DllImport("gdi32.dll", ExactSpelling = true, SetLastError = true)] - internal static extern IntPtr CreateCompatibleDC(IntPtr hDC); - [DllImport("gdi32.dll")] - internal static extern unsafe IntPtr CreateDIBSection(IntPtr hdc, BITMAPINFO pbmi, uint iUsage, out int* ppvBits, IntPtr hSection, uint dwOffset); + [DllImport("gdi32.dll")] + internal static extern bool BitBlt(IntPtr hdc, int nXDest, int nYDest, int nWidth, int nHeight, IntPtr hdcSrc, int nXSrc, int nYSrc, uint dwRop); + #endregion + [DllImport("uxtheme.dll", CharSet = CharSet.Unicode)] + internal static extern int DrawThemeTextEx(IntPtr hTheme, IntPtr hdc, int iPartId, int iStateId, string pszText, int iCharCount, uint flags, ref RECT rect, ref DTTOPTS poptions); - [DllImport("gdi32.dll", EntryPoint = "SelectObject")] - internal static extern IntPtr SelectObject([In] IntPtr hdc, [In] IntPtr hgdiobj); + [DllImport("dwmapi.dll")] + public static extern int DwmExtendFrameIntoClientArea(IntPtr hwnd, ref MARGINS margins); - [DllImport("uxtheme.dll", CharSet = CharSet.Unicode)] - internal static extern int DrawThemeTextEx(IntPtr hTheme, IntPtr hdc, int iPartId, int iStateId, string pszText, int iCharCount, uint flags, ref RECT rect, ref DTTOPTS poptions); + [DllImport("SrClient.dll")] + public static extern bool SRSetRestorePoint(ref RESTOREPOINTINFO SRPInfo, ref STATEMGRSTATUS SRPStatus); + #endregion + #region Flags + public const int SC_CLOSE = 0xF060; + public const int MF_BYCOMMAND = 0; + public const int MF_ENABLED = 0; + public const int MF_GRAYED = 1; + public const int WP_CAPTION = 1; + public const int CS_ACTIVE = 1; + private const UInt32 TOKEN_QUERY = 0x0008; + private const UInt32 TOKEN_ADJUST_PRIVILEGES = 0x0020; + private const UInt32 SE_PRIVILEGE_ENABLED = 0x00000002; + private const string SE_SHUTDOWN_NAME = "SeShutdownPrivilege"; + [StructLayout(LayoutKind.Sequential)] + public class BITMAPINFO + { + public int biSize; + public int biWidth; + public int biHeight; + public short biPlanes; + public short biBitCount; + public int biCompression; + public int biSizeImage; + public int biXPelsPerMeter; + public int biYPelsPerMeter; + public int biClrUsed; + public int biClrImportant; + public byte bmiColors_rgbBlue; + public byte bmiColors_rgbGreen; + public byte bmiColors_rgbRed; + public byte bmiColors_rgbReserved; + } + [StructLayout(LayoutKind.Sequential)] + public struct DTTOPTS + { + public int dwSize; + public int dwFlags; + public int crText; + public int crBorder; + public int crShadow; + public int iTextShadowType; + public int ptShadowOffsetX; + public int ptShadowOffsetY; + public int iBorderSize; + public int iFontPropId; + public int iColorPropId; + public int iStateId; + public bool fApplyOverlay; + public int iGlowSize; + public IntPtr pfnDrawTextCallback; + public IntPtr lParam; + } + [StructLayout(LayoutKind.Sequential)] + public struct MARGINS + { + public int cxLeftWidth; // width of left border that retains its size + public int cxRightWidth; // width of right border that retains its size + public int cyTopHeight; // height of top border that retains its size + public int cyBottomHeight; // height of bottom border that retains its size + }; + [Flags] + private enum ExitWindows : uint + { + LogOff = 0x00, + ShutDown = 0x01, + Reboot = 0x02, + PowerOff = 0x08, + RestartApps = 0x40, + Force = 0x04, + ForceIfHung = 0x10, + } - [DllImport("gdi32.dll")] - internal static extern bool BitBlt(IntPtr hdc, int nXDest, int nYDest, int nWidth, int nHeight, IntPtr hdcSrc, int nXSrc, int nYSrc, uint dwRop); + [Flags] + private enum ShutdownReason : uint + { + MajorOther = 0x00000000, + MinorOther = 0x00000000, + FlagPlanned = 0x80000000 + } - [DllImport("dwmapi.dll")] - public static extern int DwmExtendFrameIntoClientArea(IntPtr hwnd, ref MARGINS margins); + [StructLayout(LayoutKind.Sequential)] + private struct LUID + { + public uint LowPart; + public int HighPart; + } - [DllImport("kernel32.dll", SetLastError = true)] - private static extern bool IsWow64Process2( - IntPtr process, - out ushort processMachine, - out ushort nativeMachine - ); - [return: MarshalAs(UnmanagedType.Bool)] - [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)] - public static extern bool MoveFileEx(string lpExistingFileName, string lpNewFileName, MoveFileFlags dwFlags); + [StructLayout(LayoutKind.Sequential)] + private struct LUID_AND_ATTRIBUTES + { + public LUID Luid; + public UInt32 Attributes; + } + private struct TOKEN_PRIVILEGES + { + public UInt32 PrivilegeCount; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] + public LUID_AND_ATTRIBUTES[] Privileges; + } - [DllImport("SrClient.dll")] - public static extern bool SRSetRestorePoint(ref RESTOREPOINTINFO SRPInfo, ref STATEMGRSTATUS SRPStatus); - #endregion - #region Flags - public const int SC_CLOSE = 0xF060; - public const int MF_BYCOMMAND = 0; - public const int MF_ENABLED = 0; - public const int MF_GRAYED = 1; - public const int WP_CAPTION = 1; - public const int CS_ACTIVE = 1; - private const UInt32 TOKEN_QUERY = 0x0008; - private const UInt32 TOKEN_ADJUST_PRIVILEGES = 0x0020; - private const UInt32 SE_PRIVILEGE_ENABLED = 0x00000002; - private const string SE_SHUTDOWN_NAME = "SeShutdownPrivilege"; - [StructLayout(LayoutKind.Sequential)] - public class BITMAPINFO - { - public int biSize; - public int biWidth; - public int biHeight; - public short biPlanes; - public short biBitCount; - public int biCompression; - public int biSizeImage; - public int biXPelsPerMeter; - public int biYPelsPerMeter; - public int biClrUsed; - public int biClrImportant; - public byte bmiColors_rgbBlue; - public byte bmiColors_rgbGreen; - public byte bmiColors_rgbRed; - public byte bmiColors_rgbReserved; - } - [StructLayout(LayoutKind.Sequential)] - public struct DTTOPTS - { - public int dwSize; - public int dwFlags; - public int crText; - public int crBorder; - public int crShadow; - public int iTextShadowType; - public int ptShadowOffsetX; - public int ptShadowOffsetY; - public int iBorderSize; - public int iFontPropId; - public int iColorPropId; - public int iStateId; - public bool fApplyOverlay; - public int iGlowSize; - public IntPtr pfnDrawTextCallback; - public IntPtr lParam; - } - [StructLayout(LayoutKind.Sequential)] - public struct MARGINS - { - public int cxLeftWidth; // width of left border that retains its size - public int cxRightWidth; // width of right border that retains its size - public int cyTopHeight; // height of top border that retains its size - public int cyBottomHeight; // height of bottom border that retains its size - }; - [Flags] - private enum ExitWindows : uint - { - LogOff = 0x00, - ShutDown = 0x01, - Reboot = 0x02, - PowerOff = 0x08, - RestartApps = 0x40, - Force = 0x04, - ForceIfHung = 0x10, - } + [Flags] + public enum MoveFileFlags + { + MOVEFILE_REPLACE_EXISTING = 0x00000001, + MOVEFILE_COPY_ALLOWED = 0x00000002, + MOVEFILE_DELAY_UNTIL_REBOOT = 0x00000004, + MOVEFILE_WRITE_THROUGH = 0x00000008, + MOVEFILE_CREATE_HARDLINK = 0x00000010, + MOVEFILE_FAIL_IF_NOT_TRACKABLE = 0x00000020 + } - [Flags] - private enum ShutdownReason : uint - { - MajorOther = 0x00000000, - MinorOther = 0x00000000, - FlagPlanned = 0x80000000 - } + [StructLayout(LayoutKind.Sequential)] + public struct RESTOREPOINTINFO + { + public int dwEventType; + public int dwRestorePtType; + public Int64 llSequenceNumber; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 257)] + public string szDescription; + } - [StructLayout(LayoutKind.Sequential)] - private struct LUID - { - public uint LowPart; - public int HighPart; - } + [StructLayout(LayoutKind.Sequential)] + public struct STATEMGRSTATUS + { + public uint nStatus; + public Int64 llSequenceNumber; + } + #endregion + #region Public Methods + public static bool SetCloseButton(FrmWizard frm, bool enable) + { + var hMenu = GetSystemMenu(frm.Handle, false); + if (hMenu != IntPtr.Zero) + { + EnableMenuItem(hMenu, SC_CLOSE, MF_BYCOMMAND | (enable ? MF_ENABLED : MF_GRAYED)); + return true; + } + return false; + } + public static void Reboot() + { + var tokenHandle = IntPtr.Zero; + try + { + // get process token + if (!OpenProcessToken(Process.GetCurrentProcess().Handle, + TOKEN_QUERY | TOKEN_ADJUST_PRIVILEGES, + out tokenHandle)) + { + throw new Win32Exception(Marshal.GetLastWin32Error(), "Failed to open process token handle"); + } - [StructLayout(LayoutKind.Sequential)] - private struct LUID_AND_ATTRIBUTES - { - public LUID Luid; - public UInt32 Attributes; - } - private struct TOKEN_PRIVILEGES - { - public UInt32 PrivilegeCount; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] - public LUID_AND_ATTRIBUTES[] Privileges; - } + // lookup the shutdown privilege + TOKEN_PRIVILEGES tokenPrivs = new() + { + PrivilegeCount = 1, + Privileges = new LUID_AND_ATTRIBUTES[1] + }; + tokenPrivs.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; - [Flags] - public enum MoveFileFlags - { - MOVEFILE_REPLACE_EXISTING = 0x00000001, - MOVEFILE_COPY_ALLOWED = 0x00000002, - MOVEFILE_DELAY_UNTIL_REBOOT = 0x00000004, - MOVEFILE_WRITE_THROUGH = 0x00000008, - MOVEFILE_CREATE_HARDLINK = 0x00000010, - MOVEFILE_FAIL_IF_NOT_TRACKABLE = 0x00000020 - } + if (!LookupPrivilegeValue(null, + SE_SHUTDOWN_NAME, + out tokenPrivs.Privileges[0].Luid)) + { + throw new Win32Exception(Marshal.GetLastWin32Error(), "Failed to open lookup shutdown privilege"); + } - [StructLayout(LayoutKind.Sequential)] - public struct RESTOREPOINTINFO - { - public int dwEventType; - public int dwRestorePtType; - public Int64 llSequenceNumber; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 257)] - public string szDescription; - } + // add the shutdown privilege to the process token + if (!AdjustTokenPrivileges(tokenHandle, + false, + ref tokenPrivs, + 0, + IntPtr.Zero, + IntPtr.Zero)) + { + throw new Win32Exception(Marshal.GetLastWin32Error(), "Failed to adjust process token privileges"); + } - [StructLayout(LayoutKind.Sequential)] - public struct STATEMGRSTATUS - { - public uint nStatus; - public Int64 llSequenceNumber; - } - #endregion - #region Public Methods - public static bool SetCloseButton(FrmWizard frm, bool enable) - { - var hMenu = GetSystemMenu(frm.Handle, false); - if (hMenu != IntPtr.Zero) - { - EnableMenuItem(hMenu, SC_CLOSE, MF_BYCOMMAND | (enable ? MF_ENABLED : MF_GRAYED)); - return true; - } - return false; - } - public static void Reboot() - { - var tokenHandle = IntPtr.Zero; - try - { - // get process token - if (!OpenProcessToken(Process.GetCurrentProcess().Handle, - TOKEN_QUERY | TOKEN_ADJUST_PRIVILEGES, - out tokenHandle)) - { - throw new Win32Exception(Marshal.GetLastWin32Error(), "Failed to open process token handle"); - } - - // lookup the shutdown privilege - TOKEN_PRIVILEGES tokenPrivs = new() - { - PrivilegeCount = 1, - Privileges = new LUID_AND_ATTRIBUTES[1] - }; - tokenPrivs.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; - - if (!LookupPrivilegeValue(null, - SE_SHUTDOWN_NAME, - out tokenPrivs.Privileges[0].Luid)) - { - throw new Win32Exception(Marshal.GetLastWin32Error(), "Failed to open lookup shutdown privilege"); - } - - // add the shutdown privilege to the process token - if (!AdjustTokenPrivileges(tokenHandle, - false, - ref tokenPrivs, - 0, - IntPtr.Zero, - IntPtr.Zero)) - { - throw new Win32Exception(Marshal.GetLastWin32Error(), "Failed to adjust process token privileges"); - } - - // reboot - if (!ExitWindowsEx(ExitWindows.Reboot, - ShutdownReason.MajorOther | ShutdownReason.MinorOther | ShutdownReason.FlagPlanned)) - { - throw new Win32Exception(Marshal.GetLastWin32Error(), "Failed to reboot system"); - } - } - finally - { - // close the process token - if (tokenHandle != IntPtr.Zero) - { - CloseHandle(tokenHandle); - } - } - } - public static bool IsArm64() - { - var handle = Process.GetCurrentProcess().Handle; - try - { - IsWow64Process2(handle, out var processMachine, out var nativeMachine); - if (nativeMachine == 0xaa64) return true; - else return false; - } - catch { return false; } - } - public static int GetUbr() - { - using var key = Registry.LocalMachine.OpenSubKey(@"software\microsoft\Windows NT\CurrentVersion"); - return Convert.ToInt32(key?.GetValue("UBR")); - } - public static bool CreateSystemRestorePoint(bool finish) - { - RegistryKey SystemRestoreKey = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows NT\\CurrentVersion\\SystemRestore", true); - SystemRestoreKey.SetValue("SystemRestorePointCreationFrequency", 0, RegistryValueKind.DWord); - RESTOREPOINTINFO RPInfo = new(); - STATEMGRSTATUS RPStatus = new(); - - RPInfo.dwEventType = 100; - if (finish) RPInfo.dwEventType = 101; - RPInfo.dwRestorePtType = 0; - RPInfo.llSequenceNumber = 0; - RPInfo.szDescription = "Rectify11"; - _ = SRSetRestorePoint(ref RPInfo, ref RPStatus); - SystemRestoreKey.DeleteValue("SystemRestorePointCreationFrequency"); - SystemRestoreKey.Dispose(); - return true; - } - #endregion - } + // reboot + if (!ExitWindowsEx(ExitWindows.Reboot, + ShutdownReason.MajorOther | ShutdownReason.MinorOther | ShutdownReason.FlagPlanned)) + { + throw new Win32Exception(Marshal.GetLastWin32Error(), "Failed to reboot system"); + } + } + finally + { + // close the process token + if (tokenHandle != IntPtr.Zero) + { + CloseHandle(tokenHandle); + } + } + } + public static bool IsArm64() + { + var handle = Process.GetCurrentProcess().Handle; + try + { + IsWow64Process2(handle, out var processMachine, out var nativeMachine); + if (nativeMachine == 0xaa64) return true; + else return false; + } + catch { return false; } + } + public static int GetUbr() + { + using var key = Registry.LocalMachine.OpenSubKey(@"software\microsoft\Windows NT\CurrentVersion"); + return Convert.ToInt32(key?.GetValue("UBR")); + } + public static void CreateSystemRestorePoint() + { + RegistryKey SystemRestoreKey = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows NT\\CurrentVersion\\SystemRestore", true); + SystemRestoreKey.SetValue("SystemRestorePointCreationFrequency", 0, RegistryValueKind.DWord); + // ugh + Interaction.Shell(Path.Combine(Variables.sys32Folder, "cmd.exe") + " /c powershell.exe -Command Checkpoint-Computer -Description \"Rectify11\" -RestorePointType \"APPLICATION_INSTALL\"", AppWinStyle.Hide, true); + SystemRestoreKey.DeleteValue("SystemRestorePointCreationFrequency"); + SystemRestoreKey.Dispose(); + } + #endregion + } } diff --git a/Rectify11Installer/frmWizard.Designer.cs b/Rectify11Installer/frmWizard.Designer.cs index e9926167b..2c123d73a 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.uninstPage = new Rectify11Installer.Controls.DarkAwareTabPage(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.progressLabel = new Controls.DarkAwareLabel(); this.versionLabel = new Controls.DarkAwareLabel(); @@ -175,7 +174,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.uninstPage); this.navPane.ItemSize = new System.Drawing.Size(10, 20); this.navPane.Location = new System.Drawing.Point(280, 0); this.navPane.Multiline = true; @@ -282,16 +280,6 @@ private void InitializeComponent() Core.TabPages.progressPage.TabIndex = 6; Core.TabPages.progressPage.Text = "Progress"; // - // uninstPage - // - Core.TabPages.uninstPage.BackColor = System.Drawing.Color.White; - Core.TabPages.uninstPage.ForeColor = System.Drawing.Color.Black; - Core.TabPages.uninstPage.Location = new System.Drawing.Point(4, 44); - Core.TabPages.uninstPage.Name = "uninstPage"; - Core.TabPages.uninstPage.Size = new System.Drawing.Size(333, 284); - Core.TabPages.uninstPage.TabIndex = 7; - Core.TabPages.uninstPage.Text = "Uninstall"; - // // versionLabel // this.versionLabel.AutoSize = true; diff --git a/Rectify11Installer/frmWizard.cs b/Rectify11Installer/frmWizard.cs index 396c3d836..f23c9bbbc 100644 --- a/Rectify11Installer/frmWizard.cs +++ b/Rectify11Installer/frmWizard.cs @@ -46,7 +46,7 @@ public bool ShowRebootButton nextButton.Visible = false; progressLabel.Location = new Point(progressLabel.Location.X, progressLabel.Location.Y - 30); pictureBox1.Location = new Point(pictureBox1.Location.X, pictureBox1.Location.Y - 30); - cancelButton.ButtonText = Strings.Rectify11.buttonReboot; + cancelButton.ButtonText = "Finish"; cancelButton.Click -= CancelButton_Click; tableLayoutPanel2.Visible = value; if (!Theme.IsUsingDarkMode) @@ -85,7 +85,6 @@ private void Application_Idle(object sender, EventArgs e) // initialize here because it needs instance RectifyPages.InstallOptnsPage = new InstallOptnsPage(this); RectifyPages.InstallConfirmation = new InstallConfirmation(this); - RectifyPages.UninstallPage = new(this); RectifyPages.ProgressPage = new ProgressPage(this); TabPages.eulPage.Controls.Add(RectifyPages.EulaPage); @@ -93,7 +92,6 @@ private void Application_Idle(object sender, EventArgs e) TabPages.themePage.Controls.Add(RectifyPages.ThemeChoicePage); TabPages.cmenupage.Controls.Add(RectifyPages.CMenuPage); TabPages.debPage.Controls.Add(RectifyPages.DebugPage); - TabPages.uninstPage.Controls.Add(RectifyPages.UninstallPage); TabPages.progressPage.Controls.Add(RectifyPages.ProgressPage); TabPages.summaryPage.Controls.Add(RectifyPages.InstallConfirmation); @@ -224,11 +222,6 @@ private void NextButton_Click(object sender, EventArgs e) { Navigate(RectifyPages.ProgressPage); } - else if (navPane.SelectedTab == TabPages.uninstPage) - { - Variables.IsUninstall = true; - Navigate(RectifyPages.ProgressPage); - } } private void BackButton_Click(object sender, EventArgs e) @@ -275,10 +268,6 @@ private void BackButton_Click(object sender, EventArgs e) Navigate(RectifyPages.InstallOptnsPage); } } - else if (navPane.SelectedTab == TabPages.uninstPage) - { - Navigate(RectifyPages.WelcomePage); - } } private void InstallButton_Click(object sender, EventArgs e) @@ -292,7 +281,18 @@ private void InstallButton_Click(object sender, EventArgs e) private void UninstallButton_Click(object sender, EventArgs e) { - if (Helper.CheckIfUpdatesPending()) Navigate(RectifyPages.UninstallPage); + if (Helper.CheckIfUpdatesPending()) + { + var res = TaskDialog.Show(text: "Are you sure you want to uninstall Rectify11?", + title: Strings.Rectify11.uninstallTitle, + buttons: TaskDialogButtons.Yes | TaskDialogButtons.No, + icon: TaskDialogStandardIcon.Information); + if (res == TaskDialogResult.Yes) + { + Variables.IsUninstall = true; + Navigate(RectifyPages.ProgressPage); + } + } } private void VersionLabel_Click(object sender, EventArgs e) diff --git a/RectifyControlPanel2 b/RectifyControlPanel2 deleted file mode 160000 index 662dea67e..000000000 --- a/RectifyControlPanel2 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 662dea67e7db3c0bc5d3fd32dde02116792fe135 diff --git a/rectify11controlcenter b/rectify11controlcenter new file mode 160000 index 000000000..1105a7e5d --- /dev/null +++ b/rectify11controlcenter @@ -0,0 +1 @@ +Subproject commit 1105a7e5d30378ede89c7a0f3d6e6fe9d78361c1