-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfig.cs
More file actions
50 lines (42 loc) · 1.24 KB
/
Config.cs
File metadata and controls
50 lines (42 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using Newtonsoft.Json;
using System.Collections.Generic;
using System.IO;
namespace ProcessWatcher
{
public class WebServerConfig
{
public string BindAddressHTTP;
public string BindAddressHTTPS;
public bool DebugMode = false;
public bool Enabled = true;
public List<string> AllowedSteamIDs = new List<string>();
}
public class SteamConfig
{
public string API;
public string OAuthReturn;
public string OAuthUri;
}
public class Config
{
public static string ConfigFile = "config.json";
public static bool EnabledWebserver = false;
public static bool EnabledMail = false;
public WebServerConfig Web = new WebServerConfig();
public SteamConfig Steam = new SteamConfig();
public static Config Load()
{
Config cfg;
if (File.Exists(ConfigFile))
{
cfg = JsonConvert.DeserializeObject<Config>(File.ReadAllText(ConfigFile));
}
else
{
cfg = new Config();
File.WriteAllText(ConfigFile, JsonConvert.SerializeObject(cfg, Formatting.Indented));
}
return cfg;
}
}
}