-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathConnection.cs
102 lines (94 loc) · 3.09 KB
/
Connection.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
// Decompiled with JetBrains decompiler
// Type: LcDevPack_TeamDamonA.Connection
// Assembly: LcDevPack_TeamDamonA, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 6B9BC8BF-B510-4945-A515-04135CC0F4A4
// Assembly location: C:\Users\NTServer\Desktop\LcDevPack_TeamDamonA\LcDevPack_TeamDamonA\LcDevPack_TeamDamonA.exe
using System.IO;
using System.Windows.Forms;
namespace LcDevPack_TeamDamonA
{
public class Connection
{
public string ReadSettings(string var)
{
if (!File.Exists("Config/Settings.cfg"))
{
int num = (int) MessageBox.Show("Cannot Found, SettingsFile is created now.");
string[] contents = new string[10]
{
"## Main",
"Episode=EP4",
"ClientPath=",
"## MYSQL",
"SQL_HOST=127.0.0.1",
"SQL_USER=root",
"SQL_PASSWORD=",
"SQL_DATABASE=2015_data",
"Language=", //dethunter12 add
"SQL_DB_DATABASE="
};
string path = Directory.GetCurrentDirectory() + "\\Config";
if (!Directory.Exists(path))
Directory.CreateDirectory(path);
File.WriteAllLines(path + "\\Settings.cfg", contents);
}
string str1 = "";
string str2 = "";
string str3 = "";
string str4 = "";
string str5 = "";
string str6 = "";
string str7 = ""; //dethunter12 add
string str11 = ""; //dethunter12 add
string str12 = ""; //dethunter12 add
string str13 = ""; //dethunter12 add
TextReader textReader = (TextReader) new StreamReader("Config/Settings.cfg");
string str9 = "";
while ((str7 = textReader.ReadLine()) != null)
{
if (!str7.Contains("#") && (uint) str7.Length > 0U)
{
string[] strArray = str7.Split('=');
foreach (string str8 in strArray)
{
if (strArray[0] == "SQL_HOST")
str1 = strArray[1];
if (strArray[0] == "SQL_USER")
str2 = strArray[1];
if (strArray[0] == "SQL_PASSWORD")
str3 = strArray[1];
if (strArray[0] == "SQL_DATABASE")
str4 = strArray[1];
if (strArray[0] == "Episode")
str5 = strArray[1];
if (strArray[0] == "ClientPath")
str6 = strArray[1];
if (strArray[0] == "Language") //dethunter12 test read
str9 = strArray[1]; //dethunter12 test
if (strArray[0] == "SQL_DB_DATABASE")
str13 = strArray[1];
}
}
}
textReader.Close();
if (var == "Host")
return str1;
if (var == "User")
return str2;
if (var == "Password")
return str3;
if (var == "Database")
return str4 + (str9 == "THA" ? ";CharSet=tis620" : "");
if (var == "Episode")
return str5;
if (var == "ClientPath")
return str6;
if (var == "Language") //dethunter12 test
return str9; // dethunter12 test
return str12;
if (var == "DB_Database")
return str13;
return "";
}
}
}