using System.Text.Json; namespace JevOverlay.Core; public static class OverlayConfig { public const string FileName = "JevOverlay.conf"; public static string LoadLogPath(string modDirectory) { using var document = JsonDocument.Parse(File.ReadAllText(Path.Combine(modDirectory, FileName))); var root = document.RootElement; if (root.ValueKind != JsonValueKind.Object || !root.TryGetProperty("log_path", out var value) || value.ValueKind != JsonValueKind.String || string.IsNullOrWhiteSpace(value.GetString()) || !Path.IsPathFullyQualified(value.GetString()!)) throw new FormatException("log_path must be an absolute file path."); return Path.GetFullPath(value.GetString()!); } }