Skip to content

Integrate with GameInstallationValidator #145

@undead2146

Description

@undead2146

Description

Integrate the CSV pipeline with GameInstallationValidator to enable validation of multi-language game installations against unified CSV manifests.

Requirements

  • Modify GameInstallationValidator to use CSVContentProvider with language support
  • Create ContentSearchQuery for CSV validation including language detection
  • Implement automatic language detection from game installations via LanguageDetector
  • Normalize detected/requested language to uppercase; accept any case input
  • Handle validation results from multi-language CSV pipeline
  • Support both Generals and Zero Hour validation across all languages
  • Handle pipeline errors gracefully with language-specific error messages

Acceptance Criteria

  • GameInstallationValidator calls CSVContentProvider.DiscoverAsync() with language detection
  • ContentSearchQuery created with correct game type and detected language (normalized uppercase)
  • Language auto-detection works for EN, DE, FR, ES, IT, KO, PL, PT-BR, ZH-CN, ZH-TW
  • CSVResolver.ResolveAsync() called to get language-specific ContentManifest
  • Validation results processed correctly for multi-language installations
  • Pipeline failures handled with appropriate language-aware error messages
  • ValidationResult includes detailed counts: missing files, corrupted files, extra files, total files validated
  • Supports fallback to "All" language entries for shared files

Technical Details

  • Integration Point: GameInstallationValidator.ValidateInstallationAsync()
  • Components: CSVContentProvider, GameInstallationValidator, LanguageDetector
  • Data Flow: Installation path → Language Detection → ContentSearchQuery → Multi-Language CSV Pipeline → ValidationResult

Language Detection Integration

Automatic Language Detection

  1. File Pattern Analysis: Scan installation for language-specific directories and files
  2. Registry Detection: Check Windows registry for language settings
  3. Configuration Files: Parse game configuration files for language settings
  4. Fallback Strategy: Default to "EN" if detection fails

Supported Language Patterns

  • English: Data\english\, English.big, registry key detection
  • German: Data\german\, Data\deutsch\, German file patterns
  • Other Languages: Similar pattern-based detection for all supported languages

Implementation Steps

  1. Modify GameInstallationValidator to inject IContentProvider
  2. Create ContentSearchQuery with game type and language from installation
  3. Call provider.DiscoverAsync() to get search results
  4. Call provider.ResolveAsync() to get ContentManifest
  5. Use IContentValidator to validate installation against manifest
  6. Return ValidationResult with detailed file status

Implementation Strategy

Pipeline Integration Flow

  1. Game Installation Detection

    • GameInstallationDetectionOrchestrator detects installed games
    • Determines game type (Generals/Zero Hour) and installed languages
    • Creates ContentSearchQuery with appropriate parameters
  2. CSV Content Provider Execution

    • CSVContentProvider orchestrates the pipeline
    • CSVDiscoverer finds CSV sources based on game type
    • CSVResolver downloads and parses CSV, filters by game and language
    • HttpContentDeliverer handles CSV file acquisition
  3. Manifest Generation

    • CSVResolver creates ContentManifest from filtered CSV entries
    • Manifest includes file paths, hashes, sizes, and metadata
    • Manifest is cached for performance
  4. Validation Integration

    • GameInstallationValidator receives ContentManifest
    • Uses IContentValidator to validate against manifest
    • Produces ValidationResult with detailed file-by-file results including:
      • Count of missing files
      • Count of corrupted files (hash mismatch)
      • Count of extra files (not in manifest)
      • Total files validated
      • Detailed list of issues with file paths

Validator Integration Points

public class GameInstallationValidator
{
    private readonly IContentProvider _csvContentProvider;
    private readonly IContentValidator _contentValidator;

    public async Task<ValidationResult> ValidateInstallationAsync(
        string installationPath,
        GameType gameType,
        string language = null)
    {
        // Create search query for CSV content
        var searchQuery = new ContentSearchQuery
        {
            TargetGame = gameType,
            Language = language,
            SearchPath = installationPath
        };

        // Use CSV provider to get manifest
        var searchResults = await _csvContentProvider.DiscoverAsync(searchQuery);
        var manifest = await _csvContentProvider.ResolveAsync(searchResults.First());

        // Validate using content validator
        return await _contentValidator.ValidateAsync(installationPath, manifest);
    }
}

Error Handling

  • Network Failures: Graceful fallback when CSV download fails
  • Invalid CSV: Validation of CSV format and data integrity
  • Missing Files: Proper reporting of missing required files
  • Corrupted Files: Hash verification with detailed error messages
  • Performance: Caching and async processing for large datasets

Testing Strategy

Unit Tests

  • Mock CSV provider components
  • Test validator integration points
  • Verify error handling scenarios

Integration Tests

  • End-to-end pipeline testing
  • Real CSV download and parsing
  • Validation result verification

Performance Tests

  • Large CSV processing (80k+ lines)
  • Concurrent validation operations
  • Memory usage monitoring

Related Files

  • Validator: GenHub/Features/GameInstallations/GameInstallationValidator.cs
  • Pipeline: CSVContentProvider, CSVDiscoverer, CSVResolver
  • Tests: Integration tests for pipeline-validator interaction
  • Models: ContentManifest, CsvCatalogEntry

Pipeline Flow Integration

This component provides the final integration of the CSV pipeline:

GameInstallationValidator → CSVContentProvider → Pipeline → ContentManifest → ValidationResult
                              ↑                              ↓
                    (Receives query)              (Returns validation results)

Responsibilities in Pipeline

  1. Pipeline Orchestration: Coordinate the complete CSV pipeline execution
  2. Query Processing: Convert game installation requests to ContentSearchQuery
  3. Result Processing: Handle ContentManifest from pipeline and perform validation
  4. Error Aggregation: Collect and report errors from all pipeline stages

Integration Flow

  • Input: Game installation path, game type, and language
  • Query Creation: Build ContentSearchQuery for CSV pipeline
  • Pipeline Execution: Call CSVContentProvider.DiscoverAsync() and ResolveAsync()
  • Validation: Use ContentManifest to validate actual game files
  • Output: ValidationResult with detailed pass/fail information

Previous Step

  • GameInstallationDetectionOrchestrator detects installed games
  • Passes installation details to GameInstallationValidator

Next Steps

  • ValidationResult returned to calling component
  • Results used to determine game installation status
  • User interface displays validation results and any issues

Metadata

Metadata

Assignees

Labels

Content-PipelineComponents of the content-pipeline systemEnhancementNew feature or request

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions