Skip to content

Constants Reference

This document provides comprehensive documentation for all constants used throughout the GenHub application. Constants are defined in static classes within the GenHub.Core.Constants namespace and follow StyleCop conventions.

Overview

GenHub uses a centralized constants system to ensure consistency across the application. Constants are organized into logical groups for better maintainability and consistency.


ApiConstants Class

API and network related constants.

User Agents

  • DefaultUserAgent: Default user agent string for HTTP requests (constructed as "GenHub/1.0" from AppConstants.ApplicationName and AppConstants.Version)

GitHub

  • GitHubDomain: GitHub domain name ("github.com")
  • GitHubUrlRegexPattern: Regex pattern for parsing repository URLs (@"^https://github\.com/(?<owner>[^/]+)/(?<repo>[^/]+)(?:/releases/tag/(?<tag>[^/]+))?")

UriConstants

URI scheme constants for handling different types of URIs and paths.

  • AvarUriScheme: URI scheme for Avalonia embedded resources ("avares://")
  • HttpUriScheme: HTTP URI scheme ("http://")
  • UploadThingUrlFragment: URL fragment for identification ("utfs.io/f/")
  • Upload and credential constants were removed while cloud uploads are disabled. UploadThingUrlFragment remains only for importing existing public links.

Upload Gateway & Cloud Storage

  • MediaTypeZip: Media type for ZIP archives ("application/zip")
  • DefaultUploadFileName: Default filename fallback for generic uploads when a source filename cannot be determined ("upload.zip")
  • DefaultUploadGatewayBaseUrl: Base URL for the community upload gateway ("https://genhub-upload-gateway.mustafa2146.workers.dev")
  • UploadEndpoint: Endpoint path for cloud uploads ("/api/v1/uploads")
  • UploadDeleteEndpoint: Endpoint path for deleting cloud uploads ("/api/v1/uploads/delete")

Media Types

  • HttpsUriScheme: HTTPS URI scheme ("https://")
  • GeneralsIconUri: Icon URI for Generals game type ("avares://GenHub/Assets/Icons/generals-icon.png")
  • ZeroHourIconUri: Icon URI for Zero Hour game type ("avares://GenHub/Assets/Icons/zerohour-icon.png")
  • DefaultIconUri: Default icon URI for unknown game types ("avares://GenHub/Assets/Icons/generalshub-icon.png")

AppConstants

Application-wide constants for GenHub.

ConstantValue/TypeDescription
AppName"GenHub"The name of the application
AppVersionDynamic (lazy)Full semantic version from assembly
DisplayVersion"v" + AppVersionDisplay version for UI
GitShortHashDynamicShort git commit hash (7 chars)
GitShortHashLength7Length of git short hash
PullRequestNumberDynamicPR number if PR build
BuildChannelDynamicBuild channel (Dev, PR, CI, Release)
IsCiBuildboolWhether this is a CI/CD build
FullDisplayVersionstringFull display version with hash
GitHubRepositoryUrl"https://github.com/community-outpost/GenHub"GitHub repository URL
GitHubRepositoryOwner"community-outpost"GitHub repository owner
GitHubRepositoryName"GenHub"GitHub repository name
DefaultThemeTheme.DarkDefault UI theme
DefaultThemeName"Dark"Default theme name as string
TokenFileName".ghtoken"Default GitHub token file name
DeleteAllDataConfirmationTitle"Delete All Application Data"Title of the confirmation prompt shown before all application data is deleted
DeleteAllDataConfirmationMessagestringBody of that prompt, warning that the deletion is irreversible and that pristine game data backups are discarded
DeleteAllDataConfirmText"Delete Everything"Confirm button text for the delete-all-application-data prompt

LocalizationConstants Class

Constants used by the application localization foundation.

ConstantValueDescription
DefaultCultureName"en"Neutral culture embedded in the main application assembly
IndexerPropertyName"Item"Avalonia change-notification name used to refresh localized indexer bindings
ResourceServiceKey"LocalizationService"Application resource key used by the Avalonia markup extension
StringResourceBaseName"GenHub.Resources.Localization.Strings"Fully qualified .NET resource base name
SatelliteAssemblySuffix".resources.dll"Standard suffix used to identify satellite assemblies

AppUpdateConstants Class

Constants related to application updates and Velopack.

ConstantValue/TypeDescription
MaxHttpRetries3Maximum number of HTTP retries for failed requests
UpdateTabIndex0Index for the Update tab in update notification views
BrowseBuildsTabIndex1Index for the Browse Builds tab in update notification views
MaxTabIndex1Maximum valid tab index in update notification views
VelopackDirectory"velopack"Velopack directory name
ArtifactPrefixWindows"genhub-velopack-windows-"Artifact name prefix for Windows builds
ArtifactPrefixLinux"genhub-velopack-linux-"Artifact name prefix for Linux builds
ArtifactNameRelease"GenHub-Release"Artifact name for release builds
PlatformWindows"windows"Platform string for Windows
PlatformLinux"linux"Platform string for Linux
CheckingForUpdatesMessage"Checking..."Update checking message
UpdateAvailableTitleFormat"Update available: v{0}"Update available title format string
UpdateUpToDateMessage"You're up to date!"Update up to date message
UpdateCheckFailedMessage"Update check failed"Update check failed message
InstallingMessage"Installing..."Installing message
InstallUpdateAction"Install Update"Install update action text
InitializingMessage"Initializing..."Initializing message
ReadyToRestartMessage"Ready to restart"Ready to restart message
DownloadingFormat"Downloading... {0}%"Downloading format string
UpdateDownloadedRestartingMessage"Update downloaded! Restarting application..."Update downloaded and restarting message
UpdateCompleteRestartingMessage"Update complete! Restarting..."Update complete and restarting message
DownloadingUpdateMessage"Downloading update..."Downloading update status message
CannotInstallFromLocationMessage"Cannot install from this location"Cannot install from location status message
UpdateFailedMessage"Update failed"Update failed status message
InstallationFailedMessage"Installation failed"Installation failed status message
NoArtifactAvailableMessage"No artifact available"No artifact available status message
NoVersionsFoundMessage"No versions found"No versions found dropdown placeholder
LoadingVersionsMessage"Loading versions..."Loading versions dropdown placeholder
SelectVersionMessage"Select a version"Select a version dropdown placeholder
NotAvailable"N/A"Not available string
UpdateInstallationRequiresAppInstalledMessageFormat stringMessage format when trying to install update from uninstalled debug directory
UpdateAvailableNotificationTitle"Update Available"Update available notification title for release channel
BranchUpdateAvailableNotificationTitle"Branch Update Available"Update available notification title for branch subscriptions
PrUpdateAvailableNotificationTitle"PR Update Available"Update available notification title for PR subscriptions
UpdateAction"Update"Update action button text
UpdatingAppNotificationTitle"Updating GenHub"Title for update in progress notification
UpdateStartingMessage"Starting update..."Starting update progress message
UpdateFailedNotificationTitle"Update Failed"Title for update failed notification
UpdateFailedNotificationFormat"Failed to install update: {0}"Update failed notification body format string
ViewUpdatesAction"View Updates"View updates action button text
ReleaseUpdateNotificationFormat"A new version ({0}) is available."Release update notification body format string
BranchUpdateNotificationFormat"A new build ({0}) is available on branch '{1}'."Branch update notification body format string
PrUpdateNotificationFormat"A new build ({0}) is available for PR #{1}."PR update notification body format string
DevelopmentBranch"development"Default development branch name for CI artifact fallback
MainBranch"main"Default main branch name for release updates
PrMergedUpdateAvailableNotificationTitle"PR Merged — Update Available"Update available notification title when subscribed PR is merged or closed
BranchStaleUpdateAvailableNotificationTitle"Branch Fallback: Update Available"Update available notification title when subscribed branch is stale
PrMergedUpdateNotificationFormatFormat stringPR merged/closed fallback notification format string
PrMergedReleaseNotificationFormatFormat stringPR merged/closed release fallback notification format string
BranchStaleUpdateNotificationFormatFormat stringBranch stale fallback notification format string
BranchStaleReleaseNotificationFormatFormat stringBranch stale release fallback notification format string
PrMergedStatusMessageFormatFormat stringPR merged/closed status message format string
BranchStaleStatusMessageFormatFormat stringBranch stale status message format string
PatRequiredForArtifactsMessageMessage stringMessage displayed when checking branch/PR artifacts without GitHub PAT
PrDedupePrefix"pr:"Deduplication key prefix for PR update notifications
PrFallbackDedupePrefix"pr-fallback:"Deduplication key prefix for PR fallback update notifications
BranchDedupePrefix"branch:"Deduplication key prefix for branch update notifications
BranchFallbackDedupePrefix"branch-fallback:"Deduplication key prefix for branch fallback update notifications
ReleaseDedupePrefix"release:"Deduplication key prefix for release update notifications
GitHubFallbackDedupePrefix"github:"Deduplication key prefix for GitHub API fallback update notifications
NotificationAlreadyShownLogFormat"Update notification..."Log format string when skipping duplicate update notifications
SortOptionLastUpdated"Last Updated"Sort option: sort by last updated date descending
SortOptionPrNumberDesc"PR Number (Highest)"Sort option: sort by pull request number descending
SortOptionPrNumberAsc"PR Number (Lowest)"Sort option: sort by pull request number ascending
DefaultPeriodicUpdateCheckIntervalMinutes30Default interval in minutes for periodic update checks (30 minutes)
MinPeriodicUpdateCheckIntervalMinutes5Minimum interval in minutes for periodic update checks (5 minutes)
MaxPeriodicUpdateCheckIntervalMinutes10080Maximum interval in minutes for periodic update checks (10080 minutes / 7 days)
PeriodicUpdateCheckIntervalIncrementMinutes5Increment step in minutes for periodic update check interval setting (5 minutes)
PostUpdateExitDelayTimeSpan.FromSeconds(5)Delay before exit after applying update (5 seconds)
CacheDurationTimeSpan.FromHours(1)Cache duration for update checks (1 hour)

CasDefaults Class

Default values and limits for Content-Addressable Storage (CAS).

ConstantValueDescription
MaxCacheSizeBytes53687091200 (50GB)Default maximum cache size
DefaultMaxCacheSizeGB50Default maximum cache size in gigabytes
MaxConcurrentOperations4Default maximum concurrent CAS operations
GcGracePeriodDays7Default garbage collection grace period in days

ConfigurationKeys Class

Configuration key constants for appsettings.json and environment variables.

Workspace Configuration

  • WorkspaceDefaultPath: "GenHub:Workspace:DefaultPath" - Default path for workspace creation
  • WorkspaceDefaultStrategy: "GenHub:Workspace:DefaultStrategy" - Default workspace strategy (SymlinkOnly)

Note: The default workspace strategy is SymlinkOnly (enum value 0), which creates symbolic links to minimize disk usage. This requires administrator rights on Windows.

Cache Configuration

  • CacheDefaultPath: "GenHub:Cache:DefaultPath"

UI Configuration

  • UiDefaultTheme: "GenHub:UI:DefaultTheme"
  • UiDefaultWindowWidth: "GenHub:UI:DefaultWindowWidth"
  • UiDefaultWindowHeight: "GenHub:UI:DefaultWindowHeight"

Downloads Configuration

  • DownloadsDefaultTimeoutSeconds: "GenHub:Downloads:DefaultTimeoutSeconds"
  • DownloadsDefaultUserAgent: "GenHub:Downloads:DefaultUserAgent"
  • DownloadsDefaultMaxConcurrent: "GenHub:Downloads:DefaultMaxConcurrent"
  • DownloadsDefaultBufferSize: "GenHub:Downloads:DefaultBufferSize"

Downloads Policy Configuration

  • DownloadsPolicyMinConcurrent: "GenHub:Downloads:Policy:MinConcurrent"
  • DownloadsPolicyMaxConcurrent: "GenHub:Downloads:Policy:MaxConcurrent"
  • DownloadsPolicyMinTimeoutSeconds: "GenHub:Downloads:Policy:MinTimeoutSeconds"
  • DownloadsPolicyMaxTimeoutSeconds: "GenHub:Downloads:Policy:MaxTimeoutSeconds"
  • DownloadsPolicyMinBufferSizeBytes: "GenHub:Downloads:Policy:MinBufferSizeBytes"
  • DownloadsPolicyMaxBufferSizeBytes: "GenHub:Downloads:Policy:MaxBufferSizeBytes"

App Data Configuration

  • AppDataPath: "GenHub:AppDataPath"

WorkspaceConstants Class

Constants related to workspace management and configuration.

  • DefaultWorkspaceStrategy: The default workspace strategy to use when none is specified (WorkspaceStrategy.HardLink)
  • ZeroCopyElevationGuidance: Guidance message appended to errors when zero-copy hard links or symlinks cannot be created ("To use zero-copy workspaces without copying game files, ensure GenHub has permission to create links (on Windows, enable Developer Mode or run as Administrator).")

CommandLineConstants Class

Constants for command line arguments and URI schemes.

ConstantValueDescription
LaunchProfileArg"--launch-profile"Command-line argument used to request launching a profile
LaunchProfileInlinePrefix"--launch-profile="Prefix for inline profile launching
UriScheme"genhub://"URI scheme used for protocol handling
SubscribeCommand"subscribe"Command for subscribing to a catalog via URI
SubscribeUriPrefix"genhub://subscribe"Full prefix for subscription URI
SubscribeUrlParam"?url="Query parameter name for the catalog URL

ConversionConstants Class

Constants for unit conversions used throughout the application.

  • BytesPerKilobyte: 1024
  • BytesPerMegabyte: 1048576
  • BytesPerGigabyte: 1073741824

Color Conversion Constants

  • LuminanceRedCoefficient: Coefficient for red channel in luminance calculation (0.299)
  • LuminanceGreenCoefficient: Coefficient for green channel in luminance calculation (0.587)
  • LuminanceBlueCoefficient: Coefficient for blue channel in luminance calculation (0.114)
  • BrightnessThreshold: Threshold value for determining if a color is light or dark (0.5)

DirectoryNames

Directory names used for organizing content storage.

ConstantValueDescription
Data"Data"Directory for content data
Cache"Cache"Directory for cache files
CasPool"cas-pool"Directory for CAS pool
Temp"Temp"Directory for temporary files
Logs"Logs"Directory for log files
Backups"Backups"Directory for backup files
Profiles"Profiles"Directory for game profiles
UserData"UserData"Directory for tracked user data
UserDataManifests"manifests"Manifests of tracked user data, nested in UserData (exact on-disk case)
UserDataBackups"backups"Backups of replaced user data files, nested in UserData (exact on-disk case)
Workspaces"Workspaces"Directory for workspaces
ToolWorkspaces"ToolWorkspaces"Directory for tool workspaces
LegacyContent"Content"Sub-layout used up to v0.0.3; probed only by the upgrade migration

DownloadDefaults Class

Default values and limits for download operations.

  • BufferSizeBytes: 81920
  • BufferSizeKB: 80.0
  • MinBufferSizeKB: 4.0
  • MaxBufferSizeKB: 1024.0
  • MaxConcurrentDownloads: 3
  • MaxRetryAttempts: 3
  • TimeoutSeconds: 600

FileTypes Class

File and directory name constants to prevent typos and ensure consistency.

Manifest Files

ConstantValueDescription
ManifestsDirectory"Manifests"Directory for manifest files
ManifestFilePattern"*.manifest.json"File pattern for manifest files
ManifestFileExtension".manifest.json"File extension for manifest files
UserDataManifestExtension".userdata.json"File extension for user data manifest files
BackupExtension".ghbak"File extension for backup files

JSON Files

ConstantValueDescription
JsonFileExtension".json"File extension for JSON files
JsonFilePattern"*.json"File pattern for JSON files
SettingsFileName"settings.json"Default settings file name
LegacySettingsFileName".json"Settings file name written up to v0.0.3; probed only by the upgrade migration
WorkspaceMetadataFileName"workspaces.json"File holding the persisted workspace metadata
UserDataIndexFileName"index.json"Index of installed user data, nested in UserData

ManifestConstants Class

Constants related to manifest ID generation, validation, and file operations.

Manifest ID Generation

