-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConfig.cs
52 lines (42 loc) · 1.35 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
43
44
45
46
47
48
49
50
51
52
using System.IO;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace AWRP {
internal class Config {
internal const string CONFIG_NAME = "awrp.json";
internal const string PASSWORD_NULL = "__NULL__";
internal static bool Load(string path, out Config config) {
try {
config = JsonConvert.DeserializeObject<Config>(File.ReadAllText(path));
return true;
} catch (JsonException) {
config = null;
return false;
}
}
internal static void Write(string path, Config config) {
string content = JsonConvert.SerializeObject(config);
File.WriteAllText(path, content);
}
internal class UploadItem {
[JsonProperty]
public string Src;
[JsonProperty]
public string ResoucrePath;
[JsonProperty]
public string Description;
[JsonProperty]
public string SolutionUniqueName;
}
[JsonProperty]
public string Host;
[JsonProperty]
public string User;
[JsonProperty]
public string Password;
[JsonProperty]
public string Prefix;
[JsonProperty]
public List<UploadItem> Uploads;
}
}