Files
LegacyWeaveLoader/LegacyForge.Launcher/Config.cs
Jacobwasbeast de22a24100 Initial commit: LegacyForge mod loader for Minecraft Legacy Edition
SKSE-style external mod loader with zero game source modifications.
- LegacyForge.Launcher: C# console app that injects runtime DLL into game process
- LegacyForgeRuntime: C++ DLL with PDB symbol resolution, MinHook function hooking, and .NET CoreCLR hosting
- LegacyForge.Core: C# mod discovery and lifecycle management
- LegacyForge.API: Fabric-style mod API with namespaced string IDs, fluent property builders, and event system
- ExampleMod: Sample mod demonstrating block/item registration
2026-03-06 15:11:53 -06:00

36 lines
748 B
C#

using System.Text.Json;
namespace LegacyForge.Launcher;
public class Config
{
public string? GameExePath { get; set; }
private static readonly JsonSerializerOptions JsonOptions = new()
{
WriteIndented = true
};
public static Config Load(string path)
{
if (!File.Exists(path))
return new Config();
try
{
var json = File.ReadAllText(path);
return JsonSerializer.Deserialize<Config>(json, JsonOptions) ?? new Config();
}
catch
{
return new Config();
}
}
public void Save(string path)
{
var json = JsonSerializer.Serialize(this, JsonOptions);
File.WriteAllText(path, json);
}
}