diff --git a/.github/workflows/patcher.yml b/.github/workflows/patcher.yml index ad79c802..0ca44033 100644 --- a/.github/workflows/patcher.yml +++ b/.github/workflows/patcher.yml @@ -29,24 +29,47 @@ jobs: run: | export DOTNET_NOLOGO=true export DOTNET_CLI_TELEMETRY_OPTOUT=true - dotnet publish patcher/HitmanPatcher.CLI/HitmanPatcher.CLI.csproj -r win-x64 -c Release -p:PublishTrimmed=True -p:PublishSingleFile=True --self-contained -p DebugType=none -p:EnableWindowsTargeting=True --nologo -o patcher/Publish/Windows-x64 - dotnet publish patcher/HitmanPatcher.CLI/HitmanPatcher.CLI.csproj -r linux-x64 -c Release -p:PublishTrimmed=True -p:PublishSingleFile=True --self-contained -p DebugType=none --nologo -o patcher/Publish/Linux-x64 - dotnet publish patcher/HitmanPatcher.UI/HitmanPatcher.UI.csproj -r win-x64 -c Release -p:PublishSingleFile=True --self-contained -p DebugType=none -p:EnableWindowsTargeting=True --nologo -o patcher/Publish/Windows-x64 + cd patcher + dotnet publish HitmanPatcher.CLI/HitmanPatcher.CLI.csproj -r win-x64 -c Release -p:PublishSingleFile=True --no-self-contained -p DebugType=none -p:EnableWindowsTargeting=True -o Publish/Windows-Portable + dotnet publish HitmanPatcher.CLI/HitmanPatcher.CLI.csproj -r win-x64 -c Release -p:PublishTrimmed=True -p:PublishSingleFile=True --self-contained -p DebugType=none -p:EnableWindowsTargeting=True -o Publish/Windows-x64 + dotnet publish HitmanPatcher.CLI/HitmanPatcher.CLI.csproj -r linux-x64 -c Release -p:PublishSingleFile=True --no-self-contained -p DebugType=none -p:IsLinux=true -o Publish/Linux-Portable + dotnet publish HitmanPatcher.CLI/HitmanPatcher.CLI.csproj -r linux-x64 -c Release -p:PublishTrimmed=True -p:PublishSingleFile=True --self-contained -p DebugType=none -p:IsLinux=true -o Publish/Linux-x64 + dotnet publish HitmanPatcher.UI/HitmanPatcher.UI.csproj -r win-x64 -c Release -p:PublishSingleFile=True --no-self-contained -p DebugType=none -p:EnableWindowsTargeting=True -o Publish/Windows-Portable + dotnet publish HitmanPatcher.UI/HitmanPatcher.UI.csproj -r win-x64 -c Release -p:PublishSingleFile=True --self-contained -p DebugType=none -p:EnableWindowsTargeting=True -o Publish/Windows-x64 - - name: Upload patcher-windows-cli + - name: Upload patcher-cli-windows-portable uses: actions/upload-artifact@v4 with: - name: patcher-windows-cli + name: patcher-cli-windows-portable + path: patcher/Publish/Windows-Portable/PeacockPatcher.CLI.exe + + - name: Upload patcher-cli-windows + uses: actions/upload-artifact@v4 + with: + name: patcher-cli-windows path: patcher/Publish/Windows-x64/PeacockPatcher.CLI.exe - - name: Upload patcher-windows-ui + - name: Upload patcher-cli-linux-portable uses: actions/upload-artifact@v4 with: - name: patcher-windows-ui - path: patcher/Publish/Windows-x64/PeacockPatcher.UI.exe + name: patcher-cli-linux-portable + path: patcher/Publish/Linux-Portable/PeacockPatcher.CLI.exe - - name: Upload patcher-linux-cli + - name: Upload patcher-cli-linux uses: actions/upload-artifact@v4 with: - name: patcher-linux-cli + name: patcher-cli-linux path: patcher/Publish/Linux-x64/PeacockPatcher.CLI.exe + + - name: Upload patcher-ui-windows-portable + uses: actions/upload-artifact@v4 + with: + name: patcher-ui-windows-portable + path: patcher/Publish/Windows-Portable/PeacockPatcher.UI.exe + + - name: Upload patcher-ui-windows + uses: actions/upload-artifact@v4 + with: + name: patcher-ui-windows + path: patcher/Publish/Windows-x64/PeacockPatcher.UI.exe + diff --git a/patcher/.gitignore b/patcher/.gitignore index b876dba6..3c822463 100644 --- a/patcher/.gitignore +++ b/patcher/.gitignore @@ -1,6 +1,7 @@ .vs bin obj +/Publish /HitmanPatcher.sln.DotSettings.user /.idea/.idea.HitmanPatcher/.idea/riderMarkupCache.xml *.suo diff --git a/patcher/HitmanPatcher.CLI/HitmanPatcher.CLI.csproj b/patcher/HitmanPatcher.CLI/HitmanPatcher.CLI.csproj index 99b7b718..f910a37a 100644 --- a/patcher/HitmanPatcher.CLI/HitmanPatcher.CLI.csproj +++ b/patcher/HitmanPatcher.CLI/HitmanPatcher.CLI.csproj @@ -7,7 +7,7 @@ HitmanPatcher PeacockPatcher.CLI - + Peacock Patcher Peacock's HITMAN™ World of Assassination trilogy game patcher. The Peacock Project @@ -18,6 +18,8 @@ patcher.ico 8.0.0.0 8.0.0.0 + + $(DefineConstants);LINUX diff --git a/patcher/HitmanPatcher.CLI/Program.cs b/patcher/HitmanPatcher.CLI/Program.cs index f4228e25..f25d6bac 100644 --- a/patcher/HitmanPatcher.CLI/Program.cs +++ b/patcher/HitmanPatcher.CLI/Program.cs @@ -24,6 +24,7 @@ private static void Main(string[] args) settings.SaveToFile(); Console.WriteLine("Settings:"); + Console.WriteLine($"- File = {Path.GetFullPath(Settings.GetSavePath())}"); Console.WriteLine($"- CustomConfigDomain = {settings.patchOptions.CustomConfigDomain}"); Console.WriteLine($"- UseHttp = {settings.patchOptions.UseHttp}"); Console.WriteLine($"- DisableForceDynamicResources = {settings.patchOptions.DisableForceOfflineOnFailedDynamicResources}"); diff --git a/patcher/HitmanPatcher.Core/Compositions.cs b/patcher/HitmanPatcher.Core/Compositions.cs index fdb038f5..184e2d47 100644 --- a/patcher/HitmanPatcher.Core/Compositions.cs +++ b/patcher/HitmanPatcher.Core/Compositions.cs @@ -1,4 +1,4 @@ -#if WINDOWS +#if !LINUX using System.Security.Principal; #endif @@ -16,12 +16,12 @@ public static void Initialize() private static bool CheckForAdmin() { -#if WINDOWS +#if LINUX + return false; +#else WindowsIdentity identity = WindowsIdentity.GetCurrent(); WindowsPrincipal principal = new WindowsPrincipal(identity); return principal.IsInRole(WindowsBuiltInRole.Administrator); -#else - return false; #endif } } diff --git a/patcher/HitmanPatcher.Core/HitmanPatcher.Core.csproj b/patcher/HitmanPatcher.Core/HitmanPatcher.Core.csproj index 12cd3144..1e02e604 100644 --- a/patcher/HitmanPatcher.Core/HitmanPatcher.Core.csproj +++ b/patcher/HitmanPatcher.Core/HitmanPatcher.Core.csproj @@ -6,5 +6,8 @@ HitmanPatcher PeacockPatcher.Core + + $(DefineConstants);LINUX + CA1416 diff --git a/patcher/HitmanPatcher.Core/Settings.cs b/patcher/HitmanPatcher.Core/Settings.cs index eb7cabec..1153029b 100644 --- a/patcher/HitmanPatcher.Core/Settings.cs +++ b/patcher/HitmanPatcher.Core/Settings.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.IO; - namespace HitmanPatcher { public class Settings @@ -30,20 +26,21 @@ public Settings() trayDomains = new List(); } - private static string GetSavePath() + public static string GetSavePath() { - if (!Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\PeacockProject")) +#if LINUX + return "peacock_patcher.conf"; +#else + string appData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); + string folder = Path.Combine(appData, "PeacockProject"); + + if (!Directory.Exists(folder)) { - Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\PeacockProject"); + Directory.CreateDirectory(folder); } - string appData = Environment.GetFolderPath(Environment - .SpecialFolder - .ApplicationData); - - string folder = $@"{appData}\PeacockProject\"; - string config1 = folder + "peacock_patcher.conf"; - string config2 = folder + "peacock_patcher2.conf"; + string config1 = Path.Combine(folder, "peacock_patcher.conf"); + string config2 = Path.Combine(folder, "peacock_patcher2.conf"); if (File.Exists(config1)) { @@ -51,6 +48,7 @@ private static string GetSavePath() } return config2; +#endif } public void SaveToFile() @@ -59,7 +57,7 @@ public void SaveToFile() lines.Add(string.Format("CustomConfigDomain={0}", patchOptions.CustomConfigDomain)); lines.Add(string.Format("UseHttp={0}", patchOptions.UseHttp)); lines.Add(string.Format("DisableForceDynamicResources={0}", patchOptions.DisableForceOfflineOnFailedDynamicResources)); - lines.Add(string.Format("DarkModeEnabled={0}", darkModeEnabled)); + lines.Add(string.Format("DarkModeEnabled={0}", darkModeEnabled)); lines.Add(string.Format("startInTray={0}", startInTray)); lines.Add(string.Format("minToTray={0}", minimizeToTray)); @@ -100,9 +98,9 @@ public static Settings GetFromFile() case "DisableForceDynamicResources": result.patchOptions.DisableForceOfflineOnFailedDynamicResources = bool.Parse(linecontents[1]); break; - case "DarkModeEnabled": - result.darkModeEnabled = bool.Parse(linecontents[1]); - break; + case "DarkModeEnabled": + result.darkModeEnabled = bool.Parse(linecontents[1]); + break; case "startInTray": result.startInTray = bool.Parse(linecontents[1]); break; diff --git a/patcher/HitmanPatcher.UI/HitmanPatcher.UI.csproj b/patcher/HitmanPatcher.UI/HitmanPatcher.UI.csproj index 2eb34b1d..c1a42826 100644 --- a/patcher/HitmanPatcher.UI/HitmanPatcher.UI.csproj +++ b/patcher/HitmanPatcher.UI/HitmanPatcher.UI.csproj @@ -20,6 +20,8 @@ patcher.ico 8.0.0.0 8.0.0.0 + + $(DefineConstants);LINUX diff --git a/patcher/build.bat b/patcher/build.bat new file mode 100644 index 00000000..bf16ad0e --- /dev/null +++ b/patcher/build.bat @@ -0,0 +1,14 @@ +@echo off +rem Windows - CLI +dotnet publish HitmanPatcher.CLI/HitmanPatcher.CLI.csproj -r win-x64 -c Release -p:PublishSingleFile=True --no-self-contained -p DebugType=none -p:EnableWindowsTargeting=True -o Publish/Windows-Portable +dotnet publish HitmanPatcher.CLI/HitmanPatcher.CLI.csproj -r win-x64 -c Release -p:PublishTrimmed=True -p:PublishSingleFile=True --self-contained -p DebugType=none -p:EnableWindowsTargeting=True -o Publish/Windows-x64 + +rem Linux - CLI +dotnet publish HitmanPatcher.CLI/HitmanPatcher.CLI.csproj -r linux-x64 -c Release -p:PublishSingleFile=True --no-self-contained -p DebugType=none -p:IsLinux=true -o Publish/Linux-Portable +dotnet publish HitmanPatcher.CLI/HitmanPatcher.CLI.csproj -r linux-x64 -c Release -p:PublishTrimmed=True -p:PublishSingleFile=True --self-contained -p DebugType=none -p:IsLinux=true -o Publish/Linux-x64 + +rem Windows - UI +dotnet publish HitmanPatcher.UI/HitmanPatcher.UI.csproj -r win-x64 -c Release -p:PublishSingleFile=True --no-self-contained -p DebugType=none -p:EnableWindowsTargeting=True -o Publish/Windows-Portable +dotnet publish HitmanPatcher.UI/HitmanPatcher.UI.csproj -r win-x64 -c Release -p:PublishSingleFile=True --self-contained -p DebugType=none -p:EnableWindowsTargeting=True -o Publish/Windows-x64 + +pause \ No newline at end of file