-
Notifications
You must be signed in to change notification settings - Fork 76
/
PropertyWindow.Misc.cs
110 lines (93 loc) · 4.92 KB
/
PropertyWindow.Misc.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
108
109
110
/*
Copyright 2010 MCSharp team (Modified for use with MCZall/MCLawl/MCForge)
Dual-licensed under the Educational Community License, Version 2.0 and
the GNU General Public License, Version 3 (the "Licenses"); you may
not use this file except in compliance with the Licenses. You may
obtain a copy of the Licenses at
http://www.opensource.org/licenses/ecl2.php
http://www.gnu.org/licenses/gpl-3.0.html
Unless required by applicable law or agreed to in writing,
software distributed under the Licenses are distributed on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
using System;
using System.Windows.Forms;
using MCGalaxy.Gui.Popups;
using MCGalaxy.SQL;
namespace MCGalaxy.Gui {
public partial class PropertyWindow : Form {
void LoadMiscProps() {
bak_numTime.Value = Server.Config.BackupInterval;
bak_txtLocation.Text = Server.Config.BackupDirectory;
hack_lbl.Checked = Server.Config.HackrankKicks;
hack_num.Value = Server.Config.HackrankKickDelay;
afk_numTimer.Value = Server.Config.AutoAfkTime;
chkPhysRestart.Checked = Server.Config.PhysicsRestart;
txtRP.Text = Server.Config.PhysicsRestartLimit.ToString();
txtNormRp.Text = Server.Config.PhysicsRestartNormLimit.ToString();
chkDeath.Checked = Server.Config.AnnounceDeathCount;
chkSmile.Checked = Server.Config.ParseEmotes;
chk17Dollar.Checked = Server.Config.DollarNames;
chkRepeatMessages.Checked = Server.Config.RepeatMBs;
chkGuestLimitNotify.Checked = Server.Config.GuestLimitNotify;
misc_numReview.Value = Server.Config.ReviewCooldown;
chkRestart.Checked = Server.Config.restartOnError;
}
void ApplyMiscProps() {
Server.Config.BackupInterval = bak_numTime.Value;
Server.Config.BackupDirectory = bak_txtLocation.Text;
Server.Config.HackrankKicks = hack_lbl.Checked;
Server.Config.HackrankKickDelay = hack_num.Value;
Server.Config.AutoAfkTime = afk_numTimer.Value;
Server.Config.PhysicsRestart = chkPhysRestart.Checked;
Server.Config.PhysicsRestartLimit = int.Parse(txtRP.Text);
Server.Config.PhysicsRestartNormLimit = int.Parse(txtNormRp.Text);
Server.Config.AnnounceDeathCount = chkDeath.Checked;
Server.Config.ParseEmotes = chkSmile.Checked;
Server.Config.DollarNames = chk17Dollar.Checked;
Server.Config.RepeatMBs = chkRepeatMessages.Checked;
Server.Config.GuestLimitNotify = chkGuestLimitNotify.Checked;
Server.Config.ReviewCooldown = misc_numReview.Value;
Server.Config.restartOnError = chkRestart.Checked;
}
void adv_btnEditTexts_Click(object sender, EventArgs e) {
using (Form form = new EditText()) {
form.ShowDialog();
}
}
void LoadSqlProps() {
sql_chkUseSQL.Checked = Server.Config.UseMySQL;
sql_txtUser.Text = Server.Config.MySQLUsername;
sql_txtPass.Text = Server.Config.MySQLPassword;
sql_txtDBName.Text = Server.Config.MySQLDatabaseName;
sql_txtHost.Text = Server.Config.MySQLHost;
sql_txtPort.Text = Server.Config.MySQLPort;
ToggleMySQLSettings(Server.Config.UseMySQL);
}
void ApplySqlProps() {
Server.Config.UseMySQL = sql_chkUseSQL.Checked;
Server.Config.MySQLUsername = sql_txtUser.Text;
Server.Config.MySQLPassword = sql_txtPass.Text;
Server.Config.MySQLDatabaseName = sql_txtDBName.Text;
Server.Config.MySQLHost = sql_txtHost.Text;
Server.Config.MySQLPort = sql_txtPort.Text;
Database.UpdateActiveBackend();
//Server.Config.MySQLPooling = ; // No setting for this?
}
void ToggleMySQLSettings(bool enabled) {
sql_txtUser.Enabled = enabled; sql_lblUser.Enabled = enabled;
sql_txtPass.Enabled = enabled; sql_lblPass.Enabled = enabled;
sql_txtPort.Enabled = enabled; sql_lblPort.Enabled = enabled;
sql_txtHost.Enabled = enabled; sql_lblHost.Enabled = enabled;
sql_txtDBName.Enabled = enabled; sql_lblDBName.Enabled = enabled;
}
void sql_linkDownload_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
GuiUtils.OpenBrowser("https://dev.mysql.com/downloads/");
}
void sql_chkUseSQL_CheckedChanged(object sender, EventArgs e) {
ToggleMySQLSettings(sql_chkUseSQL.Checked);
}
}
}