forked from Elfocrash/L2dotNET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfig.cs
More file actions
38 lines (33 loc) · 1.66 KB
/
Copy pathConfig.cs
File metadata and controls
38 lines (33 loc) · 1.66 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
using System.IO;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace L2dotNET.Config
{
public sealed class Config : IInitialisable
{
public bool Initialised { get; private set; }
public ServerConfig ServerConfig;
public GameplayConfig GameplayConfig;
public async Task Initialise()
{
if (Initialised)
{
return;
}
ServerConfig = JsonConvert.DeserializeObject<ServerConfig>(File.ReadAllText(@"config\server.json"));
GameplayConfig = new GameplayConfig
{
ClanConfig = JsonConvert.DeserializeObject<ClanConfig>(File.ReadAllText(@"config\clan.json")),
EventConfig = JsonConvert.DeserializeObject<EventConfig>(File.ReadAllText(@"config\events.json")),
GeodataConfig = JsonConvert.DeserializeObject<GeodataConfig>(File.ReadAllText(@"config\geodata.json")),
LoginConfig = JsonConvert.DeserializeObject<LoginConfig>(File.ReadAllText(@"config\loginserver.json")),
NpcConfig = JsonConvert.DeserializeObject<NpcConfig>(File.ReadAllText(@"config\npcs.json")),
PlayerConfig = JsonConvert.DeserializeObject<PlayerConfig>(File.ReadAllText(@"config\player.json")),
Server = JsonConvert.DeserializeObject<ServerConfig2>(File.ReadAllText(@"config\gameplay.json")),
SiegeConfig = JsonConvert.DeserializeObject<SiegeConfig>(File.ReadAllText(@"config\siege.json")),
OtherConfig = JsonConvert.DeserializeObject<OtherConfig>(File.ReadAllText(@"config\other.json"))
};
Initialised = true;
}
}
}