sts2-bot/ui/JevOverlay/Core/OverlayConfig.cs
0xrsydn 130273570b feat(ui): integrate read-only Jev decision overlay
Initialize the Godot panel, poll the decision log in the background, and preserve inspection state during updates. Use a .conf file to keep local settings separate from mod manifests.
2026-09-23 13:40:02 +07:00

21 lines
789 B
C#

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()!);
}
}