From 898e4d2c7cab9bbd0f307513a2f905c477544efd Mon Sep 17 00:00:00 2001 From: Misha Date: Sun, 15 Oct 2023 19:57:16 -0400 Subject: [PATCH] bring back r11 cpl --- .github/workflows/build.yml | 7 ++- .gitmodules | 6 +- Rectify11Installer/Core/Backend/Themes.cs | 69 +++++++++++++++-------- 3 files changed, 52 insertions(+), 30 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0f4086ded..911996423 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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/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 diff --git a/.gitmodules b/.gitmodules index d42a45dfa..ab13db36a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/Rectify11Installer/Core/Backend/Themes.cs b/Rectify11Installer/Core/Backend/Themes.cs index 8f95ab1ac..411a72e68 100644 --- a/Rectify11Installer/Core/Backend/Themes.cs +++ b/Rectify11Installer/Core/Backend/Themes.cs @@ -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); + } + } /// /// uninstalls control center ///