Skip to content

Commit

Permalink
Add R11 CPL and remove control center
Browse files Browse the repository at this point in the history
  • Loading branch information
MishaProductions committed Sep 25, 2023
1 parent 2d34609 commit 2ca5d28
Show file tree
Hide file tree
Showing 9 changed files with 124 additions and 33 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ Rectify11.Phase2.exe
*.pdb
*.config
*.exe
x64/
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "Rectify11ControlCenter"]
path = Rectify11ControlCenter
url = https://github.com/ojask/Rectify11ControlCenter.git
[submodule "RectifyControlPanel2"]
path = RectifyControlPanel2
url = https://github.com/Rectify11/RectifyControlPanel2.git
1 change: 0 additions & 1 deletion Rectify11ControlCenter
Submodule Rectify11ControlCenter deleted from 4b5196
40 changes: 38 additions & 2 deletions Rectify11Installer.sln
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.33027.164
# Visual Studio Version 17
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}"
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
Expand Down Expand Up @@ -46,6 +50,38 @@ Global
{8D66B017-3A76-439B-847B-C7379191E109}.Release|Win32.ActiveCfg = Release|Any CPU
{8D66B017-3A76-439B-847B-C7379191E109}.Release|x64.ActiveCfg = Release|Any CPU
{8D66B017-3A76-439B-847B-C7379191E109}.Release|x64.Build.0 = Release|Any CPU
{50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A}.Debug|Any CPU.ActiveCfg = Debug|x64
{50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A}.Debug|Any CPU.Build.0 = Debug|x64
{50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A}.Debug|Mixed Platforms.ActiveCfg = Debug|x64
{50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A}.Debug|Mixed Platforms.Build.0 = Debug|x64
{50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A}.Debug|Win32.ActiveCfg = Debug|Win32
{50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A}.Debug|Win32.Build.0 = Debug|Win32
{50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A}.Debug|x64.ActiveCfg = Debug|x64
{50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A}.Debug|x64.Build.0 = Debug|x64
{50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A}.Release|Any CPU.ActiveCfg = Release|x64
{50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A}.Release|Any CPU.Build.0 = Release|x64
{50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A}.Release|Mixed Platforms.ActiveCfg = Release|x64
{50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A}.Release|Mixed Platforms.Build.0 = Release|x64
{50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A}.Release|Win32.ActiveCfg = Release|Win32
{50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A}.Release|Win32.Build.0 = Release|Win32
{50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A}.Release|x64.ActiveCfg = Release|x64
{50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A}.Release|x64.Build.0 = Release|x64
{0B7DE49A-33C6-41B1-A9CE-D353031F8454}.Debug|Any CPU.ActiveCfg = Debug|x64
{0B7DE49A-33C6-41B1-A9CE-D353031F8454}.Debug|Any CPU.Build.0 = Debug|x64
{0B7DE49A-33C6-41B1-A9CE-D353031F8454}.Debug|Mixed Platforms.ActiveCfg = Debug|x64
{0B7DE49A-33C6-41B1-A9CE-D353031F8454}.Debug|Mixed Platforms.Build.0 = Debug|x64
{0B7DE49A-33C6-41B1-A9CE-D353031F8454}.Debug|Win32.ActiveCfg = Debug|Win32
{0B7DE49A-33C6-41B1-A9CE-D353031F8454}.Debug|Win32.Build.0 = Debug|Win32
{0B7DE49A-33C6-41B1-A9CE-D353031F8454}.Debug|x64.ActiveCfg = Debug|x64
{0B7DE49A-33C6-41B1-A9CE-D353031F8454}.Debug|x64.Build.0 = Debug|x64
{0B7DE49A-33C6-41B1-A9CE-D353031F8454}.Release|Any CPU.ActiveCfg = Release|x64
{0B7DE49A-33C6-41B1-A9CE-D353031F8454}.Release|Any CPU.Build.0 = Release|x64
{0B7DE49A-33C6-41B1-A9CE-D353031F8454}.Release|Mixed Platforms.ActiveCfg = Release|x64
{0B7DE49A-33C6-41B1-A9CE-D353031F8454}.Release|Mixed Platforms.Build.0 = Release|x64
{0B7DE49A-33C6-41B1-A9CE-D353031F8454}.Release|Win32.ActiveCfg = Release|Win32
{0B7DE49A-33C6-41B1-A9CE-D353031F8454}.Release|Win32.Build.0 = Release|Win32
{0B7DE49A-33C6-41B1-A9CE-D353031F8454}.Release|x64.ActiveCfg = Release|x64
{0B7DE49A-33C6-41B1-A9CE-D353031F8454}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
88 changes: 71 additions & 17 deletions Rectify11Installer/Core/Backend/Themes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static bool Install()

try
{
Installr11cpl();
InstallR11Cpl();
Logger.WriteLine("Installr11cpl() succeeded.");
}
catch (Exception ex)
Expand Down Expand Up @@ -92,7 +92,8 @@ public static bool Uninstall()
return false;

