Cross-Platform Scripts: - extract_z_asset.sh: Linux/Unix single file extraction - batch_extract_z_assets.sh: Linux/Unix batch extraction - pack_z_asset.sh: Linux/Unix asset packing - extract_z_asset.ps1: Windows PowerShell extraction Server Integration: - AssetExtractionService.cs: C# service for ZLIB extraction/packing - AssetManagementController.cs: API endpoints for asset management - POST /api/AssetManagement/extract - POST /api/AssetManagement/pack - POST /api/AssetManagement/batch-extract - GET /api/AssetManagement/list - Registered AssetExtractionService in Program.cs Features: - Extracts .z files (ZLIB compressed textures/data) - Packs files to .z format with ZLIB compression - Batch processing support - Cross-platform (Windows/Linux/macOS) - Server-side API for remote asset management - Path traversal protection Documentation: - ASSET_EXTRACTION_GUIDE.md: Complete integration guide - Tools/README.md: CLI tool documentation Based on: Tankonline/Real-Racing-3-Texture-Extraction-Tool Converted to cross-platform bash/PowerShell scripts + C# service Ready for .pak asset extraction when files arrive from community Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
79 lines
2.7 KiB
C#
79 lines
2.7 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
using RR3CommunityServer.Data;
|
|
using RR3CommunityServer.Services;
|
|
using RR3CommunityServer.Middleware;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
// Add services to the container
|
|
builder.Services.AddControllers();
|
|
builder.Services.AddRazorPages(); // Add Razor Pages support
|
|
builder.Services.AddEndpointsApiExplorer();
|
|
builder.Services.AddSwaggerGen();
|
|
|
|
// Database
|
|
builder.Services.AddDbContext<RR3DbContext>(options =>
|
|
options.UseSqlite("Data Source=rr3community.db"));
|
|
|
|
// Custom services
|
|
builder.Services.AddScoped<ISessionService, SessionService>();
|
|
builder.Services.AddScoped<IUserService, UserService>();
|
|
builder.Services.AddScoped<ICatalogService, CatalogService>();
|
|
builder.Services.AddScoped<IDrmService, DrmService>();
|
|
builder.Services.AddScoped<AssetExtractionService>();
|
|
|
|
// CORS for cross-origin requests
|
|
builder.Services.AddCors(options =>
|
|
{
|
|
options.AddDefaultPolicy(policy =>
|
|
{
|
|
policy.AllowAnyOrigin()
|
|
.AllowAnyMethod()
|
|
.AllowAnyHeader();
|
|
});
|
|
});
|
|
|
|
var app = builder.Build();
|
|
|
|
// Configure the HTTP request pipeline
|
|
if (app.Environment.IsDevelopment())
|
|
{
|
|
app.UseSwagger();
|
|
app.UseSwaggerUI();
|
|
}
|
|
|
|
// Initialize database
|
|
using (var scope = app.Services.CreateScope())
|
|
{
|
|
var db = scope.ServiceProvider.GetRequiredService<RR3DbContext>();
|
|
db.Database.EnsureCreated();
|
|
}
|
|
|
|
app.UseHttpsRedirection();
|
|
app.UseCors();
|
|
|
|
// Custom middleware
|
|
app.UseMiddleware<SynergyHeadersMiddleware>();
|
|
app.UseMiddleware<SessionValidationMiddleware>();
|
|
|
|
app.UseAuthorization();
|
|
app.MapControllers();
|
|
app.MapRazorPages(); // Add Razor Pages routing
|
|
|
|
// Redirect root to admin panel
|
|
app.MapGet("/", () => Results.Redirect("/admin"));
|
|
|
|
Console.WriteLine("╔══════════════════════════════════════════════════════════╗");
|
|
Console.WriteLine("║ Real Racing 3 Community Server - RUNNING ║");
|
|
Console.WriteLine("╠══════════════════════════════════════════════════════════╣");
|
|
Console.WriteLine("║ Server is ready to accept connections ║");
|
|
Console.WriteLine("║ Ensure DNS/hosts file points EA servers to this IP ║");
|
|
Console.WriteLine("╚══════════════════════════════════════════════════════════╝");
|
|
Console.WriteLine();
|
|
Console.WriteLine("Listening on: https://localhost:5001");
|
|
Console.WriteLine("Director endpoint: /director/api/android/getDirectionByPackage");
|
|
Console.WriteLine();
|
|
|
|
app.Run();
|
|
|