ConstantValueDescription
DefaultManifestFormatVersion1Default manifest format version (integer)
DefaultManifestVersion"1.0"Default manifest version as string
PublisherContentIdPrefix"publisher"Prefix for publisher content IDs
BaseGameIdPrefix"gameinstallation"Prefix for game installation IDs
SimpleIdPrefix"simple"Prefix for simple test IDs
GeneralsManifestVersion"1.08"Version string for Generals game installation manifests (dots removed in IDs: "108")
ZeroHourManifestVersion"1.04"Version string for Zero Hour game installation manifests (dots removed in IDs: "104")

Manifest Validation

ConstantValueDescription
MaxManifestIdLength256Maximum length for manifest IDs
MinManifestIdLength3Minimum length for manifest IDs
MaxManifestSegments5Maximum number of segments in manifest ID

Manifest Timeouts and Operations

ConstantValueDescription
ManifestIdGenerationTimeoutMs5000Timeout for manifest ID generation operations (milliseconds)
ManifestValidationTimeoutMs1000Timeout for manifest validation operations (milliseconds)
MaxConcurrentManifestOperations10Maximum concurrent manifest operations

Manifest ID Regex Patterns

ConstantDescription
PublisherContentRegexPatternRegex for validating 5-segment publisher content IDs (schemaVersion.userVersion.publisher.contentType.contentName)
------------------------------------------------------------------------------------------------------------------------------------------------

Publisher Content Regex Pattern (5-segment format):

regex
^\d+\.\d+\.[a-z0-9]+\.(gameinstallation|gameclient|mod|patch|addon|mappack|languagepack|contentbundle|publisherreferral|contentreferral|mission|map|moddingtool|unknown)\.[a-z0-9-]+$

Pattern Explanation:

  • Publisher Content Pattern: Validates the standard 5-segment format used for ALL content in GenHub
    • Segment 1: Schema version (digits only)
    • Segment 2: User version (digits only)
    • Segment 3: Publisher (lowercase alphanumeric)
    • Segment 4: Content type (enumerated values like gameinstallation, mod, moddingtool, etc.)
    • Segment 5: Content name (lowercase alphanumeric with dashes)

Note: The SimpleIdRegex pattern has been removed. All manifest IDs must now use the strict 5-segment format. The MinManifestSegments constant is now set to 5 (previously 1).

Dependency Defaults

ConstantValueDescription
GeneralsManifestVersion"1.08"Version string for Generals game installation manifests. When used in manifest IDs, dots are removed (becomes "108").
ZeroHourManifestVersion"1.04"Version string for Zero Hour game installation manifests. When used in manifest IDs, dots are removed (becomes "104").
DefaultContentDependencyId"1.0.genhub.mod.defaultdependency"Default ID string for content dependencies (fallback for model instantiation)

SteamConstants Class

Constants related to Steam integration and the proxy launcher.

ConstantValueDescription
GeneralsAppId"17300"Steam AppID for Generals
ZeroHourAppId"2732960"Steam AppID for Zero Hour
TrackingFileName".genhub-files.json"Tracking file for Steam launches
BackupDirName".genhub-backup"Backup directory for original game files
BackupExtension".ghbak"Extension for backed up game executables
ProxyLauncherFileName"GenHub.ProxyLauncher.exe"Filename of the proxy launcher executable

GameClientHashRegistry Class

Extensible SHA-256 hash constants and registry for known game executables used for client detection across official and 3rd party distributions. Supports dynamic updates, external hash databases, and plugin extensibility.

Core Hash Constants

ConstantValueDescription
Generals108Hash"1c96366ff6a99f40863f6bbcfa8bf7622e8df1f80a474201e0e95e37c6416255"SHA-256 hash for Generals 1.08 executable (generals.exe)
ZeroHour104Hash"f37a4929f8d697104e99c2bcf46f8d833122c943afcd87fd077df641d344495b"SHA-256 hash for Zero Hour 1.04 executable (generals.exe)
ZeroHour105Hash"420fba1dbdc4c14e2418c2b0d3010b9fac6f314eafa1f3a101805b8d98883ea1"SHA-256 hash for Zero Hour 1.05 executable (generals.exe)

Extensibility Configuration Constants

ConstantValueDescription
ExternalHashDatabaseFileName"game-executable-hashes.json"Default filename for external hash database JSON file
MaxExternalHashSources50Maximum number of external hash sources that can be registered
ExternalSourceCacheTimeoutMinutes30Cache timeout for external hash sources in minutes

Collections and Properties

PropertyTypeDescription
PossibleExecutableNamesList<string>Executable file names that might contain game executables (extensible at runtime)

Basic Usage Example

csharp
using GenHub.Core.Constants;

// Basic hash detection (backward compatible)
if (computedHash == GameClientHashRegistry.Generals108Hash)
{
    // Detected Generals 1.08
}
else if (computedHash == GameClientHashRegistry.ZeroHour104Hash)
{
    // Detected Zero Hour 1.04
}

var info = GameClientHashRegistry.GetGameExecutableInfo(computedHash);
if (info.HasValue)
{
    Console.WriteLine($"Detected: {info.Value.GameType} {info.Value.Version} ({info.Value.Publisher})");
}

Extensibility Usage

csharp
using GenHub.Core.Constants;

// Add runtime hash for 3rd party client
GameClientHashRegistry.AddKnownHash(
    "abc123...",
    GameType.Generals,
    "1.09",
    "CommunityPatch",
    "Community-enhanced Generals executable",
    false);

// Add custom executable name
GameClientHashRegistry.AddPossibleExecutableName("my-modded-generals.exe");

PublisherTypeConstants Class

Well-known publisher type identifiers for content sources. Uses lowercase string identifiers for consistency with ManifestId system.

Important Note

PublisherTypeConstants is NOT an enum - publishers are string-based for extensibility. Any string value is valid; these constants are just common values for convenience. This follows the same pattern as ManifestId (string-based with validation).

Official Platform Publishers

ConstantValueDescription
EaApp"eaapp"EA App (formerly Origin) platform
Steam"steam"Steam platform
Retail"retail"Retail/physical installation
TheFirstDecade"thefirstdecade"The First Decade compilation
Wine"wine"Wine/Proton compatibility layer
CdIso"cdiso"CD-ROM/ISO installation

Community Platforms

ConstantValueDescription
GeneralsOnline"generalsonline"Generals Online community platform
CommunityOutpost"communityoutpost"Community Outpost platform
ModDb"moddb"ModDB hosting platform
CncLabs"cnclabs"C&C Labs community site

Web/Download Sources

ConstantValueDescription
GitHub"github"GitHub repository
WebDownload"web"Generic web download

Local/System Sources

ConstantValueDescription
LocalImport"local"Local file import by user
FileSystem"filesystem"Imported from file system

Generated Content

ConstantValueDescription
AutoGenerated"autogenerated"Auto-generated by ContentOrchestrator
GenHubInternal"genhub"GenHub internal system content
CsvGenerated"csvgenerated"Content generated from CSV authoritative source

Special/Unknown

ConstantValueDescription
Unknown"unknown"Unknown or unspecified publisher type
Custom"custom"Custom user-defined publisher

Publisher Type Mapping Methods

FromInstallationType(GameInstallationType): Maps GameInstallationType enum to publisher type string by delegating to the centralized extension method:

csharp
public static string FromInstallationType(GameInstallationType installationType)
{
    return installationType.ToPublisherTypeString();
}

Note: This method now uses the centralized ToPublisherTypeString() extension method from InstallationExtensions.cs to eliminate code duplication and ensure consistent mapping behavior across the codebase.

Publisher Type Usage Examples

csharp
using GenHub.Core.Constants;

// Using platform-specific publisher types
var steamPublisher = PublisherTypeConstants.Steam; // "steam"
var eaAppPublisher = PublisherTypeConstants.EaApp; // "eaapp"

// Using community publisher types
var generalsOnlinePublisher = PublisherTypeConstants.GeneralsOnline; // "generalsonline"

// Mapping installation type to publisher
var installationType = GameInstallationType.Steam;
var publisherType = PublisherTypeConstants.FromInstallationType(installationType);
// Result: "steam"

// In manifest generation (GeneralsOnline example)
var manifest = new ContentManifest
{
    Publisher = new PublisherInfo
    {
        Name = PublisherTypeConstants.GeneralsOnline,
        Website = "https://www.playgenerals.online/",
    }
};

