RCAAS.Core
1.1.0.144
dotnet add package RCAAS.Core --version 1.1.0.144
NuGet\Install-Package RCAAS.Core -Version 1.1.0.144
<PackageReference Include="RCAAS.Core" Version="1.1.0.144" />
<PackageVersion Include="RCAAS.Core" Version="1.1.0.144" />
<PackageReference Include="RCAAS.Core" />
paket add RCAAS.Core --version 1.1.0.144
#r "nuget: RCAAS.Core, 1.1.0.144"
#:package RCAAS.Core@1.1.0.144
#addin nuget:?package=RCAAS.Core&version=1.1.0.144
#tool nuget:?package=RCAAS.Core&version=1.1.0.144
RCAAS.Core
Remote Command-line Application Administration Service - Core Library
RCAAS.Core is a comprehensive .NET 9 library that provides the essential infrastructure for managing, monitoring, and orchestrating command-line applications as background services. It offers a plugin-based architecture for wrapping various applications (game servers, utilities, etc.) with unified lifecycle management, configuration, logging, and scheduling capabilities.
Features
Application Wrapper System
- Plugin Architecture: Extensible wrapper system for integrating any command-line application
- Lifecycle Management: Start, stop, restart, and monitor applications with process tracking
- Dynamic Loading: Discover and load wrapper plugins at runtime from external assemblies
- Steam Integration: Built-in support for Steam-based game servers (SteamCMD integration)
Configuration & Persistence
- Multi-Database Support: Entity Framework Core integration with SQL Server, MySQL, and PostgreSQL
- Backup Management: Automated backup creation and cleanup with configurable retention policies
Scheduled Jobs
- Cron-like Scheduling: Schedule tasks with minute and hour precision
- Job Actions: Backup, cleanup, app lifecycle control, and custom commands
- Flexible Configuration: Per-application job configuration with serialized arguments
Security & Authentication
- Password Hashing: Modern Argon2id-based password hashing with secure defaults
- Token Generation: Cryptographically secure token generation for API authentication
- Password Encryption: AES-256 encryption for legacy password storage migration
Installation
Install via NuGet Package Manager:
Install-Package RCAAS.Core
Using .NET CLI:
dotnet add package RCAAS.Core
Package Manager Console:
PM> Install-Package RCAAS.Core
Target Framework: .NET 9.0
Quick Start
1. Initialize Core Services
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using RCAAS.Core.Helpers;
using RCAAS.Core.Interfaces;
var builder = Host.CreateApplicationBuilder(args);
// Register RCAAS core services
builder.Services.AddSingleton<IAppCoreService, AppCoreService>();
builder.Services.AddSingleton<WrapperManager>();
// Configure logging with NLog
builder.Logging.ClearProviders();
builder.Logging.AddNLog();
var host = builder.Build();
await host.RunAsync();
2. Load and Manage Wrappers
using RCAAS.Wrappers;
// Get the wrapper manager
var wrapperManager = serviceProvider.GetRequiredService<WrapperManager>();
// Load available wrapper plugins
await wrapperManager.LoadAvailableWrappersAsync(cancellationToken);
// Display loaded wrappers
foreach (var (name, info) in wrapperManager.Wrappers)
{
Console.WriteLine($"Loaded: {name} v{info.Version} by {info.Author}");
}
3. Create and Start an Application
using RCAAS.Data;
// Define application configuration
var appConfig = new CmdAppItem
{
Name = "My Game Server",
WrapperName = "SteamWrapper",
CmdArgs = @"{""AppId"":730,""InstallDir"":""./servers/csgo""}",
Enabled = true
};
// Add and start the application
await wrapperManager.AddAppItemAsync(appConfig, cancellationToken);
4. Schedule Automated Backups
using RCAAS.Core.Data;
using Newtonsoft.Json;
// Create a backup job
var backupJob = new RCAASJobItem
{
Name = "Daily Backup",
Action = JobAction.Backup,
CmdAppId = appConfig.Id,
Hour = 3, // 3 AM
Minute = 0,
Enabled = true
};
await DBHelper.AddJobAsync(backupJob, cancellationToken);
5. Work with Plugin Metadata
using System.Diagnostics;
using RCAAS.Wrappers;
// Extract plugin information from a DLL
var dllPath = "path/to/wrapper.dll";
var fileVersionInfo = FileVersionInfo.GetVersionInfo(dllPath);
var pluginInfo = RCAASPluginInfo.Create(dllPath, fileVersionInfo);
Console.WriteLine($"Plugin: {pluginInfo.Name}");
Console.WriteLine($"Version: {pluginInfo.Version}");
Console.WriteLine($"Description: {pluginInfo.Description}");
Console.WriteLine($"Author: {pluginInfo.Author}");
Architecture Overview
Core Components
Wrappers (RCAAS.Wrappers)
WrapperManager: Central management for wrapper discovery, loading, and lifecycleRCAASPluginInfo: Plugin metadata extraction and managementBaseWrapper: Abstract base class for implementing custom wrappersBaseArgs: Serializable argument models for wrapper configuration
Helpers (RCAAS.Core.Helpers)
AppCoreService: Application-wide service coordination and state managementDBHelper: Database operations and Entity Framework context managementWebHelper: HTTP operations with modern async/await patternsBackupHelper: ZIP-based backup creation and managementJavaHelper: Java runtime detection and version managementPasswordHasher: Argon2id password hashing with secure defaultsTokenGenerator: Cryptographically secure token generation
Data Models (RCAAS.Core.Data)
CmdAppItem: Application configuration and metadataProcessLogItem: Process execution trackingRCAASJobItem: Scheduled job definitionsJobConfig*: Specialized job configuration models
Interfaces (RCAAS.Core.Interfaces)
IAppCoreService: Core service contractIRCAASContext: Application context and stateIAppWrapper: Wrapper implementation contractIPluginHelper: Plugin helper contract
Extensibility
Create custom wrappers by implementing BaseWrapper:
public class MyCustomWrapper : BaseWrapper
{
public override string Name => "MyCustomWrapper";
public override Task<bool> StartAsync()
{
// Custom start logic
return Task.FromResult(true);
}
public override Task<bool> StopAsync(int timeout = 30000)
{
// Custom stop logic
return Task.FromResult(true);
}
// Implement other abstract members...
}
Key Namespaces
| Namespace | Purpose |
|---|---|
RCAAS.Core.Wrappers |
Application wrappers, plugin management, and base classes |
RCAAS.Core.Helpers |
Utility classes for common operations |
RCAAS.Core.Data |
Data models and Entity Framework entities |
RCAAS.Core.Interfaces |
Contracts and abstractions |
RCAAS.Core.Util |
Utility classes (INI files, numeric helpers, context) |
RCAAS.Core.Constants |
Application-wide constants |
Configuration
Database Configuration
RCAAS.Core supports multiple database providers:
{
"DatabaseProvider": "MSSQL",
"ConnectionStrings": {
"DefaultConnection": "Server=localhost;Database=RCAAS;Trusted_Connection=True;"
}
}
Supported providers:
- MSSQL: SQL Server (via
RCAAS.Data.MSSQL) - MySQL: MySQL/MariaDB (via
RCAAS.Data.MySQL) - PostgreSQL: PostgreSQL (via
RCAAS.Data.PostgreSQL)
NLog Configuration
Configure structured logging with database targets:
<nlog>
<targets>
<target name="database" xsi:type="Database"
connectionString="${configsetting:ConnectionStrings.DefaultConnection}">
<commandText>
INSERT INTO CmdAppLog (CmdAppId, Message, Level, Timestamp, Exception)
VALUES (@cmdAppId, @message, @level, @timestamp, @exception)
</commandText>
<parameter name="@cmdAppId" layout="${event-properties:ServerId}" />
<parameter name="@message" layout="${message}" />
<parameter name="@level" layout="${level}" />
<parameter name="@timestamp" layout="${longdate}" />
<parameter name="@exception" layout="${exception:format=tostring}" />
</target>
</targets>
</nlog>
Security Best Practices
Password Hashing
Use PasswordHasher for all password operations:
using RCAAS.Core.Helpers;
// Hash a password
string hashedPassword = PasswordHasher.HashPassword("userPassword123");
// Verify a password
bool isValid = PasswordHasher.VerifyPassword("userPassword123", hashedPassword);
// Check if rehashing is needed (e.g., after algorithm updates)
if (PasswordHasher.NeedsRehash(hashedPassword))
{
hashedPassword = PasswordHasher.HashPassword("userPassword123");
}
Secure Token Generation
using RCAAS.Core.Helpers;
// Generate a secure token
string apiToken = TokenGenerator.GenerateSecureToken(length: 32);
Dependencies
Core Framework
- Microsoft.Extensions.Hosting (^9.0.0) - Hosting infrastructure
- Microsoft.Extensions.DependencyInjection (^9.0.0) - DI container
- Microsoft.Extensions.Logging (^9.0.0) - Logging abstractions
Data & Persistence
- Microsoft.EntityFrameworkCore (^9.0.0) - ORM framework
- Microsoft.EntityFrameworkCore.SqlServer (^9.0.0) - SQL Server provider
- Pomelo.EntityFrameworkCore.MySql (^9.0.0) - MySQL provider
Logging
- NLog (^5.3.4) - Logging framework
- NLog.Extensions.Logging (^5.3.14) - NLog integration
- NLog.Database (^5.3.4) - Database logging target
Utilities
- Newtonsoft.Json (^13.0.3) - JSON serialization
- RestSharp (^112.2.0) - REST client
- Konscious.Security.Cryptography.Argon2 (^1.3.1) - Password hashing
Testing
RCAAS.Core includes unit tests:
dotnet test RCAAS.Test/RCAAS.Test.csproj
Key test coverage:
- ✅ Wrapper management and plugin loading
- ✅ Password hashing and security
- ✅ Web helper operations
- ✅ Java detection
- ✅ Configuration file parsing
- ✅ Data model serialization
Version History
Current Version: 1.1.0.x
- Major: Breaking API changes
- Minor: New features
- Patch: Bug fixes, backward compatible
Contributing
Contributions are welcome! Please follow these guidelines:
- Fork the repository
- Create a feature branch (
git checkout -b feature/new-feature) - Commit your changes (
git commit -m 'Add new feature') - Push to the branch (
git push origin feature/new-feature) - Open a Pull Request
Development Requirements
- .NET 9 SDK
- Visual Studio 2022 or VS Code with C# extension
- SQL Server, MySQL, or PostgreSQL for database testing
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support & Community
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Repository: https://github.com/Peazout/RCAAS
For bugs, feature requests, or questions, please open an issue on GitHub.
Acknowledgments
Built with .NET best practices and leveraging the work of the .NET community, including:
- Entity Framework Core team
- NLog contributors
- Argon2 cryptography implementation
- RestSharp maintainers
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- Cronos (>= 0.8.4)
- MedallionShell (>= 1.6.2)
- Microsoft.EntityFrameworkCore (>= 9.0.8)
- Microsoft.EntityFrameworkCore.SqlServer (>= 9.0.8)
- Microsoft.Extensions.Hosting (>= 9.0.8)
- Microsoft.Win32.Registry (>= 5.0.0)
- Newtonsoft.Json (>= 13.0.3)
- NLog (>= 6.0.3)
- NLog.Database (>= 6.0.3)
- NLog.Extensions.Logging (>= 6.0.3)
- Pomelo.EntityFrameworkCore.MySql (>= 9.0.0)
- RestSharp (>= 112.1.0)
- Salaros.ConfigParser (>= 0.3.8)
- System.IO.Compression (>= 4.3.0)
- System.IO.Compression.ZipFile (>= 4.3.0)
- Telnet (>= 0.13.1)
- Unosquare.Swan.Lite (>= 3.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.