mirror of
https://github.com/Jacobwasbeast/LegacyWeaveLoader.git
synced 2026-05-22 21:54:30 +00:00
Rename across entire codebase: - LegacyForge -> WeaveLoader (identifiers, namespaces, classes, DLLs) - LegacyForgeRuntime -> WeaveLoaderRuntime (C++ project) - LegacyForge.API/Core/Launcher -> WeaveLoader.API/Core/Launcher (C# projects) - [LegacyForge] -> [WeaveLoader] (log prefixes) - legacyforge -> weaveloader (config files, log files, backup suffixes) - Display name "Weave Loader" in README, CONTRIBUTING, LICENSE
36 lines
748 B
C#
36 lines
748 B
C#
using System.Text.Json;
|
|
|
|
namespace WeaveLoader.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);
|
|
}
|
|
}
|