// Using publisher types for content filtering
if (manifest.Publisher?.Name == PublisherTypeConstants.GeneralsOnline)
{
    // Handle GeneralsOnline-specific content
}

// Custom publisher type (not a predefined constant)
var customPublisher = "my-custom-publisher";
// Custom publishers work just like predefined constants

GeneralsOnline Publisher Type

The GeneralsOnline publisher type is used for the GeneralsOnline community launcher, which provides auto-updated clients for Command & Conquer Generals and Zero Hour.

Usage in Game Client Detection:

  • When GeneralsOnline executables are detected (generalsonline_30hz.exe, generalsonline_60hz.exe, generalsonline.exe)
  • Manifests are generated with PublisherType = "generalsonline"
  • UI displays these clients with appropriate publisher attribution
  • Users can select GeneralsOnline variants in game profiles

Manifest ID Examples:

  • 1.0.generalsonline.gameclient.generalsonline_30hz (GeneralsOnline 30Hz client)
  • 1.0.generalsonline.gameclient.generalsonline_60hz (GeneralsOnline 60Hz client)

See also: Manifest ID System Documentation for complete ID format details.


PublisherEndpointConstants Class

Constants for publisher endpoint names and keys used in JSON serialization and lookup.

ConstantValueDescription
CatalogUrl"catalogUrl"Key/Property name for catalog URL
DownloadBaseUrl"downloadBaseUrl"Key/Property name for download base URL
WebsiteUrl"websiteUrl"Key/Property name for website URL
SupportUrl"supportUrl"Key/Property name for support URL
LatestVersionUrl"latestVersionUrl"Key/Property name for latest version URL
ManifestApiUrl"manifestApiUrl"Key/Property name for manifest API URL
Catalog"catalog"Short name/alias for catalog URL
DownloadBase"downloadBase"Short name/alias for download base URL
Website"website"Short name/alias for website URL
Support"support"Short name/alias for support URL
LatestVersion"latestVersion"Short name/alias for latest version URL
ManifestApi"manifestApi"Short name/alias for manifest API URL

PublisherInfoConstants Class

Constants for publisher information including display names, websites, and support URLs. These constants provide standardized publisher metadata for content attribution and user interface display.

Steam Publisher Information

ConstantValueDescription
Name"Steam"Display name for Steam publisher
Website"https://store.steampowered.com"Website URL for Steam
SupportUrl"https://help.steampowered.com"Support URL for Steam

EA App Publisher Information

ConstantValueDescription
Name"EA App"Display name for EA App publisher
Website"https://www.ea.com"Website URL for EA App
SupportUrl"https://help.ea.com"Support URL for EA App

The First Decade Publisher Information

ConstantValueDescription
Name"The First Decade"Display name for The First Decade publisher
Website"https://westwood.com"Website URL for The First Decade
SupportUrl""Support URL for The First Decade (empty)

Wine/Proton Publisher Information

ConstantValueDescription
Name"Wine/Proton"Display name for Wine/Proton publisher
Website""Website URL for Wine/Proton (empty)
SupportUrl""Support URL for Wine/Proton (empty)

CD-ROM Publisher Information

ConstantValueDescription
Name"CD-ROM"Display name for CD-ROM publisher
Website""Website URL for CD-ROM (empty)
SupportUrl""Support URL for CD-ROM (empty)

Retail Publisher Information

ConstantValueDescription
Name"Retail Installation"Display name for retail publisher
Website""Website URL for retail (empty)
SupportUrl""Support URL for retail (empty)

Generals Online Publisher Information

ConstantValueDescription
Name"Generals Online"Display name for Generals Online publisher
Website"https://www.playgenerals.online/"Website URL for Generals Online
SupportUrl"https://www.playgenerals.online/support"Support URL for Generals Online

Helper Methods

GetPublisherInfo(GameInstallationType): Returns a tuple containing (Name, Website, SupportUrl) for the specified installation type.

csharp
// Example usage
var (name, website, supportUrl) = PublisherInfoConstants.GetPublisherInfo(GameInstallationType.Steam);
// Result: ("Steam", "https://store.steampowered.com", "https://help.steampowered.com")

GameClientConstants Class

Constants related to game client detection and management.

Game Executables

ConstantValueDescription
GeneralsExecutable"generals.exe"Generals executable filename
ZeroHourExecutable"game.exe"Zero Hour executable filename
ContraExecutable"generals.ctr"Contra modded client executable filename

SuperHackers Client Detection

ConstantValueDescription
SuperHackersGeneralsExecutable"generalsV.exe"SuperHackers Generals executable filename
SuperHackersZeroHourExecutable"generalszh.exe"SuperHackers Zero Hour executable filename

Game Directory Names

ConstantValueDescription
GeneralsDirectoryName"Command and Conquer Generals"Standard Generals installation directory name
ZeroHourDirectoryName"Command and Conquer Generals Zero Hour"Standard Zero Hour installation directory name
ZeroHourDirectoryNameAmpersandHyphen"Command & Conquer Generals - Zero Hour"Zero Hour directory name with ampersand and hyphen (Steam standard)
ZeroHourDirectoryNameColonVariant"Command & Conquer: Generals - Zero Hour"Zero Hour directory name with colon variant
ZeroHourDirectoryNameAbbreviated"C&C Generals Zero Hour"Zero Hour directory name abbreviated form

Core Game Archives

ConstantValueDescription
ZeroHourIniBig"INIZH.big"Primary Zero Hour INI archive filename
ZeroHourPatchBig"PatchZH.big"Primary Zero Hour Patch archive filename
GeneralsIniBig"INI.big"Primary Generals Vanilla INI archive
GeneralsPatchBig"Patch.big"Primary Generals Vanilla Patch archive

GeneralsOnline Client Detection

ConstantValueDescription
GeneralsOnline30HzExecutable"generalsonlinezh_30.exe"GeneralsOnline 30Hz client executable name
GeneralsOnline60HzExecutable"generalsonlinezh_60.exe"GeneralsOnline 60Hz client executable name
GeneralsOnline30HzDisplayName"GeneralsOnline 30Hz"Display name for GeneralsOnline 30Hz variant
GeneralsOnline60HzDisplayName"GeneralsOnline 60Hz"Display name for GeneralsOnline 60Hz variant
GeneralsOnlineDefaultDisplayName"GeneralsOnline 30Hz"Default display name for GeneralsOnline variants

Dependency Names

ConstantValueDescription
ZeroHourInstallationDependencyName"Zero Hour Installation (Required)"Name for Zero Hour installation dependency requirement

Version Strings

ConstantValueDescription
AutoDetectedVersion"Automatically added"Version string used for automatically detected clients
UnknownVersion"Unknown"Version string used for unknown/unrecognized clients

Required DLLs

  • RequiredDlls: Array of DLLs required for standard game installations
    • "steam_api.dll" - Steam integration
    • "binkw32.dll" - Bink video codec
    • "mss32.dll" - Miles Sound System
    • "eauninstall.dll" - EA App integration

GeneralsOnline DLLs

  • GeneralsOnlineDlls: Array of DLLs specific to GeneralsOnline installations
    • Core runtime DLLs: "abseil_dll.dll", "GameNetworkingSockets.dll", "libcrypto-3.dll", "libcurl.dll", "libprotobuf.dll", "libssl-3.dll", "sentry.dll", "zlib1.dll"
    • Legacy game DLLs: "steam_api.dll", "binkw32.dll", "mss32.dll", "wsock32.dll"

Configuration Files

  • ConfigFiles: Array of configuration files used by game installations
    • "options.ini" - Legacy game options
    • "skirmish.ini" - Skirmish settings
    • "network.ini" - Network configuration

Executable Names List

  • GeneralsOnlineExecutableNames: Read-only list of executable names for GeneralsOnline clients that should be detected
    • GeneralsOnline30HzExecutable
    • GeneralsOnline60HzExecutable
    • GeneralsOnlineDefaultExecutable

GameClientName Enum

Enum for game client display names used in UI formatting and content display.

Enum Values

ValueDescription
GeneralsCommand & Conquer: Generals
ZeroHourCommand & Conquer: Generals Zero Hour

Extension Methods

The GameClientNameExtensions class provides display name methods:

GetShortName()

Returns abbreviated display names for compact UI display.

  • GameClientName.Generals.GetShortName()"Generals"
  • GameClientName.ZeroHour.GetShortName()"Zero Hour"

