-
Notifications
You must be signed in to change notification settings - Fork 0
/
Config.cs
42 lines (37 loc) · 1.01 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
40
41
42
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CommonTranslate
{
public static class Config
{
public const string ConfigPath = "config.json";
public static bool CheckConfigExist()
{
bool flag = false;
if (File.Exists(ConfigPath))
{
flag = true;
}
return flag;
}
public static void InitalizeConfig()
{
JObject configJObject = new JObject();
configJObject.Add("secretId", "");
configJObject.Add("secretKey", "");
SaveConfig(configJObject);
}
public static void SaveConfig(JObject saveJObject)
{
File.WriteAllText(ConfigPath, saveJObject.ToString());
}
public static JObject LoadConfig()
{
return JObject.Parse(File.ReadAllText(ConfigPath));
}
}
}