Add Game Asset Preservation System Foundation

DATABASE SCHEMA:
+ GameAsset entity added to RR3DbContext
  - Asset identification (ID, type, filename)
  - EA CDN tracking (original URL, CDN path)
  - Local storage (path, size, SHA256)
  - Metadata (downloads, access count, timestamps)
  - Game-specific (carId, trackId, category)

FEATURES:
- Track all cached assets in database
- Store EA CDN URLs while available
- SHA256 integrity checking
- Access statistics
- Category organization
- Version tracking

PURPOSE:
Foundation for full asset caching system.
Next step: AssetsController with EA CDN proxying.

STORAGE STRUCTURE:
wwwroot/assets/
├── cars/
├── tracks/
├── textures/
├── audio/
├── models/
└── misc/

PRESERVATION STRATEGY:
Phase 1 (EA online): Proxy + cache assets
Phase 2 (EA offline): Serve from cache
Result: Complete game preservation! 🎮💾

Package added: Microsoft.Extensions.Http (for CDN proxying)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-17 22:50:04 -08:00
parent 3970ecd9a3
commit bfd37dc7c2
39 changed files with 741 additions and 392 deletions

View File

@@ -18,6 +18,7 @@ public class RR3DbContext : DbContext
public DbSet<OwnedCar> OwnedCars { get; set; }
public DbSet<CarUpgrade> CarUpgrades { get; set; }
public DbSet<CareerProgress> CareerProgress { get; set; }
public DbSet<GameAsset> GameAssets { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
@@ -351,3 +352,35 @@ public class CareerProgress
public double BestTime { get; set; }
public DateTime? CompletedAt { get; set; }
}
public class GameAsset
{
public int Id { get; set; }
// Asset identification
public string AssetId { get; set; } = string.Empty;
public string AssetType { get; set; } = string.Empty; // car, track, texture, audio, etc.
public string FileName { get; set; } = string.Empty;
public string ContentType { get; set; } = "application/octet-stream";
// EA CDN info
public string? OriginalUrl { get; set; }
public string? EaCdnPath { get; set; }
// Local storage
public string LocalPath { get; set; } = string.Empty;
public long FileSize { get; set; }
public string FileSha256 { get; set; } = string.Empty;
public string? Version { get; set; }
// Metadata
public DateTime DownloadedAt { get; set; } = DateTime.UtcNow;
public DateTime LastAccessedAt { get; set; } = DateTime.UtcNow;
public int AccessCount { get; set; } = 0;
public bool IsAvailable { get; set; } = true;
// Game-specific (optional)
public string? CarId { get; set; }
public string? TrackId { get; set; }
public string Category { get; set; } = "misc"; // models, textures, audio, etc.
}