GetFullName()

Returns full game titles for detailed display.

  • GameClientName.Generals.GetFullName()"Command &amp; Conquer: Generals"
  • GameClientName.ZeroHour.GetFullName()"Command &amp; Conquer: Generals Zero Hour"

Usage in ContentDisplayFormatter

The enum is used in ContentDisplayFormatter.GetGameTypeDisplayName() to provide consistent game naming across the UI:

csharp
public string GetGameTypeDisplayName(GameType gameType, bool useShortName = false)
{
    if (useShortName)
    {
        return gameType switch
        {
            GameType.ZeroHour => GameClientName.ZeroHour.GetShortName(),
            GameType.Generals => GameClientName.Generals.GetShortName(),
            _ => gameType.ToString(),
        };
    }

    return gameType switch
    {
        GameType.Generals => GameClientName.Generals.GetFullName(),
        GameType.ZeroHour => GameClientName.ZeroHour.GetFullName(),
        _ => gameType.ToString(),
    };
}

This ensures type-safe game name handling and prevents typos in display strings.


Installation source type identifiers for game installations. These constants represent WHERE the game was installed from (Steam, EA App, Retail, etc.).

Content Publisher Discovery:

  • Content publishers register themselves with ContentOrchestrator via dependency injection
  • Each publisher implements IContentPublisher with a unique SourceName property
  • Publishers can be: Official platforms (EA/Steam), Community sources (GitHub, ModDB, HTTP), Custom sources (any implementation)
  • To add a new publisher: Create an IContentPublisher implementation and register it in DI (see ContentPipelineModule.cs)

Examples of IContentPublisher Implementations:

  • GitHubContentPublisher (SourceName: "GitHub")
  • ModDBContentPublisher (SourceName: "ModDB")
  • LocalFileSystemContentPublisher (SourceName: "Local Files")
  • CNCLabsContentPublisher (SourceName: "C&C Labs")

See Content Pipeline Architecture for details on dynamic publisher registration.

Installation Source Constants

These constants are used for GameInstallationType mapping only:

ConstantValueDescription
EaApp"eaapp"EA App (formerly Origin) platform installation
Steam"steam"Steam platform installation
Retail"retail"Retail/physical installation
TheFirstDecade"thefirstdecade"The First Decade compilation installation
Wine"wine"Wine/Proton compatibility layer installation
CdIso"cdiso"CD-ROM/ISO installation
Unknown"unknown"Unknown or unspecified installation source

Installation Source Mapping Methods

FromInstallationType(GameInstallationType): Maps GameInstallationType enum to installation source string by delegating to the centralized extension method:

csharp
public static string FromInstallationType(GameInstallationType installationType)
{
    return installationType.ToInstallationSourceString();
}

Note: This method now uses the centralized ToInstallationSourceString() extension method from InstallationExtensions.cs to eliminate code duplication and ensure consistent mapping behavior across the codebase.


IoConstants Class

  • DefaultFileBufferSize: 4096
  • StagingFileSuffix: ".genhub-staging"

ProcessConstants Class

Process and system constants.

Exit Codes

  • ExitCodeSuccess: 0

Windows API Constants

  • SW_RESTORE: 9
  • SW_SHOW: 5
  • SW_MINIMIZE: 6
  • SW_MAXIMIZE: 3
  • SW_MAXIMIZE: 3

WindowMessageConstants Class

Windows API message codes enabling UIPI bypass.

  • WM_DROPFILES: 0x0233 - Dropped files message
  • WM_COPYDATA: 0x004A - Copy data message
  • WM_COPYGLOBALDATA: 0x0049 - Copy global data message

StorageConstants Class

Storage and CAS (Content-Addressable Storage) related constants.

CAS Retry Constants

ConstantValueDescription
MaxRetries10Maximum retry attempts for CAS operations
RetryDelayMs100Delay between retry attempts (ms)
MaxRetryDelayMs5000Maximum delay for exponential backoff (ms)

CAS Directory Structure

ConstantValueDescription
ObjectsDirectory"objects"Directory for CAS objects
LocksDirectory"locks"Directory for CAS locks

CAS Maintenance

  • AutoGcIntervalDays: 1

TimeIntervals Class

  • UpdaterTimeout: 10 minutes
  • DownloadTimeout: 30 minutes
  • NotificationHideDelay: 3000ms

UiConstants Class

User interface sizing, theme color, and display name constants.

Window and Layout Sizing

  • DefaultWindowWidth: 1200
  • DefaultWindowHeight: 800
  • DefaultProfileSettingsWidth: 750
  • DefaultProfileSettingsHeight: 700

Status and Theme Colors

  • StatusSuccessColor: Color used to indicate success or positive status ("#4CAF50")
  • StatusErrorColor: Color used to indicate error or negative status ("#F44336")
  • GeneralsThemeColor: Default theme color for Generals content ("#BD5A0F")
  • ZeroHourThemeColor: Default theme color for Zero Hour content ("#1B6575")

ValidationLimits Class

  • MinConcurrentDownloads: 1
  • MaxConcurrentDownloads: 10
  • MinDownloadTimeoutSeconds: 30
  • MaxDownloadTimeoutSeconds: 3600
  • MinDownloadSaveTimeoutMs: 60000
  • MinDownloadBufferSizeBytes: 4096
  • MaxDownloadBufferSizeBytes: 1048576

GameClientHashRegistry Class

Extensible SHA-256 hash constants and registry for known game executables used for client detection across official and 3rd party distributions. Supports dynamic updates, external hash databases, and plugin extensibility.

Core Hash Constants

ConstantValueDescription
Generals108Hash"1c96366ff6a99f40863f6bbcfa8bf7622e8df1f80a474201e0e95e37c6416255"SHA-256 hash for Generals 1.08 executable (generals.exe)
ZeroHour104Hash"f37a4929f8d697104e99c2bcf46f8d833122c943afcd87fd077df641d344495b"SHA-256 hash for Zero Hour 1.04 executable (generals.exe)
ZeroHour105Hash"420fba1dbdc4c14e2418c2b0d3010b9fac6f314eafa1f3a101805b8d98883ea1"SHA-256 hash for Zero Hour 1.05 executable (generals.exe)

Extensibility Configuration Constants

ConstantValueDescription
ExternalHashDatabaseFileName"game-executable-hashes.json"Default filename for external hash database JSON file
MaxExternalHashSources50Maximum number of external hash sources that can be registered
ExternalSourceCacheTimeoutMinutes30Cache timeout for external hash sources in minutes

Collections and Properties

PropertyTypeDescription
PossibleExecutableNamesList<string>Executable file names that might contain game executables (extensible at runtime)

Basic Usage Example

csharp
using GenHub.Core.Constants;

// Basic hash detection (backward compatible)
if (computedHash == GameClientHashRegistry.Generals108Hash)
{
    // Detected Generals 1.08
}
else if (computedHash == GameClientHashRegistry.ZeroHour104Hash)
{
    // Detected Zero Hour 1.04
}

var info = GameClientHashRegistry.GetGameExecutableInfo(computedHash);
if (info.HasValue)
{
    Console.WriteLine($"Detected: {info.Value.GameType} {info.Value.Version} ({info.Value.Publisher})");
}

Extensibility Usage

csharp
using GenHub.Core.Constants;

// Add runtime hash for 3rd party client
GameClientHashRegistry.AddKnownHash(
    "abc123...",
    GameType.Generals,
    "1.09",
    "CommunityPatch",
    "Community-enhanced Generals executable",
    false);

// Add custom executable name
GameClientHashRegistry.AddPossibleExecutableName("my-modded-generals.exe");

PublisherTypeConstants Class

Well-known publisher type identifiers for content sources. Uses lowercase string identifiers for consistency with the ManifestId system.

Publisher Type Overview

Publisher types are string-based (not an enum) for extensibility. Any string value is valid; these constants are just common identifiers for convenience.

Official Platform Publishers

ConstantValueDescription
Steam"steam"Steam platform
EaApp"eaapp"EA App (formerly Origin) platform
Retail"retail"Retail/physical installation
TheFirstDecade"thefirstdecade"The First Decade compilation
Wine"wine"Wine/Proton compatibility layer
CdIso"cdiso"CD-ROM/ISO installation

