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
4,442 changes: 4,442 additions & 0 deletions CODE REVIEW COMMENTS.md

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions GenHub/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
<PackageVersion Include="Avalonia.Fonts.Inter" Version="11.2.7" />
<PackageVersion Include="Avalonia.Controls.DataGrid" Version="11.2.7" />
<PackageVersion Include="Avalonia.Diagnostics" Version="11.2.7" />

<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.2.1" />
<PackageVersion Include="Google.Apis.Auth" Version="1.73.0" />
<PackageVersion Include="Google.Apis.Drive.v3" Version="1.73.0.3996" />
<PackageVersion Include="Material.Icons.Avalonia" Version="2.4.1" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="9.0.7" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.4" />
Expand Down Expand Up @@ -43,4 +44,4 @@
<PackageVersion Include="FluentAssertions" Version="6.12.1" />
<PackageVersion Include="SharpCompress" Version="0.42.0" />
</ItemGroup>
</Project>
</Project>
33 changes: 33 additions & 0 deletions GenHub/GenHub.Core/Constants/ActionSetConstants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
namespace GenHub.Core.Constants;

/// <summary>
/// Constants for Action Sets and Fixes.
/// </summary>
public static class ActionSetConstants
{
/// <summary>
/// The directory name for sub-markers.
/// </summary>
public const string SubMarkersDirectory = "sub_markers";

/// <summary>
/// The minimum file size for VCRedist 2008 installer (bytes).
/// </summary>
public const long MinimumVCRedist2008FileSize = 1000 * 1024;

/// <summary>
/// File names used in action sets.
/// </summary>
public static class FileNames
{
/// <summary>
/// The filename for Generals.exe.
/// </summary>
public const string GeneralsExe = "generals.exe";

/// <summary>
/// The filename for GeneralsZh.exe.
/// </summary>
public const string GeneralsZhExe = "generalszh.exe";
}
}
12 changes: 12 additions & 0 deletions GenHub/GenHub.Core/Constants/ConfigurationKeys.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,16 @@ public static class ConfigurationKeys
/// Configuration key for application data path.
/// </summary>
public const string AppDataPath = "GenHub:AppDataPath";

// Hosting configuration keys

/// <summary>
/// Configuration key for Google Drive Client ID.
/// </summary>
public const string GoogleDriveClientId = "GenHub:Hosting:GoogleDrive:ClientId";

/// <summary>
/// Configuration key for Google Drive Client Secret.
/// </summary>
public const string GoogleDriveClientSecret = "GenHub:Hosting:GoogleDrive:ClientSecret";
}
18 changes: 18 additions & 0 deletions GenHub/GenHub.Core/Constants/ExternalUrls.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace GenHub.Core.Constants;

/// <summary>
/// Constants for external URLs.
/// </summary>
public static class ExternalUrls
{
/// <summary>
/// Download URL for Intel Graphics Drivers.
/// </summary>
public const string IntelDriverDownload = "https://www.intel.com/content/www/us/en/download-center/home.html";

/// <summary>
/// Download URL for DirectX 8.1 / 9.0c runtime files used by GenPatcher.
/// Uses the stable Microsoft Download Center landing page.
/// </summary>
public const string DirectXRuntimeDownload = "https://www.microsoft.com/en-us/download/details.aspx?id=8109";
}
154 changes: 154 additions & 0 deletions GenHub/GenHub.Core/Constants/PublisherDocumentation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
namespace GenHub.Core.Constants;

/// <summary>
/// Documentation strings for the Publisher Studio UI.
/// These provide clear explanations of the 3-tier URL architecture
/// and hosting workflow to publishers.
/// </summary>
#pragma warning disable SA1600 // Elements should be documented
#pragma warning disable SA1124 // Do not use regions
public static class PublisherDocumentation
{
#region Hosting Setup

/// <summary>Title for hosting setup section.</summary>
public const string HostingSetupTitle = "Hosting Setup";
Comment on lines +14 to +15

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Inconsistent XML documentation on members.

HostingSetupTitle and HostingSetupDescription have XML doc summaries, but HostingSetupHelp and all other constants do not. Since SA1600 is suppressed, consider either removing the existing summaries for consistency or adding summaries to all constants.

Also applies to: 25-25

🤖 Prompt for AI Agents
In `@GenHub/GenHub.Core/Constants/PublisherDocumentation.cs` around lines 14 - 15,
The XML documentation is inconsistent: only HostingSetupTitle and
HostingSetupDescription have <summary> comments while HostingSetupHelp and other
constants lack them; choose one approach and apply it consistently across the
PublisherDocumentation constants — either remove the existing <summary> blocks
for HostingSetupTitle and HostingSetupDescription, or add matching <summary>
documentation for HostingSetupHelp and every other public const string in the
PublisherDocumentation class so all members have consistent XML docs (refer to
identifiers HostingSetupTitle, HostingSetupDescription, HostingSetupHelp and
other constant names to locate the fields).


/// <summary>Description for hosting setup section.</summary>
public const string HostingSetupDescription =
"GenHub uses Google Drive to host your catalog and artifact files. " +
"When you connect your Google account, GenHub creates a folder called " +
"'GenHub_Publisher' in your Drive. All your published files go there.\n\n" +
"Your URLs remain stable across updates - when you publish changes, " +
"GenHub updates the existing files rather than creating new ones.";

/// <summary>Help text for hosting setup section.</summary>
public const string HostingSetupHelp =
"Click 'Connect Google Drive' to authorize GenHub to create and manage files " +
"in your Drive. GenHub only has access to files it creates - not your personal files.";

#endregion

#region Publish

/// <summary>Title for publish section.</summary>
public const string PublishTitle = "Publish";

/// <summary>Description for publish section.</summary>
public const string PublishDescription =
"When you click Publish:\n" +
"• New artifacts (ZIPs) are uploaded - each version gets a unique URL\n" +
"• Catalogs are updated in-place - the URL never changes\n" +
"• Your definition is updated in-place - the URL never changes\n" +
"• Subscribers automatically see your changes when they refresh\n\n" +
"This means your subscription link is permanent. Share it once, " +
"and it works forever.";

/// <summary>Help text for first-time publishing.</summary>
public const string PublishFirstTimeHelp =
"First time publishing? GenHub will:\n" +
"1. Create your GenHub_Publisher folder on Drive\n" +
"2. Upload your publisher.json (definition)\n" +
"3. Upload your catalog files\n" +
"4. Upload any artifact files with local paths\n" +
"5. Generate your permanent subscription link";

/// <summary>Help text for publishing updates.</summary>
public const string PublishUpdateHelp =
"Publishing an update? GenHub will:\n" +
"1. Upload any new artifacts (new versions)\n" +
"2. Update your existing catalog files (same URLs)\n" +
"3. Update your definition if needed (same URL)\n\n" +
"Subscribers will see your changes automatically.";

#endregion

#region Share

/// <summary>Title for share section.</summary>
public const string ShareTitle = "Share";

/// <summary>Description for share section.</summary>
public const string ShareDescription =
"This subscription link is your permanent entry point. Share it on:\n" +
"• Your website or mod page\n" +
"• Discord servers\n" +
"• Forums and communities\n\n" +
"When users click this link (or paste it into GenHub), they'll " +
"subscribe to all your catalogs and receive updates automatically.";

/// <summary>Help text for the subscription link.</summary>
public const string SubscriptionLinkHelp =
"The subscription link format: genhub://subscribe?url=<your-definition-url>\n\n" +
"This URL points to your publisher.json file on Google Drive. " +
"Since GenHub updates the file in-place, the URL never changes.";

#endregion

#region Multi-Catalog

/// <summary>Title for multiple catalogs section.</summary>
public const string MultiCatalogTitle = "Multiple Catalogs";

/// <summary>Description for multiple catalogs section.</summary>
public const string MultiCatalogDescription =
"You can organize your content into multiple catalogs. For example:\n" +
"• 'ZH Mods' - your Zero Hour modifications\n" +
"• 'Maps' - standalone map packs\n" +
"• 'Generals Content' - content for the base game\n\n" +
"Each catalog has its own URL but they're all linked through your " +
"publisher definition. Subscribers can choose which catalogs to follow.";

/// <summary>Help text for multiple catalogs.</summary>
public const string MultiCatalogHelp =
"To add a new catalog:\n" +
"1. Click '+ Add Catalog' in the toolbar\n" +
"2. Give it an ID (lowercase, no spaces) and name\n" +
"3. Add content items to the catalog\n" +
"4. Publish - the new catalog will be uploaded automatically";

#endregion

#region Recovery

/// <summary>Title for recovery section.</summary>
public const string RecoveryTitle = "Recovery";

/// <summary>Description for recovery section.</summary>
public const string RecoveryDescription =
"If you lose your local project files, GenHub can recover your " +
"hosting state from Google Drive. It looks for your 'GenHub_Publisher' " +
"folder and rebuilds the file mappings.\n\n" +
"This means you can publish from a new computer without losing your " +
"subscription links.";

/// <summary>Help text for recovery.</summary>
public const string RecoveryHelp =
"Recovery works by scanning your GenHub_Publisher folder for:\n" +
"• publisher.json (your definition)\n" +
"• catalog-*.json files (your catalogs)\n" +
"• Artifact files\n\n" +
"GenHub matches these to your project and restores the file IDs.";

#endregion

#region Three-Tier Architecture

/// <summary>Overview of the 3-tier architecture.</summary>
public const string ArchitectureOverview =
"GenHub uses a 3-tier URL architecture:\n\n" +
"Tier 1: Publisher Definition (publisher.json)\n" +
"• Your identity and catalog locations\n" +
"• This is what users subscribe to\n" +
"• URL never changes\n\n" +
"Tier 2: Catalogs (catalog-*.json)\n" +
"• Your content items and releases\n" +
"• Updated in-place when you add releases\n" +
"• URL never changes\n\n" +
"Tier 3: Artifacts (*.zip)\n" +
"• The actual downloadable files\n" +
"• Each version gets a new file (immutable)\n" +
"• Old versions remain accessible";

#endregion
}
27 changes: 27 additions & 0 deletions GenHub/GenHub.Core/Constants/RegistryConstants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
namespace GenHub.Core.Constants;

