Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions GenHub/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<PackageVersion Include="Slugify.Core" Version="5.1.1" />
<PackageVersion Include="DotNetEnv" Version="3.1.1" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
<PackageVersion Include="System.Management" Version="9.0.0" />
<PackageVersion Include="CsvHelper" Version="33.1.0" />
<!-- Test packages -->
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
Expand Down
195 changes: 195 additions & 0 deletions GenHub/GenHub.Core/Constants/ActionSetConstants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
namespace GenHub.Core.Constants;

/// <summary>
/// Centralized constants for ActionSet fixes, registry keys, and file operations.
/// </summary>
public static class ActionSetConstants
{
// RegistryKeys moved to GenHub.Core.Constants.RegistryConstants.cs

/// <summary>
/// File names and content.
/// </summary>
public static class FileNames
{
/// <summary>
/// Gets the desktop.ini file name used for folder customization.
/// </summary>
public const string DesktopIni = "desktop.ini";

/// <summary>
/// Gets the Generals.exe file name.
/// </summary>
public const string GeneralsExe = "generals.exe";

/// <summary>
/// Gets the Game.dat file name.
/// </summary>
public const string GameDat = "Game.dat";

/// <summary>
/// Gets the game.exe file name, often used for Zero Hour.
/// </summary>
public const string GameExe = "game.exe"; // Often used for ZH
}

/// <summary>
/// Initialization file sections and keys.
/// </summary>
public static class IniFiles
{
// Sections

/// <summary>
/// Gets the [.ShellClassInfo] section name for desktop.ini files.
/// </summary>
public const string ShellClassInfoSection = "[.ShellClassInfo]";

/// <summary>
/// Gets the TheSuperHackers section name for Options.ini files.
/// </summary>
public const string TheSuperHackersSection = "TheSuperHackers";

// Keys

/// <summary>
/// Gets the ThisPCPolicy key name used to disable OneDrive sync.
/// </summary>
public const string ThisPCPolicyKey = "ThisPCPolicy";

/// <summary>
/// Gets the ThisPCPolicy value to disable OneDrive cloud sync.
/// </summary>
public const string ThisPCPolicyValue = "DisableCloudSync";

/// <summary>
/// Gets the ConfirmFileOp key name used in desktop.ini files.
/// </summary>
public const string ConfirmFileOpKey = "ConfirmFileOp";

// TheSuperHackers keys

/// <summary>
/// Gets the ScrollEdgeZone key name for edge scrolling settings.
/// </summary>
public const string ScrollEdgeZoneKey = "ScrollEdgeZone";

/// <summary>
/// Gets the ScrollEdgeSpeed key name for edge scrolling settings.
/// </summary>
public const string ScrollEdgeSpeedKey = "ScrollEdgeSpeed";

/// <summary>
/// Gets the ScrollEdgeAcceleration key name for edge scrolling settings.
/// </summary>
public const string ScrollEdgeAccelerationKey = "ScrollEdgeAcceleration";
}

/// <summary>
/// Firewall rule names and protocols.
/// </summary>
public static class FirewallRules
{
/// <summary>
/// Gets the prefix used for firewall rule names for GenPatcher compatibility.
/// </summary>
public const string Prefix = "GP"; // Compatibility with GenPatcher

/// <summary>
/// Gets the firewall rule name for UDP port 16000.
/// </summary>
public const string PortRuleUdp16000 = "GP Open UDP Port 16000";

/// <summary>
/// Gets the firewall rule name for UDP port 16001.
/// </summary>
public const string PortRuleUdp16001 = "GP Open UDP Port 16001";

/// <summary>
/// Gets the firewall rule name for TCP port 16001.
/// </summary>
public const string PortRuleTcp16001 = "GP Open TCP Port 16001";

/// <summary>
/// Gets the firewall rule name for Generals.exe.
/// </summary>
public const string GeneralsRule = "GP Command & Conquer Generals";

/// <summary>
/// Gets the firewall rule name for Generals Game.dat.
/// </summary>
public const string GeneralsGameDatRule = "GP Command & Conquer Generals Game.dat";

/// <summary>
/// Gets the firewall rule name for Zero Hour.
/// </summary>
public const string ZeroHourRule = "GP Command & Conquer Generals Zero Hour";

/// <summary>
/// Gets the firewall rule name for Zero Hour Game.dat.
/// </summary>
public const string ZeroHourGameDatRule = "GP Command & Conquer Generals Zero Hour Game.dat";

/// <summary>
/// Gets the UDP protocol string.
/// </summary>
public const string ProtocolUdp = "UDP";

/// <summary>
/// Gets the TCP protocol string.
/// </summary>
public const string ProtocolTcp = "TCP";
}

/// <summary>
/// Constants for Malwarebytes detection and paths.
/// </summary>
public static class Malwarebytes
{
/// <summary>
/// Gets the registry uninstall key path for detecting Malwarebytes.
/// </summary>
public const string RegistryUninstallKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";

/// <summary>
/// Gets the DisplayName value name in the registry.
/// </summary>
public const string DisplayNameValue = "DisplayName";

/// <summary>
/// Gets the string to check for in DisplayName to identify Malwarebytes.
/// </summary>
public const string NameContains = "Malwarebytes";

/// <summary>
/// Gets the array of executable paths for Malwarebytes applications.
/// </summary>
public static readonly string[] ExecutablePaths =
[
Path.Combine("Malwarebytes", "Anti-Malware", "mbam.exe"),
Path.Combine("Malwarebytes", "Anti-Malware", "mbamtray.exe")
];
}

/// <summary>
/// File and directory paths used by ActionSets.
/// </summary>
public static class Paths
{
/// <summary>
/// Gets the directory name for sub-action set markers.
/// </summary>
public const string SubActionSetMarkers = "sub_markers";
}

/// <summary>
/// Validation constants for file operations.
/// </summary>
public static class Validation
{
/// <summary>
/// Minimum file size for VCRedist installers (1000 KB).
/// </summary>
public const long VCRedistMinSize = 1000 * 1024;
}
}
85 changes: 85 additions & 0 deletions GenHub/GenHub.Core/Constants/ExternalUrls.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
namespace GenHub.Core.Constants;

/// <summary>
/// Constants for external URLs used for downloading dependencies or tools.
/// </summary>
public static class ExternalUrls
{
/// <summary>
/// Download URL for Visual C++ 2010 Redistributable Package (x86).
/// Required for Generals and Zero Hour to run.
/// </summary>
public const string VCRedist2010DownloadUrl = "https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x86.exe";

/// <summary>
/// Gets the primary download URL for DirectX runtime (Microsoft Official).
/// </summary>
public const string DirectXRuntimeDownloadUrlPrimary = "https://download.microsoft.com/download/1/7/1/1718CCC4-6315-4D8E-9543-8E28A4E18C4C/dxwebsetup.exe";

/// <summary>
/// Gets the secondary download URL for DirectX runtime (Gentool).
/// </summary>
public const string DirectXRuntimeDownloadUrlMirror1 = "https://gentool.net/program_data/genpatcher/drtx.dat";

/// <summary>
/// Download URL for Generals 1.08 official patch.
/// </summary>
public const string Generals108PatchUrl = "https://gentool.net/program_data/genpatcher/10gn.dat";

/// <summary>
/// Gets the primary download URL for Zero Hour 1.04 patch (CNCNZ).
/// </summary>
public const string ZeroHour104PatchUrlPrimary = "http://http.cncnz.com/patches/GeneralsZH-104-english.exe";

/// <summary>
/// Gets the secondary download URL for Zero Hour 1.04 patch (Gentool).
/// </summary>
public const string ZeroHour104PatchUrlMirror1 = "https://gentool.net/program_data/genpatcher/10zh.dat";

/// <summary>
/// Gets the primary download URL for GenTool (Gentool).
/// </summary>
public const string GenToolDownloadUrlPrimary = "https://gentool.net/program_data/genpatcher/gent.dat";

/// <summary>
/// Gets the secondary download URL for GenTool (Legi.cc).
/// </summary>
public const string GenToolDownloadUrlMirror1 = "https://legi.cc/gp2/f/gent.dat";

/// <summary>
/// Gets the primary download URL for Visual C++ 2005 Redistributable (Gentool).
/// </summary>
public const string VCRedist2005DownloadUrlPrimary = "https://gentool.net/program_data/genpatcher/vcredist_x86-2005.exe";

/// <summary>
/// Gets the secondary download URL for Visual C++ 2005 Redistributable (Legi.cc).
/// </summary>
public const string VCRedist2005DownloadUrlMirror1 = "https://legi.cc/gp2/f/vc05.dat";

/// <summary>
/// Gets the primary download URL for Visual C++ 2008 Redistributable (Gentool).
/// </summary>
public const string VCRedist2008DownloadUrlPrimary = "https://gentool.net/program_data/genpatcher/vcredist_x86-2008.exe";

/// <summary>
/// Gets the secondary download URL for Visual C++ 2008 Redistributable (Legi.cc).
/// </summary>
public const string VCRedist2008DownloadUrlMirror1 = "https://legi.cc/gp2/f/vc08.dat";

// Legacy support

/// <summary>
/// Legacy download URL for DirectX runtime.
/// </summary>
public const string DirectXRuntimeDownloadUrl = DirectXRuntimeDownloadUrlPrimary;

/// <summary>
/// Legacy download URL for Zero Hour 1.04 patch.
/// </summary>
public const string ZeroHour104PatchUrl = ZeroHour104PatchUrlPrimary;

/// <summary>
/// Download URL for Intel Graphics Drivers.
/// </summary>
public const string IntelDriverDownloadUrl = "https://www.intel.com/content/www/us/en/download-center/home";
}
12 changes: 12 additions & 0 deletions GenHub/GenHub.Core/Constants/GameClientConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,18 @@ public static class GameClientConstants
/// </summary>
public const string ZeroHourShortName = "Zero Hour";

/// <summary>BrowserEngine.dll filename.</summary>
public const string BrowserEngineDll = "BrowserEngine.dll";

/// <summary>BrowserEngine.dll backup filename.</summary>
public const string BrowserEngineDllBak = "BrowserEngine.dll.bak";

/// <summary>dbghelp.dll filename.</summary>
public const string DbgHelpDll = "dbghelp.dll";

/// <summary>dbghelp.dll backup filename.</summary>
public const string DbgHelpDllBak = "dbghelp.dll.bak";

/// <summary>
/// DLLs required for standard game installations.
/// </summary>
Expand Down
Loading