Skip to content

Commit

Permalink
bring back r11 cpl
Browse files Browse the repository at this point in the history
  • Loading branch information
MishaProductions committed Oct 15, 2023
1 parent 98d48bd commit 898e4d2
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 30 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ 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/[email protected]
- 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
Expand Down
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
69 changes: 45 additions & 24 deletions Rectify11Installer/Core/Backend/Themes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,31 +204,52 @@ private static bool InstallThemes()
public static void InstallR11Cpl()
{
UninstallR11Cpl();

// Delete r11 control center
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.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;

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

}
Helper.SafeFileDeletion(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Microsoft", "Windows", "Start Menu", "Programs"));

// install new
string cplPath = Path.Combine(Variables.r11Folder, "Rectify11CPL", "Rectify11CPL.dll");

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

File.WriteAllBytes(cplPath, 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.IconIndex = 0;
shortcut.DisplayMode = ShellLink.LinkDisplayMode.edmNormal;

string startmenu = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Microsoft", "Windows", "Start Menu", "Programs");
Directory.CreateDirectory(startmenu);
try
{
shortcut.Save(Path.Combine(startmenu, "Rectify11 Control Center.lnk"));
}
catch (Exception ex)
{
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);
}
}
/// <summary>
/// uninstalls control center
/// </summary>
Expand Down

0 comments on commit 898e4d2

Please sign in to comment.