Community Platforms

ConstantValueDescription
GeneralsOnline"generalsonline"Generals Online community launcher (auto-updates clients)
CommunityOutpost"communityoutpost"Community Outpost platform
ModDb"moddb"ModDB hosting platform
CncLabs"cnclabs"C&C Labs community site

Web/Download Sources

ConstantValueDescription
GitHub"github"GitHub repository
WebDownload"web"Generic web download

Local/System Sources

ConstantValueDescription
LocalImport"local"Local file import by user
FileSystem"filesystem"Imported from file system

Generated Content

ConstantValueDescription
AutoGenerated"autogenerated"Auto-generated by ContentOrchestrator
GenHubInternal"genhub"GenHub internal system content
CsvGenerated"csvgenerated"Content generated from CSV authoritative source

Special/Unknown

ConstantValueDescription
Unknown"unknown"Unknown or unspecified publisher type
Custom"custom"Custom user-defined publisher

Helper Methods

FromInstallationType(GameInstallationType)

Maps GameInstallationType enum to publisher type string:

csharp
public static string FromInstallationType(GameInstallationType installationType)
{
    return installationType switch
    {
        GameInstallationType.Steam => Steam,
        GameInstallationType.EaApp => EaApp,
        GameInstallationType.TheFirstDecade => TheFirstDecade,
        GameInstallationType.Wine => Wine,
        GameInstallationType.CDISO => CdIso,
        GameInstallationType.Retail => Retail,
        GameInstallationType.Unknown => Unknown,
        _ => Unknown
    };
}

Publisher Type Usage Examples

csharp
using GenHub.Core.Constants;

// Using platform-specific publisher types
var steamPublisher = PublisherTypeConstants.Steam; // "steam"
var eaAppPublisher = PublisherTypeConstants.EaApp; // "eaapp"

// Using community publisher types
var generalsOnlinePublisher = PublisherTypeConstants.GeneralsOnline; // "generalsonline"

// Mapping installation type to publisher
var installationType = GameInstallationType.Steam;
var publisherType = PublisherTypeConstants.FromInstallationType(installationType);
// Result: "steam"

// In manifest generation (GeneralsOnline example)
var manifest = new ContentManifest
{
    Publisher = new PublisherInfo
    {
        Name = PublisherTypeConstants.GeneralsOnline,
        Website = "https://www.playgenerals.online/",
    }
};

// Using publisher types for content filtering
if (manifest.Publisher?.Name == PublisherTypeConstants.GeneralsOnline)
{
    // Handle GeneralsOnline-specific content
}

// Custom publisher type (not a predefined constant)
var customPublisher = "my-custom-publisher";
// Custom publishers work just like predefined constants

GeneralsOnline Publisher Type

The GeneralsOnline publisher type is used for the GeneralsOnline community launcher, which provides auto-updated clients for Command & Conquer Generals and Zero Hour.

Usage in Game Client Detection:

  • When GeneralsOnline executables are detected (generalsonline_30hz.exe, generalsonline_60hz.exe, generalsonline.exe)
  • Manifests are generated with PublisherType = "generalsonline"
  • UI displays these clients with appropriate publisher attribution
  • Users can select GeneralsOnline variants in game profiles

Manifest ID Examples:

  • 1.0.generalsonline.gameclient.generalsonline_30hz (GeneralsOnline 30Hz client)
  • 1.0.generalsonline.gameclient.generalsonline_60hz (GeneralsOnline 60Hz client)

See also: Manifest ID System Documentation for complete ID format details

Configuration and Usage Examples

Application Configuration

csharp
using GenHub.Core.Constants;

// Build user agent string
var userAgent = AppConstants.DefaultUserAgent; // "GenHub/1.0"

// Get application info
var appName = AppConstants.ApplicationName;
var version = AppConstants.Version;

Directory Operations

csharp
using GenHub.Core.Constants;

// Build standard directory paths
var dataPath = Path.Combine(basePath, DirectoryNames.Data);
var cachePath = Path.Combine(basePath, DirectoryNames.Cache);
var tempPath = Path.Combine(basePath, DirectoryNames.Temp);
var casPoolPath = Path.Combine(
    Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
    AppConstants.ApplicationName,
    DirectoryNames.CasPool);

File Type Validation

csharp
using GenHub.Core.Constants;

// Check file types
if (fileName.EndsWith(FileTypes.ManifestFileExtension))
{
    // Handle manifest file
}
else if (fileName.EndsWith(FileTypes.JsonFileExtension))
{
    // Handle JSON file
}

Manifest ID Operations

csharp
using GenHub.Core.Constants;

// All manifest IDs now use 5-segment format: schemaVersion.userVersion.publisher.contentType.contentName

// Generate installation ID with version normalization (5 segments)
var installId = $"{ManifestConstants.DefaultManifestFormatVersion}.{ManifestConstants.GeneralsManifestVersion.Replace(".", "")}.steam.gameinstallation.generals";
// Result: "1.108.steam.gameinstallation.generals" (dots removed from "1.08" → "108")

// Generate client ID (5 segments)
var clientId = $"{ManifestConstants.DefaultManifestFormatVersion}.{ManifestConstants.ZeroHourManifestVersion.Replace(".", "")}.steam.gameclient.zerohour";
// Result: "1.104.steam.gameclient.zerohour" (dots removed from "1.04" → "104")

// Generate mod ID (5 segments)
var modId = $"{ManifestConstants.DefaultManifestFormatVersion}.1.{ManifestConstants.GenHubPublisher}.mod.rising-sun-mod";
// "1.1.genhub.mod.rising-sun-mod"

// Use manifest versions in manifest generation
var generalsVersion = ManifestConstants.GeneralsManifestVersion; // "1.08"
var zeroHourVersion = ManifestConstants.ZeroHourManifestVersion; // "1.04"

// Example: await manifestService.CreateGameInstallationManifestAsync(path, GameType.Generals, type, generalsVersion);
// The service will automatically normalize "1.08" → "108" and generate a 5-segment ID

// Validate manifest ID length
if (manifestId.Length < ManifestConstants.MinManifestIdLength ||
    manifestId.Length > ManifestConstants.MaxManifestIdLength)
{
    throw new ArgumentException("Manifest ID length is invalid");
}

// Use PublisherTypeConstants for publisher types
var publisherType = PublisherTypeConstants.Steam;
var unknownType = PublisherTypeConstants.Unknown;

// Map installation type to publisher type
var publisher = PublisherTypeConstants.FromInstallationType(GameInstallationType.Steam);
// Result: "steam"

HTTP Operations with ApiConstants

csharp
using var client = new HttpClient();
client.DefaultRequestHeaders.UserAgent.ParseAdd(ApiConstants.DefaultUserAgent);

GitHub URL Validation

csharp
public bool IsGitHubUrl(string url)
{
    if (!Uri.TryCreate(url, UriKind.Absolute, out var uri))
        return false;

    return uri.Host.Equals(ApiConstants.GitHubDomain, StringComparison.OrdinalIgnoreCase);
}

Download Configuration

csharp
var downloadConfig = new DownloadConfiguration
{
    BufferSize = DownloadDefaults.BufferSizeBytes,
    MaxConcurrentDownloads = DownloadDefaults.MaxConcurrentDownloads,
    Timeout = TimeSpan.FromSeconds(DownloadDefaults.TimeoutSeconds),
    MaxRetryAttempts = DownloadDefaults.MaxRetryAttempts
};

CAS Operations

csharp
var retryCount = 0;
while (retryCount < StorageConstants.MaxRetries)
{
    try
    {
        // Perform CAS operation
        break;
    }
    catch (Exception)
    {
        retryCount++;
        await Task.Delay(StorageConstants.RetryDelayMs * retryCount);
    }
}

UI Constants Example

csharp
var window = new Window
{
    Width = UiConstants.DefaultWindowWidth,
    Height = UiConstants.DefaultWindowHeight
};

// Using status colors for consistent UI theming
var successBrush = new SolidColorBrush(Color.Parse(UiConstants.StatusSuccessColor));
var errorBrush = new SolidColorBrush(Color.Parse(UiConstants.StatusErrorColor));

// Example XAML data binding with BoolToStatusColorConverter
// <TextBlock Text="Status" Foreground="{Binding IsActive, Converter={StaticResource BoolToStatusColorConverter}}" />

Application Name Usage with AppConstants

csharp
// Using AppConstants.AppName for consistent application naming
var appDataPath = Path.Combine(
    Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
    AppConstants.AppName);

var userAgent = $"{AppConstants.AppName}/{AppConstants.AppVersion}";
// Result: "GenHub/1.0" (same as ApiConstants.DefaultUserAgent)

Validation with ValidationLimits

csharp
public bool ValidateConcurrentDownloads(int value)
{
    return value >= ValidationLimits.MinConcurrentDownloads &&
           value <= ValidationLimits.MaxConcurrentDownloads;
}

Time Intervals Usage

csharp
var updaterTimeout = TimeIntervals.UpdaterTimeout;
var downloadTimeout = TimeIntervals.DownloadTimeout;
var notificationDelay = TimeIntervals.NotificationHideDelay;

ContentSourceNames Class

Constants for content pipeline component identifiers used in dependency injection lookups.

Discoverers

ConstantValueDescription
CNCLabsDiscoverer"CNC Labs Maps"Source name for CNC Labs map discoverer
GitHubDiscoverer"GitHub"Source name for GitHub content discoverer
GitHubReleasesDiscoverer"GitHub Releases"Source name for GitHub releases discoverer
FileSystemDiscoverer"Local File System"Source name for local file system discoverer
ModDBDiscoverer"ModDB"Source name for ModDB content discoverer

Resolvers

ConstantValueDescription
CNCLabsResolverId"CNCLabsMap"Resolver ID for CNC Labs map resolver
GitHubResolverId"GitHubRelease"Resolver ID for GitHub release resolver
LocalResolverId"LocalManifest"Resolver ID for local manifest resolver
ModDBResolverId"ModDB"Resolver ID for ModDB resolver

Deliverers

ConstantValueDescription
HttpDeliverer"HTTP Content Deliverer"Source name for HTTP content deliverer
FileSystemDeliverer"Local File System Deliverer"Source name for local file system deliverer

MaintenanceWhen adding new constants

  1. Choose the appropriate constants file based on functionality
  2. Follow naming conventions (PascalCase for constants)
  3. Add comprehensive XML documentation
  4. Update this documentation
  5. Add tests for new constants
  6. Ensure StyleCop compliance

Constants File Organization

  • ApiConstants: Network and API-related constants
  • AppConstants: Application-wide settings and metadata
  • CasDefaults: Content-Addressable Storage defaults
  • ConfigurationKeys: Configuration file keys and paths
  • ConversionConstants: Unit conversion constants
  • DirectoryNames: Standard directory naming conventions
  • DownloadDefaults: Download operation defaults
  • FileTypes: File extensions and naming patterns
  • IoConstants: Input/output operation constants
  • ManifestConstants: Manifest ID and validation constants
  • ProcessConstants: System process and exit code constants
  • PublisherInfoConstants: Publisher display names, websites, and support URLs
  • PublisherTypeConstants: Publisher type identifiers for content sources
  • StorageConstants: Storage and CAS operation constants
  • TimeIntervals: Time spans and intervals
  • UiConstants: User interface sizing and behavior
  • UserDataConstants: Tracked user data installation constants
  • ValidationLimits: Input validation boundaries

Best Practices

  1. Centralization: All constants should be defined in the appropriate constants file
  2. Documentation: Every constant should have XML documentation explaining its purpose
  3. Testing: Constants should be tested for correctness and reasonable values
  4. Consistency: Use constants instead of magic numbers or strings throughout the codebase
  5. Naming: Use descriptive names that clearly indicate the constant's purpose
  6. Grouping: Related constants should be grouped together within their respective files

GameSettingsConstants Class

Constants for game settings management, including texture quality, resolution, volume levels, and folder names.

TextureQuality Constants

ConstantValueDescription
MaxQuality2Maximum texture quality level
MinQuality0Minimum texture quality level
DefaultQuality1Default texture quality level

Resolution Constants

ConstantValueDescription
MinWidth640Minimum resolution width
MinHeight480Minimum resolution height
MaxWidth7680Maximum resolution width
MaxHeight4320Maximum resolution height

Volume Constants

ConstantValueDescription
MinVolume0.0fMinimum volume level
MaxVolume1.0fMaximum volume level
DefaultVolume0.5fDefault volume level

Audio Constants

ConstantValueDescription
MinAudioLevel0Minimum audio level
MaxAudioLevel100Maximum audio level
DefaultAudioLevel50Default audio level

FolderNames Constants

ConstantValueDescription
GameData"GameData"Folder name for game data
MyGames"My Games"Folder name for user's games
SavedGames"Saved Games"Folder name for saved games

ResolutionPresets Constants

Predefined resolution options available in the game settings.

  • "640x480"
  • "800x600"
  • "1024x768"
  • "1024x768"
  • "1280x720"
  • "1280x1024"
  • "1366x768"
  • "1600x900"
  • "1920x1080"
  • "2560x1440"
  • "3840x2160"

Content Publisher Constants

Constants for various community content publishers and manifest generation.

CommunityOutpostCatalogConstants Class

Constants related to the Community Outpost (GenPatcher) catalog and metadata.

  • CatalogFormat: Catalog format identifier ("genpatcher-dat")
  • UnknownVersion: Default version string when unknown ("unknown")
  • DefaultBaseUrl: Default base URL for making relative URLs absolute ("https://legi.cc/patch")
  • ContentCodeKey: Metadata key for content code ("contentCode")
  • CatalogVersionKey: Metadata key for catalog version ("catalogVersion")
  • FileSizeKey: Metadata key for file size ("fileSize")
  • CategoryKey: Metadata key for content category ("category")
  • InstallTargetKey: Metadata key for install target ("installTarget")
  • MirrorUrlsKey: Metadata key for mirror URLs ("mirrorUrls")
  • MirrorsKey: Metadata key for mirror names display string ("mirrors")
  • PatchPageUrlEndpoint: Endpoint key for patch page URL ("patchPageUrl")
  • DefaultMetadataVersion: Default version for content metadata ("1.0")

GeneralsOnlineConstants Class

Constants for Generals Online content discovery and manifest creation.

  • PublisherName: Display name for the publisher ("Generals Online Team")
  • PublisherType: Publisher type identifier ("generalsonline")
  • PublisherId: Publisher identifier ("generalsonline")
  • QfeMarkerPrefix: Prefix for QFE markers in version strings ("QFE")
  • Variant60HzSuffix: Manifest name suffix for 60Hz variant ("60hz")
  • QuickMatchMapPackSuffix: Manifest name suffix for QuickMatch MapPack ("quickmatch-maps")
  • GameDataPatchSuffix: Manifest name suffix for GeneralsOnlineGameData data patch ("gamedata")
  • QuickMatchMapPackDisplayName: Display name for QuickMatch MapPack ("GeneralsOnline QuickMatch Maps")
  • GameDataDisplayName: Display name for GeneralsOnlineGameData data patch ("GeneralsOnline Game Data")
  • GameDataDescription: Description for GeneralsOnlineGameData data patch ("Game data patch for GeneralsOnline containing community balance and core INI configuration.")
  • MapsSubdirectory: Subdirectory within the portable ZIP containing maps ("Maps")
  • GameDataSubdirectory: Subdirectory within the portable ZIP containing GeneralsOnline game data ("GeneralsOnlineGameData")
  • MapPackTags: Default tags for MapPack manifests (["mappack", "generalsonline", "quickmatch", "competitive"])
  • GameDataTags: Default tags for GameData patch manifests (["patch", "generalsonline"])
  • CoverSource: Path for cover images ("/Assets/Covers/usa-cover.png")
  • UnknownVersion: Default version string when unknown ("unknown")

CNCLabsConstants Class

Constants for CNC Labs (CNC Maps) content discovery and manifest creation.

  • PublisherPrefix: Publisher prefix string ("cnclabs")
  • PublisherId: Publisher identifier ("cnc-labs")
  • PublisherName: Display name for the publisher ("CNC Labs")
  • PublisherWebsite: Main website URL ("https://www.cnclabs.com")
  • DefaultTags: Default tags for CNC Labs manifests (["cnclabs"])
  • DefaultDownloadFilename: Default filename for downloads when parsing fails ("download.zip")

ModDBConstants Class

