diff --git a/Rectify11Installer/Core/Backend/Installer.cs b/Rectify11Installer/Core/Backend/Installer.cs index 9129ce9df..1eff39e52 100644 --- a/Rectify11Installer/Core/Backend/Installer.cs +++ b/Rectify11Installer/Core/Backend/Installer.cs @@ -66,15 +66,30 @@ public bool Install(FrmWizard frm) // extract files, delete if folder exists frm.InstallerProgress = "Extracting files..."; Helper.SafeDirectoryDeletion(Path.Combine(Variables.r11Folder, "files"), false); - if (!Helper.SafeFileOperation( - Path.Combine(Variables.r11Folder, "files.7z"), - Properties.Resources.files, - Helper.OperationType.Write)) - return false; + if (!Helper.SafeFileOperation( + Path.Combine(Variables.r11Folder, "files.7z"), + Properties.Resources.files, + Helper.OperationType.Write)) + return false; // extract the 7z Helper.SvExtract("files.7z", "files"); + if (InstallOptions.InstallThemes || InstallOptions.InstallExtras()) + { + // Install/update r11cpl first to make RectifyUtil class work + try + { + Themes.InstallR11Cpl(); + Logger.WriteLine("Installr11cpl() succeeded."); + } + catch (Exception ex) + { + Logger.Warn("Installr11cpl() failed", ex); + return false; + } + } + // theme if (InstallOptions.InstallThemes) { @@ -96,7 +111,7 @@ public bool Install(FrmWizard frm) } // copy duires if any icons were patched or if themes was selected (required for r11cpl) - if (InstallOptions.iconsList.Count > 0 || InstallOptions.InstallThemes) + if (InstallOptions.iconsList.Count > 0 || InstallOptions.InstallThemes) { File.Copy(Path.Combine(Variables.r11Files, "duires.dll"), Path.Combine(Variables.sys32Folder, "duires.dll"), true); } @@ -106,7 +121,7 @@ public bool Install(FrmWizard frm) frm.InstallerProgress = Rectify11Installer.Strings.Rectify11.creatingUninstaller; Common.CreateUninstall(); - InstallStatus.IsRectify11Installed = true; + InstallStatus.IsRectify11Installed = true; Logger.WriteLine("══════════════════════════════════════════════"); // cleanup @@ -122,7 +137,7 @@ private void InstallChangelogApp() var key = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true); key?.SetValue("RectifyStart", Path.Combine(Variables.r11Folder, "RectifyStart.exe"), RegistryValueKind.String); key.Close(); - } + } #endregion } } diff --git a/Rectify11Installer/Core/Backend/Themes.cs b/Rectify11Installer/Core/Backend/Themes.cs index 47fdeaf83..3cc869878 100644 --- a/Rectify11Installer/Core/Backend/Themes.cs +++ b/Rectify11Installer/Core/Backend/Themes.cs @@ -37,17 +37,7 @@ public static bool Install() // extract the 7z Helper.SvExtract("themes.7z", "themes"); - // Install/update r11cpl first to make RectifyUtil class work - try - { - InstallR11Cpl(); - Logger.WriteLine("Installr11cpl() succeeded."); - } - catch (Exception ex) - { - Logger.Warn("Installr11cpl() failed", ex); - return false; - } + if (!InstallThemes()) return false; @@ -155,7 +145,14 @@ public static bool Uninstall() } catch { } - UninstallR11Cpl(); + try + { + UninstallR11Cpl(); + } + catch(Exception ex) + { + Logger.WriteLine("error while uninstalling r11cpl: ", ex); + } Logger.WriteLine("Deleted Rectify11 Control Panel"); Process.Start(Path.Combine(Variables.sys32Folder, "reg.exe"), @" ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide /v PreferExternalManifest /t REG_DWORD /d 0 /f"); @@ -343,10 +340,8 @@ private static void InstallMfe() // Enable MFE - bool bEnabled = InstallOptions.EnableMicaEffect; - bool bTabbed = InstallOptions.UseTabbedInsteadOfMica; - Console.WriteLine("Installing MFE: bEnabled: " + bEnabled + ",bTabbed: " + bTabbed); - RectifyThemeUtil.Utility.SetMicaForEveryoneEnabled(ref bEnabled, ref bTabbed); + Console.WriteLine("Installing MFE: bEnabled: " + InstallOptions.EnableMicaEffect + ",bTabbed: " + InstallOptions.UseTabbedInsteadOfMica); + RectifyThemeUtil.Utility.SetMicaForEveryoneEnabled(InstallOptions.EnableMicaEffect, InstallOptions.UseTabbedInsteadOfMica); } #region Internal diff --git a/Rectify11Installer/Win32/RectifyUtil.cs b/Rectify11Installer/Win32/RectifyUtil.cs index 6d9052e12..339a5b2d0 100644 --- a/Rectify11Installer/Win32/RectifyUtil.cs +++ b/Rectify11Installer/Win32/RectifyUtil.cs @@ -16,7 +16,7 @@ public class CRectifyUtil public interface IRectifyUtil { public nint GetMicaSettings(ref bool enabled, ref bool tabbed); - public nint SetMicaForEveryoneEnabled(ref bool enabled, ref bool tabbed); + public nint SetMicaForEveryoneEnabled(bool enabled, bool tabbed); public nint GetCurrentMenuIndex(ref int index); public nint SetCurrentMenuByIndex(int index);