-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathreadconf.cs
107 lines (68 loc) · 2.56 KB
/
readconf.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace obfsproxy
{
class readconf
{
public string _Base32;
public string _obfsproxyadd;
public string _obfsproxyport;
public string _Localserver;
public string _Localport;
public string _Squidserveradd;
public string _Squidport;
public class obfsproxyconfig
{
public string BASE32 { get; set; }
public string obfsproxyadd { get; set; }
public string obfsproxyport { get; set; }
public string Localserver { get; set; }
public string Localport { get; set; }
}
public class data
{
public string BASE32 { get; set; }
public string obfsproxyadd { get; set; }
public string obfsproxyport { get; set; }
}
public class Account
{
public string BASE32 { get; set; }
public string obfsproxyadd { get; set; }
public string obfsproxyport { get; set; }
public string Localserver { get; set; }
public string Localport { get; set; }
// public IList<string> Roles { get; set; }
}
public class squidjson
{
public string Squidserveradd { get; set; }
public string Squidport { get; set; }
// public IList<string> Roles { get; set; }
}
public void readjson()
{
string path = System.Environment.CurrentDirectory;
// read file into a string and deserialize JSON to a type
obfsproxyconfig movie1 = JsonConvert.DeserializeObject<obfsproxyconfig>(File.ReadAllText(@path + "\\" + "osconf.json"));
// deserialize JSON directly from a file
using (StreamReader file = File.OpenText(@path + "\\" + "osconf.json"))
{
JsonSerializer serializer = new JsonSerializer();
obfsproxyconfig movie2 = (obfsproxyconfig)serializer.Deserialize(file, typeof(obfsproxyconfig));
// MessageBox.Show(movie2.BASE32);
// MessageBox.Show(movie2.obfsproxyadd);
_Base32 = movie2.BASE32;
_obfsproxyadd = movie2.obfsproxyadd;
_obfsproxyport = movie2.obfsproxyport;
_Localserver = movie2.Localserver;
_Localport = movie2.Localport;
}
}
}
}