Constants for ModDB content discovery and manifest creation.

  • PublisherPrefix: Publisher prefix string ("moddb")
  • PublisherDisplayName: Display name for the publisher ("ModDB")
  • PublisherWebsite: Main website URL ("https://www.moddb.com")
  • ReleaseDateFormat: Date format used in ModDB metadata ("MMMM dd, yyyy")
  • PublisherNameFormat: Format string for including the author with the publisher name ("ModDB ({0})")
  • DefaultDownloadFilename: Default filename for downloads when parsing fails ("download.zip")

SuperHackersConstants Class

Constants for The Super Hackers content discovery and manifest creation.

  • PublisherPrefix: Publisher prefix string ("thesuperhackers")
  • PublisherDisplayName: Display name for the publisher ("The Super Hackers")
  • VersionDelimiter: Character used to separate components in version strings (':')

ToolConstants Class

Constants for tool plugin metadata and configuration.

MockUrls Subclass

ConstantValueDescription
MockReplayUploadUrl"https://example.com/share/1234"Mock upload URL for replays
MockMapUploadUrl"https://example.com/maps/123"Mock upload URL for maps

ReplayManager Subclass

Constants specific to the Replay Manager tool plugin.

ConstantValueDescription
Id"genhub.tools.replaymanager"Unique identifier for the Replay Manager tool
Name"Replay Manager"Display name for the Replay Manager tool
Version"1.0.0"Version of the Replay Manager tool
Author"GenHub Team"Author of the Replay Manager tool
Description"Manage, import, and share replay files for Command & Conquer: Generals and Zero Hour."Description of the Replay Manager tool
Tags["replays", "file-management", "sharing"]Tags associated with the Replay Manager tool
IconPath"Assets/Icons/replay.png"Icon path for the Replay Manager tool (placeholder)
IsBundledtrueWhether the tool is bundled with the application

Root Constants

ConstantValueDescription
WindowsMockPathSegment"\\Mock\\"Mock path separator indicator for demo environments on Windows
UnixMockPathSegment"/Mock/"Mock path separator indicator for demo environments on Unix
DeleteFailedTitle"Delete Failed"Notification title for delete failure
DefaultUploadBufferSize8192 (8 KB)Default upload buffer size in bytes
UploadStageCompressionThresholdPercent25Upload progress stage percentage threshold for compression stage
UploadStageCloudThresholdPercent88Upload progress stage percentage threshold for cloud upload stage
UploadStageCompletePercent100Upload progress stage percentage threshold for completion stage

Usage Example

csharp
using GenHub.Core.Constants;

// Create tool metadata using constants
var metadata = new ToolMetadata
{
    Id = ToolConstants.ReplayManager.Id,
    Name = ToolConstants.ReplayManager.Name,
    Version = ToolConstants.ReplayManager.Version,
    Author = ToolConstants.ReplayManager.Author,
    Description = ToolConstants.ReplayManager.Description,
    Tags = ToolConstants.ReplayManager.Tags,
    IconPath = ToolConstants.ReplayManager.IconPath,
    IsBundled = ToolConstants.ReplayManager.IsBundled,
};

PlatformConstants Class

Platform-specific executable names and arguments used for shell operations and file reveals.

ConstantValueDescription
WindowsExplorerExecutable"explorer.exe"Windows Explorer executable name
WindowsExplorerSelectArgument"/select,\"{0}\""Windows Explorer select argument format
MacOSOpenExecutable"open"macOS open command executable name (resolved via PATH)
LinuxXdgOpenExecutable"xdg-open"Linux xdg-open command executable name (resolved via PATH)
WindowsExplorerPathDynamic propertyResolves absolute path to Windows Explorer via Windows directory with fallback

ReplayManagerConstants Class

Constants specifically for the Replay Manager feature.

ConstantValueDescription
MaxReplaySizeBytes1048576 (1MB)Maximum size for a single replay file
MaxZipEntries100Maximum allowed entries in a replay ZIP archive
MaxAggregateUncompressedBytes52428800 (50MB)Maximum aggregate uncompressed bytes for replay ZIP archives
MaxCompressionRatio50.0Maximum compression ratio allowed for replay ZIP archives
MaxUploadBytesPerPeriod10485760 (10MB)Maximum upload bytes per period
TempImportFilePrefix"genhub_import_"Prefix for temporary import files
TempShareFilePrefix"genhub_share_"Prefix for temporary share files
DefaultImportedReplayFileName"imported_replay.rep"Default file name for imported replays
ZipFilePattern"*.zip"File pattern for replay ZIP archives
DefaultZipName"replays"Default name for exported replay ZIP files
DeleteFailedTitle"Delete Failed"Notification title for delete failure
UploadCategory"replays"Category identifier for replay uploads
WindowsMockPathSegment"\\Mock\\"Mock path separator indicator for demo environments on Windows
UnixMockPathSegment"/Mock/"Mock path separator indicator for demo environments on Unix

MapManagerConstants Class

Constants specifically for the Map Manager feature.

ConstantValueDescription
MaxMapSizeBytes10485760 (10MB)Maximum file size for individual maps
MaxWeeklyUploadBytes104857600 (100MB)Maximum weekly upload limit
ThumbnailMaxWidth128Maximum width for thumbnails
ThumbnailMaxHeight128Maximum height for thumbnails
DefaultThumbnailName"map.tga"Default thumbnail filename
MaxDirectoryDepth1Maximum directory nesting depth
GeneralsDataDirectoryName"Command and Conquer Generals Data"Directory name for Generals data
ZeroHourDataDirectoryName"Command and Conquer Generals Zero Hour Data"Directory name for Zero Hour data
MapsSubdirectoryName"Maps"Subdirectory name for maps
MapPacksSubdirectoryName"mappacks"Subdirectory name for MapPacks
MapFilePattern"*.map"File pattern for maps
ZipFilePattern"*.zip"File pattern for ZIPs
DefaultZipName"maps.zip"Default name for exported ZIPs
ToolId"map-manager"Unique identifier for Map Manager
ToolName"Map Manager"Display name for Map Manager
ToolDescription"Manage, import, and share custom maps. Create MapPacks for easy profile switching."Description of the tool

AODMapsConstants Class

Constants for AODMaps (Age of Defense Maps) provider.

Publisher & Source Information

ConstantValueDescription
PublisherType"aodmaps"Publisher type identifier
DiscovererSourceName"AODMaps"Source name for discoverer
DiscovererDescription"Age of Defense Maps"Display description
ResolverId"AODMaps"Resolver identifier

URLs & Page Patterns

ConstantValue
BaseUrl"https://aodmaps.com"
PlayerPagePattern"https://aodmaps.com/Players/{0}_players{1}.html"
AoaMapsUrl"https://aodmaps.com/AOA/aoamaps.html"
RaceMapsUrl"https://aodmaps.com/race/racemaps.html"
AirMapsUrl"https://aodmaps.com/air/airmaps.html"
ContraAodUrl"https://aodmaps.com/ContraAOD/ContraAOD.html"

CSS Selectors

ConstantSelector/Value
GallerySelector"#gallery ul.nospace.clear"
DetailsPageDescriptionSelector"#description"
NameSelector".resource-header h1"

CommunityOutpostConstants Class

Constants for the Community Outpost content provider.

ConstantValue
PublisherId"community-outpost"
PublisherType"communityoutpost"
PublisherName"Community Outpost"
LogoSource"avares://GenHub/Assets/Logos/communityoutpost-logo.png"
ProviderDescription"Official patches, tools, and addons from GenPatcher (Community Outpost)"

ModDBParserConstants Class

CSS selectors for the ModDBPageParser.

Page Type Detection

ConstantSelector
ArticlesBrowseSelector"#articlesbrowse"
DownloadsInfoSelector"#downloadsinfo"
TableSelector".table"

Global Context

ConstantSelector
HeaderBoxSelector".headerbox"
TitleSelector"h1, h2, .title"
DeveloperSelector"a[href*='/members/'], a[href*='/company/']"

UserDataConstants Class

Constants for tracked user data installations — content GenHub deploys into the user's game data folder under Documents.

ConstantValueDescription
UserModifiedSuffix".user-modified"Suffix appended to a deployed file that no longer matches its recorded hash when it is moved aside so the pristine backup can be restored over it

GeneralsHub Docs