string mode = Theme.IsUsingDarkMode ? "dark.theme" : "aero.theme";
Process.Start(Path.Combine(Variables.Windir, "Resources", "Themes", mode));
if (File.Exists(Path.Combine(Variables.Windir, "Resources", "Themes", mode)))
Process.Start(Path.Combine(Variables.Windir, "Resources", "Themes", mode));
string theme = Theme.IsUsingDarkMode ? "Windows (dark)" : "Windows (light)";
Interaction.Shell(Path.Combine(Variables.r11Folder, "SecureUXHelper.exe") + " apply " + '"' + theme + '"', AppWinStyle.Hide, true);

Expand Down Expand Up @@ -130,10 +131,7 @@ public static bool Uninstall()
}
catch { }

// nuke r11cp
Helper.SafeFileDeletion(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Microsoft", "Windows", "Start Menu", "Programs", "Rectify11 Control Center.lnk"));
Helper.SafeFileDeletion(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Rectify11 Control Center.lnk"));
Helper.SafeDirectoryDeletion(Path.Combine(Variables.r11Folder, "Rectify11ControlCenter"), false);
UninstallR11Cpl();
Logger.WriteLine("Deleted Rectify11 Control Center");

Logger.WriteLine("Uninstall() succeeded");
Expand Down Expand Up @@ -184,23 +182,79 @@ private static bool InstallThemes()
/// <summary>
/// installs control center
/// </summary>
private static void Installr11cpl()
private static void InstallR11Cpl()
{
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.Rectify11ControlCenter);
string cplPath = Path.Combine(Variables.r11Folder, "Rectify11CPL", "Rectify11CPL.dll");

//create files
Helper.SafeDirectoryDeletion(Path.Combine(Variables.r11Folder, "Rectify11CPL"), false);
Directory.CreateDirectory(Path.Combine(Variables.r11Folder, "Rectify11CPL"));

File.WriteAllBytes(cplPath, Properties.Resources.Rectify11CPL);

// create shortcut
using ShellLink shortcut = new();
shortcut.Target = Path.Combine(Variables.r11Folder, "Rectify11ControlCenter", "Rectify11ControlCenter.exe");
shortcut.WorkingDirectory = @"%windir%\Rectify11\Rectify11ControlCenter";
shortcut.IconPath = Path.Combine(Variables.r11Folder, "Rectify11ControlCenter", "Rectify11ControlCenter.exe");
shortcut.Target = "shell:::{542EEE1B-A254-46F7-B980-35BECF6076A4}";
shortcut.IconPath = Path.Combine(Variables.r11Folder, "Rectify11CPL", "Rectify11CPL.dll");
shortcut.IconIndex = 0;
shortcut.DisplayMode = ShellLink.LinkDisplayMode.edmNormal;
string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Microsoft", "Windows", "Start Menu", "Programs", "Rectify11 Control Center.lnk");
if (!Directory.Exists(path))
Directory.CreateDirectory(path);
shortcut.Save(path);

string startmenu = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Microsoft", "Windows", "Start Menu", "Programs", "Rectify11 Control Center.lnk");
if (!Directory.Exists(startmenu))
Directory.CreateDirectory(startmenu);
try
{
shortcut.Save(startmenu);
}
catch (Exception ex)
{
Logger.WriteLine("Error while saving shortcut: " + ex);
}
shortcut.Save(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Rectify11 Control Center.lnk"));

shortcut.Dispose();

// 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);
}
}
/// <summary>
/// uninstalls control center
/// </summary>
private static void UninstallR11Cpl()
{
string cplPath = Path.Combine(Variables.r11Folder, "Rectify11CPL", "Rectify11CPL.dll");
string startmenuShortcut = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Microsoft", "Windows", "Start Menu", "Programs", "Rectify11 Control Center.lnk");
string desktopShortcut = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Rectify11 Control Center.lnk");

// delete shortcut
if (File.Exists(startmenuShortcut))
File.Delete(startmenuShortcut);
if (File.Exists(desktopShortcut))
File.Delete(desktopShortcut);

// 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.WriteLine("Error while unregistering CPL: " + proc.ExitCode);
}

//delete folder
Helper.SafeDirectoryDeletion(Path.Combine(Variables.r11Folder, "Rectify11CPL"), false);
}

/// <summary>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Rectify11Installer/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2497,8 +2497,8 @@
<data name="extras" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\extras.7z;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="Rectify11ControlCenter" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Rectify11ControlCenter.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="Rectify11CPL" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Rectify11CPL.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="blackPreview" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
Expand Down
12 changes: 6 additions & 6 deletions Rectify11Installer/Rectify11Installer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@
<Compile Include="Core\Backend\MMCHelper.cs" />
<Compile Include="Core\Backend\Installer.cs" />
<Compile Include="Core\Backend\Patches.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Win32\ShellLink.cs" />
<Compile Include="Win32\Theme.cs" />
<Compile Include="Core\TreeViewExtension.cs" />
Expand Down Expand Up @@ -214,11 +219,6 @@
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources1.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Strings\Rectify11.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
Expand All @@ -236,7 +236,7 @@
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<SubType>Designer</SubType>
<LastGenOutput>Resources1.Designer.cs</LastGenOutput>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="Strings\Rectify11.ar.resx">
<Generator>ResXFileCodeGenerator</Generator>
Expand Down
1 change: 1 addition & 0 deletions RectifyControlPanel2
Submodule RectifyControlPanel2 added at fdfdf7

0 comments on commit 2ca5d28

Please sign in to comment.