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.
21 lines
789 B
C#
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()!);
|
|
}
|
|
}
|