-
Notifications
You must be signed in to change notification settings - Fork 0
/
Config.cs
39 lines (33 loc) · 1.08 KB
/
Config.cs
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
using System;
using System.IO;
using Newtonsoft.Json;
using System.Collections.Generic;
namespace FeatureInfo
{
public class Infos
{
public string Command = "getinfo";
public string Reload = "inforeload";
public class InfoMsg
{
public string info { get; set; }
public string msg { get; set; }
}
public List<InfoMsg> GetInfoMsgs = new List<InfoMsg>();
public static Infos Read(string configpath)
{
if (!File.Exists(configpath))
{
Infos infos = new Infos();
infos.GetInfoMsgs.Add(new InfoMsg()
{
info = "keyword",
msg = "information send for this keyword"
});
File.WriteAllText(configpath, JsonConvert.SerializeObject(infos, Formatting.Indented));
return infos;
}
return JsonConvert.DeserializeObject<Infos>(File.ReadAllText(configpath));
}
}
}