26 lines
627 B
C#
26 lines
627 B
C#
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
namespace C969Project;
|
|
|
|
public static class AppSettings
|
|
{
|
|
public static Dictionary<string, Dictionary<string, string>> Settings { get; private set; } = new();
|
|
|
|
public static void Initialize()
|
|
{
|
|
string contents;
|
|
using (StreamReader r = new StreamReader("appsettings.json"))
|
|
{
|
|
contents = r.ReadToEnd();
|
|
}
|
|
|
|
Settings = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, string>>>(contents);
|
|
}
|
|
|
|
public static string GetSetting(string category, string setting)
|
|
{
|
|
return Settings[category][setting];
|
|
}
|
|
} |