/// <summary>
/// Constants for Registry keys and values.
/// </summary>
public static class RegistryConstants
{
/// <summary>
/// The Command &amp; Conquer: The First Decade version value.
/// </summary>
public const string TfdVersionValue = "1.03";

/// <summary>
/// The registry key for Windows Media Feature Pack components.
/// </summary>
public const string WindowsMediaFeaturePackKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages";

/// <summary>
/// The registry key for Intel Graphics Driver (Class GUID).
/// </summary>
public const string IntelGfxDriverKey = @"SYSTEM\CurrentControlSet\Control\Class\{4D36E968-E325-11CE-BFC1-08002BE10318}\0000";

Comment on lines +19 to +22

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Avoid hardcoding the Intel class subkey instance (0000).
The 0000 instance is not stable across machines/drivers, so this path can fail. Prefer storing the class GUID root and enumerate subkeys (0000, 0001, …) at runtime.

🔧 Suggested adjustment
-    /// The registry key for Intel Graphics Driver (Class GUID).
-    public const string IntelGfxDriverKey = @"SYSTEM\CurrentControlSet\Control\Class\{4D36E968-E325-11CE-BFC1-08002BE10318}\0000";
+    /// The registry class GUID key for Intel Graphics Driver. Enumerate instance subkeys (e.g., 0000, 0001).
+    public const string IntelGfxDriverClassKey = @"SYSTEM\CurrentControlSet\Control\Class\{4D36E968-E325-11CE-BFC1-08002BE10318}";
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/// The registry key for Intel Graphics Driver (Class GUID).
/// </summary>
public const string IntelGfxDriverKey = @"SYSTEM\CurrentControlSet\Control\Class\{4D36E968-E325-11CE-BFC1-08002BE10318}\0000";
/// The registry class GUID key for Intel Graphics Driver. Enumerate instance subkeys (e.g., 0000, 0001).
public const string IntelGfxDriverClassKey = @"SYSTEM\CurrentControlSet\Control\Class\{4D36E968-E325-11CE-BFC1-08002BE10318}";
🤖 Prompt for AI Agents
In `@GenHub/GenHub.Core/Constants/RegistryConstants.cs` around lines 19 - 22, The
constant IntelGfxDriverKey currently hardcodes the class subkey instance "0000",
which is not stable; replace that constant with a root class GUID path (e.g.,
@"SYSTEM\CurrentControlSet\Control\Class\{4D36E968-E325-11CE-BFC1-08002BE10318}")
and update any code that uses IntelGfxDriverKey (search for usages of
IntelGfxDriverKey) to enumerate child subkeys (0000, 0001, …) at runtime and
probe each instance for the expected values instead of assuming "0000".

/// <summary>
/// The registry key for Intel MEWiz.
/// </summary>
public const string IntelMEWizKey = @"SOFTWARE\Intel\MEWiz1.0";
}
2 changes: 2 additions & 0 deletions GenHub/GenHub.Core/GenHub.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
<PackageReference Include="AngleSharp" />
<PackageReference Include="Microsoft.Playwright" />
<PackageReference Include="Microsoft.Extensions.Logging" />
<PackageReference Include="Microsoft.Extensions.Http" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" />
<PackageReference Include="CsvHelper" />
<PackageReference Include="CommunityToolkit.Mvvm" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading