Merge branch 'general-devel' of github.com:TShock/TShock into general-devel
This commit is contained in:
commit
1e2fa5cc74
15 changed files with 1488 additions and 206 deletions
|
|
@ -5,21 +5,23 @@ using System.Text;
|
|||
|
||||
namespace TShockDBEditor
|
||||
{
|
||||
public class Commandlist
|
||||
public class TShockCommandsList
|
||||
{
|
||||
public static List<string> CommandList = new List<string>();
|
||||
|
||||
public static void AddCommands()
|
||||
public static void AddRemainingTShockCommands()
|
||||
{
|
||||
List<string> CommandList = new List<string>();
|
||||
|
||||
CommandList.Add("reservedslot");
|
||||
CommandList.Add("canwater");
|
||||
CommandList.Add("canlava");
|
||||
CommandList.Add("canbuild");
|
||||
CommandList.Add("adminchat");
|
||||
CommandList.Add("warp");
|
||||
CommandList.Add("kick");
|
||||
CommandList.Add("ban");
|
||||
CommandList.Add("unban");
|
||||
CommandList.Add("whitelist");
|
||||
CommandList.Add("maintenace");
|
||||
CommandList.Add("maintenance");
|
||||
CommandList.Add("causeevents");
|
||||
CommandList.Add("spawnboss");
|
||||
CommandList.Add("spawnmob");
|
||||
|
|
@ -42,6 +44,12 @@ namespace TShockDBEditor
|
|||
CommandList.Add("ignorecheatdetection");
|
||||
CommandList.Add("ignoregriefdetection");
|
||||
CommandList.Add("usebanneditem");
|
||||
|
||||
foreach (string command in CommandList)
|
||||
{
|
||||
if (!TShockDBEditor.CommandList.Contains(command))
|
||||
TShockDBEditor.CommandList.Add(command);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
730
DBEditor/Main.Designer.cs
generated
730
DBEditor/Main.Designer.cs
generated
|
|
@ -39,12 +39,16 @@
|
|||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.tabPage2 = new System.Windows.Forms.TabPage();
|
||||
this.lst_inheritgrps = new System.Windows.Forms.ComboBox();
|
||||
this.label11 = new System.Windows.Forms.Label();
|
||||
this.txt_grpname = new System.Windows.Forms.TextBox();
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.label12 = new System.Windows.Forms.Label();
|
||||
this.btn_deletegroup = new System.Windows.Forms.Button();
|
||||
this.lbl_grpchild = new System.Windows.Forms.Label();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.label11 = new System.Windows.Forms.Label();
|
||||
this.btn_newgroup = new System.Windows.Forms.Button();
|
||||
this.txt_grpname = new System.Windows.Forms.TextBox();
|
||||
this.lst_inheritgrps = new System.Windows.Forms.ComboBox();
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.btn_moveAllLeftCmd = new System.Windows.Forms.Button();
|
||||
|
|
@ -54,26 +58,76 @@
|
|||
this.btn_moveAllRightCmd = new System.Windows.Forms.Button();
|
||||
this.lst_bannedCmds = new System.Windows.Forms.ListBox();
|
||||
this.lst_groupList = new System.Windows.Forms.ListBox();
|
||||
this.tabPage5 = new System.Windows.Forms.TabPage();
|
||||
this.groupBox4 = new System.Windows.Forms.GroupBox();
|
||||
this.lbl_useraddstatus = new System.Windows.Forms.Label();
|
||||
this.btn_adduser = new System.Windows.Forms.Button();
|
||||
this.label20 = new System.Windows.Forms.Label();
|
||||
this.label22 = new System.Windows.Forms.Label();
|
||||
this.txt_newusername = new System.Windows.Forms.TextBox();
|
||||
this.txt_newuserpass = new System.Windows.Forms.TextBox();
|
||||
this.txt_newuserip = new System.Windows.Forms.TextBox();
|
||||
this.lst_newusergrplist = new System.Windows.Forms.ComboBox();
|
||||
this.label24 = new System.Windows.Forms.Label();
|
||||
this.label25 = new System.Windows.Forms.Label();
|
||||
this.groupBox3 = new System.Windows.Forms.GroupBox();
|
||||
this.label13 = new System.Windows.Forms.Label();
|
||||
this.btn_deluser = new System.Windows.Forms.Button();
|
||||
this.label23 = new System.Windows.Forms.Label();
|
||||
this.txt_username = new System.Windows.Forms.TextBox();
|
||||
this.txt_userpass = new System.Windows.Forms.TextBox();
|
||||
this.txt_userip = new System.Windows.Forms.TextBox();
|
||||
this.lst_usergrplist = new System.Windows.Forms.ComboBox();
|
||||
this.label21 = new System.Windows.Forms.Label();
|
||||
this.label14 = new System.Windows.Forms.Label();
|
||||
this.lst_userlist = new System.Windows.Forms.ListBox();
|
||||
this.tabPage6 = new System.Windows.Forms.TabPage();
|
||||
this.groupBox7 = new System.Windows.Forms.GroupBox();
|
||||
this.lst_bans = new System.Windows.Forms.ListBox();
|
||||
this.groupBox6 = new System.Windows.Forms.GroupBox();
|
||||
this.lbl_newbanstatus = new System.Windows.Forms.Label();
|
||||
this.label16 = new System.Windows.Forms.Label();
|
||||
this.btn_bannew = new System.Windows.Forms.Button();
|
||||
this.txt_newbanip = new System.Windows.Forms.TextBox();
|
||||
this.txt_newbanreason = new System.Windows.Forms.TextBox();
|
||||
this.txt_newbanname = new System.Windows.Forms.TextBox();
|
||||
this.label27 = new System.Windows.Forms.Label();
|
||||
this.label26 = new System.Windows.Forms.Label();
|
||||
this.groupBox5 = new System.Windows.Forms.GroupBox();
|
||||
this.label17 = new System.Windows.Forms.Label();
|
||||
this.txt_banip = new System.Windows.Forms.TextBox();
|
||||
this.btn_bandelete = new System.Windows.Forms.Button();
|
||||
this.txt_banname = new System.Windows.Forms.TextBox();
|
||||
this.label19 = new System.Windows.Forms.Label();
|
||||
this.txt_banreason = new System.Windows.Forms.TextBox();
|
||||
this.label18 = new System.Windows.Forms.Label();
|
||||
this.tabControl1 = new System.Windows.Forms.TabControl();
|
||||
this.tabPage3 = new System.Windows.Forms.TabPage();
|
||||
this.btn_OpenLocalDB = new System.Windows.Forms.Button();
|
||||
this.tabPage4 = new System.Windows.Forms.TabPage();
|
||||
this.btn_connect = new System.Windows.Forms.Button();
|
||||
this.label9 = new System.Windows.Forms.Label();
|
||||
this.txt_password = new System.Windows.Forms.TextBox();
|
||||
this.txt_dbpassword = new System.Windows.Forms.TextBox();
|
||||
this.label8 = new System.Windows.Forms.Label();
|
||||
this.txt_username = new System.Windows.Forms.TextBox();
|
||||
this.txt_dbusername = new System.Windows.Forms.TextBox();
|
||||
this.txt_port = new System.Windows.Forms.TextBox();
|
||||
this.txt_dbname = new System.Windows.Forms.TextBox();
|
||||
this.txt_hostname = new System.Windows.Forms.TextBox();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.label12 = new System.Windows.Forms.Label();
|
||||
this.lbl_grpchild = new System.Windows.Forms.Label();
|
||||
this.tabControl.SuspendLayout();
|
||||
this.tabPage1.SuspendLayout();
|
||||
this.tabPage2.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.tabPage5.SuspendLayout();
|
||||
this.groupBox4.SuspendLayout();
|
||||
this.groupBox3.SuspendLayout();
|
||||
this.tabPage6.SuspendLayout();
|
||||
this.groupBox7.SuspendLayout();
|
||||
this.groupBox6.SuspendLayout();
|
||||
this.groupBox5.SuspendLayout();
|
||||
this.tabControl1.SuspendLayout();
|
||||
this.tabPage3.SuspendLayout();
|
||||
this.tabPage4.SuspendLayout();
|
||||
|
|
@ -99,6 +153,8 @@
|
|||
//
|
||||
this.tabControl.Controls.Add(this.tabPage1);
|
||||
this.tabControl.Controls.Add(this.tabPage2);
|
||||
this.tabControl.Controls.Add(this.tabPage5);
|
||||
this.tabControl.Controls.Add(this.tabPage6);
|
||||
this.tabControl.Location = new System.Drawing.Point(12, 143);
|
||||
this.tabControl.Name = "tabControl";
|
||||
this.tabControl.SelectedIndex = 0;
|
||||
|
|
@ -126,7 +182,7 @@
|
|||
//
|
||||
// btn_moveAllLeft
|
||||
//
|
||||
this.btn_moveAllLeft.Location = new System.Drawing.Point(288, 193);
|
||||
this.btn_moveAllLeft.Location = new System.Drawing.Point(288, 108);
|
||||
this.btn_moveAllLeft.Name = "btn_moveAllLeft";
|
||||
this.btn_moveAllLeft.Size = new System.Drawing.Size(27, 23);
|
||||
this.btn_moveAllLeft.TabIndex = 8;
|
||||
|
|
@ -136,7 +192,7 @@
|
|||
//
|
||||
// btn_moveAllRight
|
||||
//
|
||||
this.btn_moveAllRight.Location = new System.Drawing.Point(288, 106);
|
||||
this.btn_moveAllRight.Location = new System.Drawing.Point(288, 79);
|
||||
this.btn_moveAllRight.Name = "btn_moveAllRight";
|
||||
this.btn_moveAllRight.Size = new System.Drawing.Size(27, 23);
|
||||
this.btn_moveAllRight.TabIndex = 7;
|
||||
|
|
@ -146,7 +202,7 @@
|
|||
//
|
||||
// btn_moveLeft
|
||||
//
|
||||
this.btn_moveLeft.Location = new System.Drawing.Point(288, 164);
|
||||
this.btn_moveLeft.Location = new System.Drawing.Point(288, 195);
|
||||
this.btn_moveLeft.Name = "btn_moveLeft";
|
||||
this.btn_moveLeft.Size = new System.Drawing.Size(27, 23);
|
||||
this.btn_moveLeft.TabIndex = 6;
|
||||
|
|
@ -156,7 +212,7 @@
|
|||
//
|
||||
// btn_moveRight
|
||||
//
|
||||
this.btn_moveRight.Location = new System.Drawing.Point(288, 135);
|
||||
this.btn_moveRight.Location = new System.Drawing.Point(288, 166);
|
||||
this.btn_moveRight.Name = "btn_moveRight";
|
||||
this.btn_moveRight.Size = new System.Drawing.Size(27, 23);
|
||||
this.btn_moveRight.TabIndex = 5;
|
||||
|
|
@ -184,14 +240,8 @@
|
|||
//
|
||||
// tabPage2
|
||||
//
|
||||
this.tabPage2.Controls.Add(this.lbl_grpchild);
|
||||
this.tabPage2.Controls.Add(this.label12);
|
||||
this.tabPage2.Controls.Add(this.lst_inheritgrps);
|
||||
this.tabPage2.Controls.Add(this.label11);
|
||||
this.tabPage2.Controls.Add(this.txt_grpname);
|
||||
this.tabPage2.Controls.Add(this.label10);
|
||||
this.tabPage2.Controls.Add(this.btn_deletegroup);
|
||||
this.tabPage2.Controls.Add(this.btn_newgroup);
|
||||
this.tabPage2.Controls.Add(this.groupBox2);
|
||||
this.tabPage2.Controls.Add(this.groupBox1);
|
||||
this.tabPage2.Controls.Add(this.label4);
|
||||
this.tabPage2.Controls.Add(this.label3);
|
||||
this.tabPage2.Controls.Add(this.btn_moveAllLeftCmd);
|
||||
|
|
@ -209,42 +259,30 @@
|
|||
this.tabPage2.Text = "Group Manager";
|
||||
this.tabPage2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// lst_inheritgrps
|
||||
// groupBox2
|
||||
//
|
||||
this.lst_inheritgrps.FormattingEnabled = true;
|
||||
this.lst_inheritgrps.Location = new System.Drawing.Point(375, 84);
|
||||
this.lst_inheritgrps.Name = "lst_inheritgrps";
|
||||
this.lst_inheritgrps.Size = new System.Drawing.Size(100, 21);
|
||||
this.lst_inheritgrps.TabIndex = 23;
|
||||
this.groupBox2.Controls.Add(this.label12);
|
||||
this.groupBox2.Controls.Add(this.btn_deletegroup);
|
||||
this.groupBox2.Controls.Add(this.lbl_grpchild);
|
||||
this.groupBox2.Location = new System.Drawing.Point(222, 6);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(374, 54);
|
||||
this.groupBox2.TabIndex = 27;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "Selected Group";
|
||||
//
|
||||
// label11
|
||||
// label12
|
||||
//
|
||||
this.label11.AutoSize = true;
|
||||
this.label11.Location = new System.Drawing.Point(299, 87);
|
||||
this.label11.Name = "label11";
|
||||
this.label11.Size = new System.Drawing.Size(65, 13);
|
||||
this.label11.TabIndex = 22;
|
||||
this.label11.Text = "Inherit From:";
|
||||
//
|
||||
// txt_grpname
|
||||
//
|
||||
this.txt_grpname.Location = new System.Drawing.Point(375, 55);
|
||||
this.txt_grpname.Name = "txt_grpname";
|
||||
this.txt_grpname.Size = new System.Drawing.Size(100, 20);
|
||||
this.txt_grpname.TabIndex = 21;
|
||||
//
|
||||
// label10
|
||||
//
|
||||
this.label10.AutoSize = true;
|
||||
this.label10.Location = new System.Drawing.Point(299, 58);
|
||||
this.label10.Name = "label10";
|
||||
this.label10.Size = new System.Drawing.Size(70, 13);
|
||||
this.label10.TabIndex = 20;
|
||||
this.label10.Text = "Group Name:";
|
||||
this.label12.AutoSize = true;
|
||||
this.label12.Location = new System.Drawing.Point(6, 26);
|
||||
this.label12.Name = "label12";
|
||||
this.label12.Size = new System.Drawing.Size(65, 13);
|
||||
this.label12.TabIndex = 24;
|
||||
this.label12.Text = "Group Child:";
|
||||
//
|
||||
// btn_deletegroup
|
||||
//
|
||||
this.btn_deletegroup.Location = new System.Drawing.Point(215, 82);
|
||||
this.btn_deletegroup.Location = new System.Drawing.Point(183, 19);
|
||||
this.btn_deletegroup.Name = "btn_deletegroup";
|
||||
this.btn_deletegroup.Size = new System.Drawing.Size(78, 23);
|
||||
this.btn_deletegroup.TabIndex = 19;
|
||||
|
|
@ -252,9 +290,41 @@
|
|||
this.btn_deletegroup.UseVisualStyleBackColor = true;
|
||||
this.btn_deletegroup.Click += new System.EventHandler(this.btn_deletegroup_Click);
|
||||
//
|
||||
// lbl_grpchild
|
||||
//
|
||||
this.lbl_grpchild.AutoSize = true;
|
||||
this.lbl_grpchild.Location = new System.Drawing.Point(77, 26);
|
||||
this.lbl_grpchild.Name = "lbl_grpchild";
|
||||
this.lbl_grpchild.Size = new System.Drawing.Size(31, 13);
|
||||
this.lbl_grpchild.TabIndex = 25;
|
||||
this.lbl_grpchild.Text = "none";
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.label11);
|
||||
this.groupBox1.Controls.Add(this.btn_newgroup);
|
||||
this.groupBox1.Controls.Add(this.txt_grpname);
|
||||
this.groupBox1.Controls.Add(this.lst_inheritgrps);
|
||||
this.groupBox1.Controls.Add(this.label10);
|
||||
this.groupBox1.Location = new System.Drawing.Point(222, 66);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(374, 76);
|
||||
this.groupBox1.TabIndex = 26;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Create New Group";
|
||||
//
|
||||
// label11
|
||||
//
|
||||
this.label11.AutoSize = true;
|
||||
this.label11.Location = new System.Drawing.Point(6, 25);
|
||||
this.label11.Name = "label11";
|
||||
this.label11.Size = new System.Drawing.Size(65, 13);
|
||||
this.label11.TabIndex = 22;
|
||||
this.label11.Text = "Inherit From:";
|
||||
//
|
||||
// btn_newgroup
|
||||
//
|
||||
this.btn_newgroup.Location = new System.Drawing.Point(215, 53);
|
||||
this.btn_newgroup.Location = new System.Drawing.Point(183, 47);
|
||||
this.btn_newgroup.Name = "btn_newgroup";
|
||||
this.btn_newgroup.Size = new System.Drawing.Size(78, 23);
|
||||
this.btn_newgroup.TabIndex = 18;
|
||||
|
|
@ -262,6 +332,30 @@
|
|||
this.btn_newgroup.UseVisualStyleBackColor = true;
|
||||
this.btn_newgroup.Click += new System.EventHandler(this.btn_newgroup_Click);
|
||||
//
|
||||
// txt_grpname
|
||||
//
|
||||
this.txt_grpname.Location = new System.Drawing.Point(77, 49);
|
||||
this.txt_grpname.Name = "txt_grpname";
|
||||
this.txt_grpname.Size = new System.Drawing.Size(100, 20);
|
||||
this.txt_grpname.TabIndex = 21;
|
||||
//
|
||||
// lst_inheritgrps
|
||||
//
|
||||
this.lst_inheritgrps.FormattingEnabled = true;
|
||||
this.lst_inheritgrps.Location = new System.Drawing.Point(77, 22);
|
||||
this.lst_inheritgrps.Name = "lst_inheritgrps";
|
||||
this.lst_inheritgrps.Size = new System.Drawing.Size(100, 21);
|
||||
this.lst_inheritgrps.TabIndex = 23;
|
||||
//
|
||||
// label10
|
||||
//
|
||||
this.label10.AutoSize = true;
|
||||
this.label10.Location = new System.Drawing.Point(1, 52);
|
||||
this.label10.Name = "label10";
|
||||
this.label10.Size = new System.Drawing.Size(70, 13);
|
||||
this.label10.TabIndex = 20;
|
||||
this.label10.Text = "Group Name:";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
|
|
@ -282,7 +376,7 @@
|
|||
//
|
||||
// btn_moveAllLeftCmd
|
||||
//
|
||||
this.btn_moveAllLeftCmd.Location = new System.Drawing.Point(291, 300);
|
||||
this.btn_moveAllLeftCmd.Location = new System.Drawing.Point(291, 225);
|
||||
this.btn_moveAllLeftCmd.Name = "btn_moveAllLeftCmd";
|
||||
this.btn_moveAllLeftCmd.Size = new System.Drawing.Size(27, 23);
|
||||
this.btn_moveAllLeftCmd.TabIndex = 15;
|
||||
|
|
@ -292,7 +386,7 @@
|
|||
//
|
||||
// btn_moveLeftCmd
|
||||
//
|
||||
this.btn_moveLeftCmd.Location = new System.Drawing.Point(291, 270);
|
||||
this.btn_moveLeftCmd.Location = new System.Drawing.Point(290, 313);
|
||||
this.btn_moveLeftCmd.Name = "btn_moveLeftCmd";
|
||||
this.btn_moveLeftCmd.Size = new System.Drawing.Size(27, 23);
|
||||
this.btn_moveLeftCmd.TabIndex = 14;
|
||||
|
|
@ -302,7 +396,7 @@
|
|||
//
|
||||
// btn_moveRightCmd
|
||||
//
|
||||
this.btn_moveRightCmd.Location = new System.Drawing.Point(291, 240);
|
||||
this.btn_moveRightCmd.Location = new System.Drawing.Point(290, 284);
|
||||
this.btn_moveRightCmd.Name = "btn_moveRightCmd";
|
||||
this.btn_moveRightCmd.Size = new System.Drawing.Size(27, 23);
|
||||
this.btn_moveRightCmd.TabIndex = 13;
|
||||
|
|
@ -320,7 +414,7 @@
|
|||
//
|
||||
// btn_moveAllRightCmd
|
||||
//
|
||||
this.btn_moveAllRightCmd.Location = new System.Drawing.Point(291, 210);
|
||||
this.btn_moveAllRightCmd.Location = new System.Drawing.Point(290, 196);
|
||||
this.btn_moveAllRightCmd.Name = "btn_moveAllRightCmd";
|
||||
this.btn_moveAllRightCmd.Size = new System.Drawing.Size(27, 23);
|
||||
this.btn_moveAllRightCmd.TabIndex = 11;
|
||||
|
|
@ -345,6 +439,425 @@
|
|||
this.lst_groupList.TabIndex = 0;
|
||||
this.lst_groupList.SelectedIndexChanged += new System.EventHandler(this.lst_groupList_SelectedIndexChanged);
|
||||
//
|
||||
// tabPage5
|
||||
//
|
||||
this.tabPage5.Controls.Add(this.groupBox4);
|
||||
this.tabPage5.Controls.Add(this.groupBox3);
|
||||
this.tabPage5.Controls.Add(this.lst_userlist);
|
||||
this.tabPage5.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage5.Name = "tabPage5";
|
||||
this.tabPage5.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage5.Size = new System.Drawing.Size(602, 381);
|
||||
this.tabPage5.TabIndex = 2;
|
||||
this.tabPage5.Text = "User Manager";
|
||||
this.tabPage5.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// groupBox4
|
||||
//
|
||||
this.groupBox4.Controls.Add(this.lbl_useraddstatus);
|
||||
this.groupBox4.Controls.Add(this.btn_adduser);
|
||||
this.groupBox4.Controls.Add(this.label20);
|
||||
this.groupBox4.Controls.Add(this.label22);
|
||||
this.groupBox4.Controls.Add(this.txt_newusername);
|
||||
this.groupBox4.Controls.Add(this.txt_newuserpass);
|
||||
this.groupBox4.Controls.Add(this.txt_newuserip);
|
||||
this.groupBox4.Controls.Add(this.lst_newusergrplist);
|
||||
this.groupBox4.Controls.Add(this.label24);
|
||||
this.groupBox4.Controls.Add(this.label25);
|
||||
this.groupBox4.Location = new System.Drawing.Point(294, 173);
|
||||
this.groupBox4.Name = "groupBox4";
|
||||
this.groupBox4.Size = new System.Drawing.Size(296, 161);
|
||||
this.groupBox4.TabIndex = 15;
|
||||
this.groupBox4.TabStop = false;
|
||||
this.groupBox4.Text = "New User";
|
||||
//
|
||||
// lbl_useraddstatus
|
||||
//
|
||||
this.lbl_useraddstatus.AutoSize = true;
|
||||
this.lbl_useraddstatus.Location = new System.Drawing.Point(87, 135);
|
||||
this.lbl_useraddstatus.Name = "lbl_useraddstatus";
|
||||
this.lbl_useraddstatus.Size = new System.Drawing.Size(146, 13);
|
||||
this.lbl_useraddstatus.TabIndex = 23;
|
||||
this.lbl_useraddstatus.Text = "Status messages display here";
|
||||
this.lbl_useraddstatus.Visible = false;
|
||||
//
|
||||
// btn_adduser
|
||||
//
|
||||
this.btn_adduser.Location = new System.Drawing.Point(6, 130);
|
||||
this.btn_adduser.Name = "btn_adduser";
|
||||
this.btn_adduser.Size = new System.Drawing.Size(75, 23);
|
||||
this.btn_adduser.TabIndex = 22;
|
||||
this.btn_adduser.Text = "Add User";
|
||||
this.btn_adduser.UseVisualStyleBackColor = true;
|
||||
this.btn_adduser.Click += new System.EventHandler(this.btn_adduser_Click);
|
||||
//
|
||||
// label20
|
||||
//
|
||||
this.label20.AutoSize = true;
|
||||
this.label20.Location = new System.Drawing.Point(6, 28);
|
||||
this.label20.Name = "label20";
|
||||
this.label20.Size = new System.Drawing.Size(63, 13);
|
||||
this.label20.TabIndex = 14;
|
||||
this.label20.Text = "User Name:";
|
||||
//
|
||||
// label22
|
||||
//
|
||||
this.label22.AutoSize = true;
|
||||
this.label22.Location = new System.Drawing.Point(13, 107);
|
||||
this.label22.Name = "label22";
|
||||
this.label22.Size = new System.Drawing.Size(56, 13);
|
||||
this.label22.TabIndex = 21;
|
||||
this.label22.Text = "Password:";
|
||||
//
|
||||
// txt_newusername
|
||||
//
|
||||
this.txt_newusername.Location = new System.Drawing.Point(75, 25);
|
||||
this.txt_newusername.Name = "txt_newusername";
|
||||
this.txt_newusername.Size = new System.Drawing.Size(221, 20);
|
||||
this.txt_newusername.TabIndex = 18;
|
||||
//
|
||||
// txt_newuserpass
|
||||
//
|
||||
this.txt_newuserpass.Location = new System.Drawing.Point(75, 104);
|
||||
this.txt_newuserpass.Name = "txt_newuserpass";
|
||||
this.txt_newuserpass.Size = new System.Drawing.Size(221, 20);
|
||||
this.txt_newuserpass.TabIndex = 19;
|
||||
//
|
||||
// txt_newuserip
|
||||
//
|
||||
this.txt_newuserip.Location = new System.Drawing.Point(75, 78);
|
||||
this.txt_newuserip.Name = "txt_newuserip";
|
||||
this.txt_newuserip.Size = new System.Drawing.Size(221, 20);
|
||||
this.txt_newuserip.TabIndex = 20;
|
||||
//
|
||||
// lst_newusergrplist
|
||||
//
|
||||
this.lst_newusergrplist.FormattingEnabled = true;
|
||||
this.lst_newusergrplist.Location = new System.Drawing.Point(75, 51);
|
||||
this.lst_newusergrplist.Name = "lst_newusergrplist";
|
||||
this.lst_newusergrplist.Size = new System.Drawing.Size(221, 21);
|
||||
this.lst_newusergrplist.TabIndex = 16;
|
||||
//
|
||||
// label24
|
||||
//
|
||||
this.label24.AutoSize = true;
|
||||
this.label24.Location = new System.Drawing.Point(49, 81);
|
||||
this.label24.Name = "label24";
|
||||
this.label24.Size = new System.Drawing.Size(20, 13);
|
||||
this.label24.TabIndex = 17;
|
||||
this.label24.Text = "IP:";
|
||||
//
|
||||
// label25
|
||||
//
|
||||
this.label25.AutoSize = true;
|
||||
this.label25.Location = new System.Drawing.Point(30, 54);
|
||||
this.label25.Name = "label25";
|
||||
this.label25.Size = new System.Drawing.Size(39, 13);
|
||||
this.label25.TabIndex = 15;
|
||||
this.label25.Text = "Group:";
|
||||
//
|
||||
// groupBox3
|
||||
//
|
||||
this.groupBox3.Controls.Add(this.label13);
|
||||
this.groupBox3.Controls.Add(this.btn_deluser);
|
||||
this.groupBox3.Controls.Add(this.label23);
|
||||
this.groupBox3.Controls.Add(this.txt_username);
|
||||
this.groupBox3.Controls.Add(this.txt_userpass);
|
||||
this.groupBox3.Controls.Add(this.txt_userip);
|
||||
this.groupBox3.Controls.Add(this.lst_usergrplist);
|
||||
this.groupBox3.Controls.Add(this.label21);
|
||||
this.groupBox3.Controls.Add(this.label14);
|
||||
this.groupBox3.Location = new System.Drawing.Point(294, 7);
|
||||
this.groupBox3.Name = "groupBox3";
|
||||
this.groupBox3.Size = new System.Drawing.Size(302, 159);
|
||||
this.groupBox3.TabIndex = 14;
|
||||
this.groupBox3.TabStop = false;
|
||||
this.groupBox3.Text = "Current User";
|
||||
//
|
||||
// label13
|
||||
//
|
||||
this.label13.AutoSize = true;
|
||||
this.label13.Location = new System.Drawing.Point(6, 26);
|
||||
this.label13.Name = "label13";
|
||||
this.label13.Size = new System.Drawing.Size(63, 13);
|
||||
this.label13.TabIndex = 1;
|
||||
this.label13.Text = "User Name:";
|
||||
//
|
||||
// btn_deluser
|
||||
//
|
||||
this.btn_deluser.Location = new System.Drawing.Point(6, 128);
|
||||
this.btn_deluser.Name = "btn_deluser";
|
||||
this.btn_deluser.Size = new System.Drawing.Size(75, 23);
|
||||
this.btn_deluser.TabIndex = 8;
|
||||
this.btn_deluser.Text = "Delete User";
|
||||
this.btn_deluser.UseVisualStyleBackColor = true;
|
||||
this.btn_deluser.Click += new System.EventHandler(this.btn_deluser_Click);
|
||||
//
|
||||
// label23
|
||||
//
|
||||
this.label23.AutoSize = true;
|
||||
this.label23.Location = new System.Drawing.Point(13, 105);
|
||||
this.label23.Name = "label23";
|
||||
this.label23.Size = new System.Drawing.Size(56, 13);
|
||||
this.label23.TabIndex = 13;
|
||||
this.label23.Text = "Password:";
|
||||
//
|
||||
// txt_username
|
||||
//
|
||||
this.txt_username.Location = new System.Drawing.Point(75, 23);
|
||||
this.txt_username.Name = "txt_username";
|
||||
this.txt_username.ReadOnly = true;
|
||||
this.txt_username.Size = new System.Drawing.Size(221, 20);
|
||||
this.txt_username.TabIndex = 9;
|
||||
//
|
||||
// txt_userpass
|
||||
//
|
||||
this.txt_userpass.Location = new System.Drawing.Point(75, 102);
|
||||
this.txt_userpass.Name = "txt_userpass";
|
||||
this.txt_userpass.ReadOnly = true;
|
||||
this.txt_userpass.Size = new System.Drawing.Size(221, 20);
|
||||
this.txt_userpass.TabIndex = 10;
|
||||
//
|
||||
// txt_userip
|
||||
//
|
||||
this.txt_userip.Location = new System.Drawing.Point(75, 76);
|
||||
this.txt_userip.Name = "txt_userip";
|
||||
this.txt_userip.ReadOnly = true;
|
||||
this.txt_userip.Size = new System.Drawing.Size(221, 20);
|
||||
this.txt_userip.TabIndex = 12;
|
||||
//
|
||||
// lst_usergrplist
|
||||
//
|
||||
this.lst_usergrplist.FormattingEnabled = true;
|
||||
this.lst_usergrplist.Location = new System.Drawing.Point(75, 49);
|
||||
this.lst_usergrplist.Name = "lst_usergrplist";
|
||||
this.lst_usergrplist.Size = new System.Drawing.Size(221, 21);
|
||||
this.lst_usergrplist.TabIndex = 4;
|
||||
this.lst_usergrplist.SelectedIndexChanged += new System.EventHandler(this.lst_usergrplist_SelectedIndexChanged);
|
||||
//
|
||||
// label21
|
||||
//
|
||||
this.label21.AutoSize = true;
|
||||
this.label21.Location = new System.Drawing.Point(49, 79);
|
||||
this.label21.Name = "label21";
|
||||
this.label21.Size = new System.Drawing.Size(20, 13);
|
||||
this.label21.TabIndex = 6;
|
||||
this.label21.Text = "IP:";
|
||||
//
|
||||
// label14
|
||||
//
|
||||
this.label14.AutoSize = true;
|
||||
this.label14.Location = new System.Drawing.Point(30, 52);
|
||||
this.label14.Name = "label14";
|
||||
this.label14.Size = new System.Drawing.Size(39, 13);
|
||||
this.label14.TabIndex = 3;
|
||||
this.label14.Text = "Group:";
|
||||
//
|
||||
// lst_userlist
|
||||
//
|
||||
this.lst_userlist.FormattingEnabled = true;
|
||||
this.lst_userlist.Location = new System.Drawing.Point(9, 7);
|
||||
this.lst_userlist.Name = "lst_userlist";
|
||||
this.lst_userlist.Size = new System.Drawing.Size(275, 368);
|
||||
this.lst_userlist.TabIndex = 0;
|
||||
this.lst_userlist.SelectedIndexChanged += new System.EventHandler(this.lst_userlist_SelectedIndexChanged);
|
||||
//
|
||||
// tabPage6
|
||||
//
|
||||
this.tabPage6.Controls.Add(this.groupBox7);
|
||||
this.tabPage6.Controls.Add(this.groupBox6);
|
||||
this.tabPage6.Controls.Add(this.groupBox5);
|
||||
this.tabPage6.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage6.Name = "tabPage6";
|
||||
this.tabPage6.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage6.Size = new System.Drawing.Size(602, 381);
|
||||
this.tabPage6.TabIndex = 3;
|
||||
this.tabPage6.Text = "Ban Manager";
|
||||
this.tabPage6.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// groupBox7
|
||||
//
|
||||
this.groupBox7.Controls.Add(this.lst_bans);
|
||||
this.groupBox7.Location = new System.Drawing.Point(6, 23);
|
||||
this.groupBox7.Name = "groupBox7";
|
||||
this.groupBox7.Size = new System.Drawing.Size(284, 352);
|
||||
this.groupBox7.TabIndex = 13;
|
||||
this.groupBox7.TabStop = false;
|
||||
this.groupBox7.Text = "Ban List";
|
||||
//
|
||||
// lst_bans
|
||||
//
|
||||
this.lst_bans.FormattingEnabled = true;
|
||||
this.lst_bans.Location = new System.Drawing.Point(6, 19);
|
||||
this.lst_bans.Name = "lst_bans";
|
||||
this.lst_bans.Size = new System.Drawing.Size(272, 329);
|
||||
this.lst_bans.TabIndex = 0;
|
||||
this.lst_bans.SelectedIndexChanged += new System.EventHandler(this.lst_bans_SelectedIndexChanged);
|
||||
//
|
||||
// groupBox6
|
||||
//
|
||||
this.groupBox6.Controls.Add(this.lbl_newbanstatus);
|
||||
this.groupBox6.Controls.Add(this.label16);
|
||||
this.groupBox6.Controls.Add(this.btn_bannew);
|
||||
this.groupBox6.Controls.Add(this.txt_newbanip);
|
||||
this.groupBox6.Controls.Add(this.txt_newbanreason);
|
||||
this.groupBox6.Controls.Add(this.txt_newbanname);
|
||||
this.groupBox6.Controls.Add(this.label27);
|
||||
this.groupBox6.Controls.Add(this.label26);
|
||||
this.groupBox6.Location = new System.Drawing.Point(296, 165);
|
||||
this.groupBox6.Name = "groupBox6";
|
||||
this.groupBox6.Size = new System.Drawing.Size(300, 137);
|
||||
this.groupBox6.TabIndex = 12;
|
||||
this.groupBox6.TabStop = false;
|
||||
this.groupBox6.Text = "New Ban";
|
||||
//
|
||||
// lbl_newbanstatus
|
||||
//
|
||||
this.lbl_newbanstatus.AutoSize = true;
|
||||
this.lbl_newbanstatus.Location = new System.Drawing.Point(90, 113);
|
||||
this.lbl_newbanstatus.Name = "lbl_newbanstatus";
|
||||
this.lbl_newbanstatus.Size = new System.Drawing.Size(146, 13);
|
||||
this.lbl_newbanstatus.TabIndex = 16;
|
||||
this.lbl_newbanstatus.Text = "Status messages display here";
|
||||
this.lbl_newbanstatus.Visible = false;
|
||||
//
|
||||
// label16
|
||||
//
|
||||
this.label16.AutoSize = true;
|
||||
this.label16.Location = new System.Drawing.Point(2, 33);
|
||||
this.label16.Name = "label16";
|
||||
this.label16.Size = new System.Drawing.Size(65, 13);
|
||||
this.label16.TabIndex = 10;
|
||||
this.label16.Text = "*IP Address:";
|
||||
//
|
||||
// btn_bannew
|
||||
//
|
||||
this.btn_bannew.Location = new System.Drawing.Point(9, 108);
|
||||
this.btn_bannew.Name = "btn_bannew";
|
||||
this.btn_bannew.Size = new System.Drawing.Size(75, 23);
|
||||
this.btn_bannew.TabIndex = 10;
|
||||
this.btn_bannew.Text = "New Ban";
|
||||
this.btn_bannew.UseVisualStyleBackColor = true;
|
||||
this.btn_bannew.Click += new System.EventHandler(this.btn_bannew_Click);
|
||||
//
|
||||
// txt_newbanip
|
||||
//
|
||||
this.txt_newbanip.Location = new System.Drawing.Point(73, 30);
|
||||
this.txt_newbanip.Name = "txt_newbanip";
|
||||
this.txt_newbanip.Size = new System.Drawing.Size(221, 20);
|
||||
this.txt_newbanip.TabIndex = 13;
|
||||
//
|
||||
// txt_newbanreason
|
||||
//
|
||||
this.txt_newbanreason.Location = new System.Drawing.Point(74, 82);
|
||||
this.txt_newbanreason.Multiline = true;
|
||||
this.txt_newbanreason.Name = "txt_newbanreason";
|
||||
this.txt_newbanreason.Size = new System.Drawing.Size(220, 20);
|
||||
this.txt_newbanreason.TabIndex = 15;
|
||||
//
|
||||
// txt_newbanname
|
||||
//
|
||||
this.txt_newbanname.Location = new System.Drawing.Point(74, 56);
|
||||
this.txt_newbanname.Name = "txt_newbanname";
|
||||
this.txt_newbanname.Size = new System.Drawing.Size(220, 20);
|
||||
this.txt_newbanname.TabIndex = 14;
|
||||
//
|
||||
// label27
|
||||
//
|
||||
this.label27.AutoSize = true;
|
||||
this.label27.Location = new System.Drawing.Point(25, 59);
|
||||
this.label27.Name = "label27";
|
||||
this.label27.Size = new System.Drawing.Size(42, 13);
|
||||
this.label27.TabIndex = 11;
|
||||
this.label27.Text = "*Name:";
|
||||
//
|
||||
// label26
|
||||
//
|
||||
this.label26.AutoSize = true;
|
||||
this.label26.Location = new System.Drawing.Point(21, 85);
|
||||
this.label26.Name = "label26";
|
||||
this.label26.Size = new System.Drawing.Size(47, 13);
|
||||
this.label26.TabIndex = 12;
|
||||
this.label26.Text = "Reason:";
|
||||
//
|
||||
// groupBox5
|
||||
//
|
||||
this.groupBox5.Controls.Add(this.label17);
|
||||
this.groupBox5.Controls.Add(this.txt_banip);
|
||||
this.groupBox5.Controls.Add(this.btn_bandelete);
|
||||
this.groupBox5.Controls.Add(this.txt_banname);
|
||||
this.groupBox5.Controls.Add(this.label19);
|
||||
this.groupBox5.Controls.Add(this.txt_banreason);
|
||||
this.groupBox5.Controls.Add(this.label18);
|
||||
this.groupBox5.Location = new System.Drawing.Point(296, 23);
|
||||
this.groupBox5.Name = "groupBox5";
|
||||
this.groupBox5.Size = new System.Drawing.Size(300, 129);
|
||||
this.groupBox5.TabIndex = 11;
|
||||
this.groupBox5.TabStop = false;
|
||||
this.groupBox5.Text = "Selected Ban";
|
||||
//
|
||||
// label17
|
||||
//
|
||||
this.label17.AutoSize = true;
|
||||
this.label17.Location = new System.Drawing.Point(6, 26);
|
||||
this.label17.Name = "label17";
|
||||
this.label17.Size = new System.Drawing.Size(61, 13);
|
||||
this.label17.TabIndex = 3;
|
||||
this.label17.Text = "IP Address:";
|
||||
//
|
||||
// txt_banip
|
||||
//
|
||||
this.txt_banip.Location = new System.Drawing.Point(73, 23);
|
||||
this.txt_banip.Name = "txt_banip";
|
||||
this.txt_banip.ReadOnly = true;
|
||||
this.txt_banip.Size = new System.Drawing.Size(221, 20);
|
||||
this.txt_banip.TabIndex = 6;
|
||||
//
|
||||
// btn_bandelete
|
||||
//
|
||||
this.btn_bandelete.Location = new System.Drawing.Point(9, 100);
|
||||
this.btn_bandelete.Name = "btn_bandelete";
|
||||
this.btn_bandelete.Size = new System.Drawing.Size(75, 23);
|
||||
this.btn_bandelete.TabIndex = 9;
|
||||
this.btn_bandelete.Text = "Delete Ban";
|
||||
this.btn_bandelete.UseVisualStyleBackColor = true;
|
||||
this.btn_bandelete.Click += new System.EventHandler(this.btn_bandelete_Click);
|
||||
//
|
||||
// txt_banname
|
||||
//
|
||||
this.txt_banname.Location = new System.Drawing.Point(74, 49);
|
||||
this.txt_banname.Name = "txt_banname";
|
||||
this.txt_banname.ReadOnly = true;
|
||||
this.txt_banname.Size = new System.Drawing.Size(220, 20);
|
||||
this.txt_banname.TabIndex = 7;
|
||||
//
|
||||
// label19
|
||||
//
|
||||
this.label19.AutoSize = true;
|
||||
this.label19.Location = new System.Drawing.Point(21, 78);
|
||||
this.label19.Name = "label19";
|
||||
this.label19.Size = new System.Drawing.Size(47, 13);
|
||||
this.label19.TabIndex = 5;
|
||||
this.label19.Text = "Reason:";
|
||||
//
|
||||
// txt_banreason
|
||||
//
|
||||
this.txt_banreason.Location = new System.Drawing.Point(74, 75);
|
||||
this.txt_banreason.Multiline = true;
|
||||
this.txt_banreason.Name = "txt_banreason";
|
||||
this.txt_banreason.Size = new System.Drawing.Size(220, 20);
|
||||
this.txt_banreason.TabIndex = 8;
|
||||
this.txt_banreason.TextChanged += new System.EventHandler(this.txt_banreason_TextChanged);
|
||||
//
|
||||
// label18
|
||||
//
|
||||
this.label18.AutoSize = true;
|
||||
this.label18.Location = new System.Drawing.Point(30, 52);
|
||||
this.label18.Name = "label18";
|
||||
this.label18.Size = new System.Drawing.Size(38, 13);
|
||||
this.label18.TabIndex = 4;
|
||||
this.label18.Text = "Name:";
|
||||
//
|
||||
// tabControl1
|
||||
//
|
||||
this.tabControl1.Controls.Add(this.tabPage3);
|
||||
|
|
@ -380,9 +893,9 @@
|
|||
//
|
||||
this.tabPage4.Controls.Add(this.btn_connect);
|
||||
this.tabPage4.Controls.Add(this.label9);
|
||||
this.tabPage4.Controls.Add(this.txt_password);
|
||||
this.tabPage4.Controls.Add(this.txt_dbpassword);
|
||||
this.tabPage4.Controls.Add(this.label8);
|
||||
this.tabPage4.Controls.Add(this.txt_username);
|
||||
this.tabPage4.Controls.Add(this.txt_dbusername);
|
||||
this.tabPage4.Controls.Add(this.txt_port);
|
||||
this.tabPage4.Controls.Add(this.txt_dbname);
|
||||
this.tabPage4.Controls.Add(this.txt_hostname);
|
||||
|
|
@ -416,12 +929,12 @@
|
|||
this.label9.TabIndex = 9;
|
||||
this.label9.Text = "Password:";
|
||||
//
|
||||
// txt_password
|
||||
// txt_dbpassword
|
||||
//
|
||||
this.txt_password.Location = new System.Drawing.Point(272, 33);
|
||||
this.txt_password.Name = "txt_password";
|
||||
this.txt_password.Size = new System.Drawing.Size(100, 20);
|
||||
this.txt_password.TabIndex = 8;
|
||||
this.txt_dbpassword.Location = new System.Drawing.Point(272, 33);
|
||||
this.txt_dbpassword.Name = "txt_dbpassword";
|
||||
this.txt_dbpassword.Size = new System.Drawing.Size(100, 20);
|
||||
this.txt_dbpassword.TabIndex = 8;
|
||||
//
|
||||
// label8
|
||||
//
|
||||
|
|
@ -432,12 +945,12 @@
|
|||
this.label8.TabIndex = 7;
|
||||
this.label8.Text = "Username:";
|
||||
//
|
||||
// txt_username
|
||||
// txt_dbusername
|
||||
//
|
||||
this.txt_username.Location = new System.Drawing.Point(272, 7);
|
||||
this.txt_username.Name = "txt_username";
|
||||
this.txt_username.Size = new System.Drawing.Size(100, 20);
|
||||
this.txt_username.TabIndex = 6;
|
||||
this.txt_dbusername.Location = new System.Drawing.Point(272, 7);
|
||||
this.txt_dbusername.Name = "txt_dbusername";
|
||||
this.txt_dbusername.Size = new System.Drawing.Size(100, 20);
|
||||
this.txt_dbusername.TabIndex = 6;
|
||||
//
|
||||
// txt_port
|
||||
//
|
||||
|
|
@ -489,24 +1002,6 @@
|
|||
this.label5.TabIndex = 0;
|
||||
this.label5.Text = "Hostname:";
|
||||
//
|
||||
// label12
|
||||
//
|
||||
this.label12.AutoSize = true;
|
||||
this.label12.Location = new System.Drawing.Point(215, 8);
|
||||
this.label12.Name = "label12";
|
||||
this.label12.Size = new System.Drawing.Size(65, 13);
|
||||
this.label12.TabIndex = 24;
|
||||
this.label12.Text = "Group Child:";
|
||||
//
|
||||
// lbl_grpchild
|
||||
//
|
||||
this.lbl_grpchild.AutoSize = true;
|
||||
this.lbl_grpchild.Location = new System.Drawing.Point(286, 8);
|
||||
this.lbl_grpchild.Name = "lbl_grpchild";
|
||||
this.lbl_grpchild.Size = new System.Drawing.Size(16, 13);
|
||||
this.lbl_grpchild.TabIndex = 25;
|
||||
this.lbl_grpchild.Text = " ";
|
||||
//
|
||||
// TShockDBEditor
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
|
@ -516,11 +1011,27 @@
|
|||
this.Controls.Add(this.tabControl);
|
||||
this.Name = "TShockDBEditor";
|
||||
this.Text = "TShockDBEditor";
|
||||
this.Load += new System.EventHandler(this.TShockDBEditor_Load);
|
||||
this.tabControl.ResumeLayout(false);
|
||||
this.tabPage1.ResumeLayout(false);
|
||||
this.tabPage1.PerformLayout();
|
||||
this.tabPage2.ResumeLayout(false);
|
||||
this.tabPage2.PerformLayout();
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.groupBox2.PerformLayout();
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.tabPage5.ResumeLayout(false);
|
||||
this.groupBox4.ResumeLayout(false);
|
||||
this.groupBox4.PerformLayout();
|
||||
this.groupBox3.ResumeLayout(false);
|
||||
this.groupBox3.PerformLayout();
|
||||
this.tabPage6.ResumeLayout(false);
|
||||
this.groupBox7.ResumeLayout(false);
|
||||
this.groupBox6.ResumeLayout(false);
|
||||
this.groupBox6.PerformLayout();
|
||||
this.groupBox5.ResumeLayout(false);
|
||||
this.groupBox5.PerformLayout();
|
||||
this.tabControl1.ResumeLayout(false);
|
||||
this.tabPage3.ResumeLayout(false);
|
||||
this.tabPage4.ResumeLayout(false);
|
||||
|
|
@ -558,9 +1069,9 @@
|
|||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.Button btn_connect;
|
||||
private System.Windows.Forms.Label label9;
|
||||
private System.Windows.Forms.TextBox txt_password;
|
||||
private System.Windows.Forms.TextBox txt_dbpassword;
|
||||
private System.Windows.Forms.Label label8;
|
||||
private System.Windows.Forms.TextBox txt_username;
|
||||
private System.Windows.Forms.TextBox txt_dbusername;
|
||||
private System.Windows.Forms.TextBox txt_port;
|
||||
private System.Windows.Forms.TextBox txt_dbname;
|
||||
private System.Windows.Forms.TextBox txt_hostname;
|
||||
|
|
@ -574,6 +1085,51 @@
|
|||
private System.Windows.Forms.Label label10;
|
||||
private System.Windows.Forms.Label lbl_grpchild;
|
||||
private System.Windows.Forms.Label label12;
|
||||
private System.Windows.Forms.TabPage tabPage5;
|
||||
private System.Windows.Forms.Label label14;
|
||||
private System.Windows.Forms.Label label13;
|
||||
private System.Windows.Forms.ListBox lst_userlist;
|
||||
private System.Windows.Forms.ComboBox lst_usergrplist;
|
||||
private System.Windows.Forms.TabPage tabPage6;
|
||||
private System.Windows.Forms.ListBox lst_bans;
|
||||
private System.Windows.Forms.Label label18;
|
||||
private System.Windows.Forms.Label label17;
|
||||
private System.Windows.Forms.TextBox txt_banreason;
|
||||
private System.Windows.Forms.TextBox txt_banname;
|
||||
private System.Windows.Forms.TextBox txt_banip;
|
||||
private System.Windows.Forms.Label label19;
|
||||
private System.Windows.Forms.Button btn_bannew;
|
||||
private System.Windows.Forms.Button btn_bandelete;
|
||||
private System.Windows.Forms.Label label21;
|
||||
private System.Windows.Forms.Button btn_deluser;
|
||||
private System.Windows.Forms.Label label23;
|
||||
private System.Windows.Forms.TextBox txt_userip;
|
||||
private System.Windows.Forms.TextBox txt_userpass;
|
||||
private System.Windows.Forms.TextBox txt_username;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.GroupBox groupBox3;
|
||||
private System.Windows.Forms.GroupBox groupBox4;
|
||||
private System.Windows.Forms.Button btn_adduser;
|
||||
private System.Windows.Forms.Label label20;
|
||||
private System.Windows.Forms.Label label22;
|
||||
private System.Windows.Forms.TextBox txt_newusername;
|
||||
private System.Windows.Forms.TextBox txt_newuserpass;
|
||||
private System.Windows.Forms.TextBox txt_newuserip;
|
||||
private System.Windows.Forms.ComboBox lst_newusergrplist;
|
||||
private System.Windows.Forms.Label label24;
|
||||
private System.Windows.Forms.Label label25;
|
||||
private System.Windows.Forms.Label lbl_useraddstatus;
|
||||
private System.Windows.Forms.GroupBox groupBox6;
|
||||
private System.Windows.Forms.GroupBox groupBox5;
|
||||
private System.Windows.Forms.Label label16;
|
||||
private System.Windows.Forms.TextBox txt_newbanip;
|
||||
private System.Windows.Forms.TextBox txt_newbanreason;
|
||||
private System.Windows.Forms.TextBox txt_newbanname;
|
||||
private System.Windows.Forms.Label label27;
|
||||
private System.Windows.Forms.Label label26;
|
||||
private System.Windows.Forms.Label lbl_newbanstatus;
|
||||
private System.Windows.Forms.GroupBox groupBox7;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
492
DBEditor/Main.cs
492
DBEditor/Main.cs
|
|
@ -6,6 +6,7 @@ using System.Drawing;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using Community.CsharpSqlite.SQLiteClient;
|
||||
using MySql.Data.MySqlClient;
|
||||
|
||||
|
|
@ -17,6 +18,7 @@ namespace TShockDBEditor
|
|||
{
|
||||
public OpenFileDialog dialog = new OpenFileDialog();
|
||||
public List<Group> groups = new List<Group>();
|
||||
public static List<string> CommandList = new List<string>();
|
||||
public IDbConnection DB;
|
||||
public string dbtype = "";
|
||||
|
||||
|
|
@ -24,103 +26,123 @@ namespace TShockDBEditor
|
|||
{
|
||||
InitializeComponent();
|
||||
Itemlist.AddItems();
|
||||
Commandlist.AddCommands();
|
||||
dialog.FileOk += new CancelEventHandler(dialog_FileOk);
|
||||
dialog.Filter = "SQLite Database (*.sqlite)|*.sqlite";
|
||||
}
|
||||
|
||||
public void LoadDB()
|
||||
{
|
||||
|
||||
itemListBanned.Items.Clear();
|
||||
lst_groupList.Items.Clear();
|
||||
lst_AvailableCmds.Items.Clear();
|
||||
lst_bannedCmds.Items.Clear();
|
||||
itemListAvailable.Items.Clear();
|
||||
|
||||
using (var com = DB.CreateCommand())
|
||||
{
|
||||
com.CommandText =
|
||||
"SELECT * FROM Itembans";
|
||||
|
||||
using (var reader = com.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
itemListBanned.Items.Add(reader.Get<string>("ItemName"));
|
||||
}
|
||||
}
|
||||
|
||||
using (var com = DB.CreateCommand())
|
||||
{
|
||||
com.CommandText =
|
||||
"SELECT * FROM GroupList";
|
||||
|
||||
lst_groupList.Items.Add("superadmin");
|
||||
lst_usergrplist.Items.Add("superadmin");
|
||||
lst_newusergrplist.Items.Add("superadmin");
|
||||
using (var reader = com.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
lst_groupList.Items.Add(reader.Get<string>("GroupName"));
|
||||
lst_inheritgrps.Items.Add(reader.Get<string>("GroupName"));
|
||||
lst_usergrplist.Items.Add(reader.Get<string>("GroupName"));
|
||||
lst_newusergrplist.Items.Add(reader.Get<string>("GroupName"));
|
||||
}
|
||||
}
|
||||
|
||||
using (var reader = com.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
foreach (string command in reader.Get<string>("Commands").Split(','))
|
||||
{
|
||||
if (!lst_groupList.Items.Contains(command))
|
||||
if (!CommandList.Contains(command))
|
||||
CommandList.Add(command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TShockCommandsList.AddRemainingTShockCommands();
|
||||
}
|
||||
using (var com = DB.CreateCommand())
|
||||
{
|
||||
com.CommandText =
|
||||
"SELECT * FROM Users";
|
||||
|
||||
using (var reader = com.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
if (reader.Get<string>("UserName") != "")
|
||||
lst_userlist.Items.Add(reader.Get<string>("UserName"));
|
||||
else
|
||||
lst_userlist.Items.Add(reader.Get<string>("IP"));
|
||||
}
|
||||
}
|
||||
}
|
||||
using (var com = DB.CreateCommand())
|
||||
{
|
||||
com.CommandText =
|
||||
"SELECT * FROM Bans";
|
||||
|
||||
using (var reader = com.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
lst_bans.Items.Add(reader.Get<string>("Name"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < Itemlist.ItemList.Count; i++)
|
||||
{
|
||||
if (!itemListBanned.Items.Contains(Itemlist.ItemList[i]))
|
||||
itemListAvailable.Items.Add(Itemlist.ItemList[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadSqliteDatabase(string path)
|
||||
{
|
||||
string sql = dialog.FileName;
|
||||
DB = new SqliteConnection(string.Format("uri=file://{0},Version=3", sql));
|
||||
DB.Open();
|
||||
dbtype = "sqlite";
|
||||
itemListBanned.Items.Clear();
|
||||
lst_groupList.Items.Clear();
|
||||
lst_AvailableCmds.Items.Clear();
|
||||
lst_bannedCmds.Items.Clear();
|
||||
itemListAvailable.Items.Clear();
|
||||
|
||||
using (var com = DB.CreateCommand())
|
||||
{
|
||||
com.CommandText =
|
||||
"SELECT * FROM Itembans";
|
||||
|
||||
using (var reader = com.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
itemListBanned.Items.Add(reader.Get<string>("ItemName"));
|
||||
}
|
||||
}
|
||||
using (var com = DB.CreateCommand())
|
||||
{
|
||||
com.CommandText =
|
||||
"SELECT * FROM GroupList";
|
||||
|
||||
using (var reader = com.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
lst_groupList.Items.Add(reader.Get<string>("GroupName"));
|
||||
lst_inheritgrps.Items.Add(reader.Get<string>("GroupName"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < Itemlist.ItemList.Count; i++)
|
||||
{
|
||||
if (!itemListBanned.Items.Contains(Itemlist.ItemList[i]))
|
||||
itemListAvailable.Items.Add(Itemlist.ItemList[i]);
|
||||
}
|
||||
LoadDB();
|
||||
}
|
||||
|
||||
public void LoadMySqlDatabase(string hostname = "localhost", string port = "3306", string database = "", string username = "", string password = "")
|
||||
public void LoadMySqlDatabase(string hostname = "localhost", string port = "3306", string database = "", string dbusername = "", string dbpassword = "")
|
||||
{
|
||||
DB = new MySqlConnection();
|
||||
DB.ConnectionString =
|
||||
"Server='" + hostname +
|
||||
"';Port='" + port +
|
||||
"';Database='" + database +
|
||||
"';Uid='" + username +
|
||||
"';Pwd='" + password + "';";
|
||||
"';Uid='" + dbusername +
|
||||
"';Pwd='" + dbpassword + "';";
|
||||
DB.Open();
|
||||
dbtype = "mysql";
|
||||
itemListBanned.Items.Clear();
|
||||
lst_groupList.Items.Clear();
|
||||
lst_AvailableCmds.Items.Clear();
|
||||
lst_bannedCmds.Items.Clear();
|
||||
itemListAvailable.Items.Clear();
|
||||
|
||||
using (var com = DB.CreateCommand())
|
||||
{
|
||||
com.CommandText =
|
||||
"SELECT * FROM Itembans";
|
||||
|
||||
using (var reader = com.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
itemListBanned.Items.Add(reader.Get<string>("ItemName"));
|
||||
}
|
||||
}
|
||||
using (var com = DB.CreateCommand())
|
||||
{
|
||||
com.CommandText =
|
||||
"SELECT * FROM GroupList";
|
||||
|
||||
using (var reader = com.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
lst_groupList.Items.Add(reader.Get<string>("GroupName"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < Itemlist.ItemList.Count; i++)
|
||||
{
|
||||
if (!itemListBanned.Items.Contains(Itemlist.ItemList[i]))
|
||||
itemListAvailable.Items.Add(Itemlist.ItemList[i]);
|
||||
}
|
||||
LoadDB();
|
||||
}
|
||||
|
||||
#region BannedItemsTab
|
||||
|
|
@ -197,7 +219,10 @@ namespace TShockDBEditor
|
|||
|
||||
private void lst_groupList_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
UpdateGroupIndex(lst_groupList.SelectedIndex);
|
||||
if ((string)lst_groupList.SelectedItem != "superadmin")
|
||||
UpdateGroupIndex(lst_groupList.SelectedIndex);
|
||||
else
|
||||
lst_groupList.SelectedIndex = -1;
|
||||
}
|
||||
|
||||
private void UpdateGroupIndex(int index)
|
||||
|
|
@ -232,10 +257,10 @@ namespace TShockDBEditor
|
|||
if (lbl_grpchild.Text == "")
|
||||
lbl_grpchild.Text = "none";
|
||||
|
||||
for (int i = 0; i < Commandlist.CommandList.Count; i++)
|
||||
for (int i = 0; i < CommandList.Count; i++)
|
||||
{
|
||||
if (!lst_AvailableCmds.Items.Contains(Commandlist.CommandList[i]))
|
||||
lst_bannedCmds.Items.Add(Commandlist.CommandList[i]);
|
||||
if (!lst_AvailableCmds.Items.Contains(CommandList[i]))
|
||||
lst_bannedCmds.Items.Add(CommandList[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -361,7 +386,7 @@ namespace TShockDBEditor
|
|||
com.CommandText = "INSERT IGNORE INTO GroupList SET GroupName=@groupname, Commands=@commands;";
|
||||
com.AddParameter("@groupname", txt_grpname.Text);
|
||||
|
||||
if(lst_inheritgrps.SelectedIndex > -1)
|
||||
if (lst_inheritgrps.SelectedIndex > -1)
|
||||
com.AddParameter("@commands", lst_inheritgrps.Items[lst_inheritgrps.SelectedIndex]);
|
||||
else
|
||||
com.AddParameter("@commands", "");
|
||||
|
|
@ -372,6 +397,7 @@ namespace TShockDBEditor
|
|||
{
|
||||
lst_groupList.Items.Add(txt_grpname.Text);
|
||||
lst_inheritgrps.Items.Add(txt_grpname.Text);
|
||||
lst_usergrplist.Items.Add(txt_grpname.Text);
|
||||
txt_grpname.Text = "";
|
||||
}
|
||||
}
|
||||
|
|
@ -396,6 +422,7 @@ namespace TShockDBEditor
|
|||
lst_groupList.Items.Remove(lst_groupList.Items[lst_groupList.SelectedIndex]);
|
||||
|
||||
lst_inheritgrps.Items.Clear();
|
||||
lst_usergrplist.Items.Clear();
|
||||
com.CommandText =
|
||||
"SELECT * FROM GroupList";
|
||||
using (var reader = com.ExecuteReader())
|
||||
|
|
@ -403,6 +430,7 @@ namespace TShockDBEditor
|
|||
while (reader.Read())
|
||||
{
|
||||
lst_inheritgrps.Items.Add(reader.Get<string>("GroupName"));
|
||||
lst_usergrplist.Items.Add(reader.Get<string>("GroupName"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -427,10 +455,306 @@ namespace TShockDBEditor
|
|||
|
||||
private void btn_connect_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadMySqlDatabase(txt_hostname.Text, txt_port.Text, txt_dbname.Text, txt_username.Text, txt_password.Text);
|
||||
LoadMySqlDatabase(txt_hostname.Text, txt_port.Text, txt_dbname.Text, txt_dbusername.Text, txt_dbpassword.Text);
|
||||
tabControl.Visible = true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region BansTab
|
||||
|
||||
private void lst_bans_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
using (var com = DB.CreateCommand())
|
||||
{
|
||||
if (lst_bans.SelectedIndex > -1)
|
||||
{
|
||||
com.CommandText =
|
||||
"SELECT * FROM Bans WHERE Name=@name";
|
||||
com.AddParameter("@name", lst_bans.Items[lst_bans.SelectedIndex]);
|
||||
|
||||
using (var reader = com.ExecuteReader())
|
||||
{
|
||||
if (reader.Read())
|
||||
{
|
||||
txt_banip.Text = reader.Get<string>("IP");
|
||||
txt_banname.Text = reader.Get<string>("Name");
|
||||
txt_banreason.Text = reader.Get<string>("Reason");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void btn_bandelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (var com = DB.CreateCommand())
|
||||
{
|
||||
com.CommandText =
|
||||
"DELETE FROM Bans WHERE IP=@ip";
|
||||
com.AddParameter("@ip", txt_banip.Text);
|
||||
|
||||
using (var reader = com.ExecuteReader())
|
||||
{
|
||||
if (reader.RecordsAffected > 0)
|
||||
{
|
||||
txt_banip.Text = "";
|
||||
txt_banname.Text = "";
|
||||
txt_banreason.Text = "";
|
||||
lst_bans.Items.Remove(lst_bans.Items[lst_bans.SelectedIndex]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void btn_bannew_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (var com = DB.CreateCommand())
|
||||
{
|
||||
if (dbtype == "sqlite")
|
||||
com.CommandText = "INSERT INTO Bans (IP, Name, Reason) VALUES (@ip, @name, @reason);";
|
||||
else if (dbtype == "mysql")
|
||||
com.CommandText = "INSERT INTO Bans SET IP=@ip, Name=@name, Reason=@reason;";
|
||||
if (txt_newbanip.Text != "" && txt_newbanname.Text != "")
|
||||
{
|
||||
com.AddParameter("@ip", txt_newbanip.Text);
|
||||
com.AddParameter("@name", txt_newbanname.Text);
|
||||
com.AddParameter("@reason", txt_newbanreason.Text);
|
||||
com.ExecuteNonQuery();
|
||||
|
||||
lst_bans.Items.Add(txt_newbanname.Text);
|
||||
txt_newbanip.Text = "";
|
||||
txt_newbanname.Text = "";
|
||||
txt_newbanreason.Text = "";
|
||||
lbl_newbanstatus.Text = "Ban added successfully!";
|
||||
}
|
||||
else
|
||||
lbl_newbanstatus.Text = "Required field('s) empty";
|
||||
|
||||
lst_bans.Items.Add(txt_newbanname.Text);
|
||||
txt_newbanip.Text = "";
|
||||
txt_newbanname.Text = "";
|
||||
}
|
||||
}
|
||||
|
||||
private void txt_banreason_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (txt_banip.Text != "")
|
||||
{
|
||||
using (var com = DB.CreateCommand())
|
||||
{
|
||||
com.CommandText =
|
||||
"UPDATE Bans SET Reason=@reason WHERE IP=@ip";
|
||||
com.AddParameter("@reason", txt_banreason.Text);
|
||||
com.AddParameter("@ip", txt_banip.Text);
|
||||
com.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region UserTab
|
||||
|
||||
private void lst_userlist_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
txt_username.Text = "None Selected";
|
||||
txt_userip.Text = "None Selected";
|
||||
lst_usergrplist.SelectedIndex = -1;
|
||||
bool flag = false;
|
||||
|
||||
|
||||
if (lst_userlist.SelectedIndex > -1)
|
||||
{
|
||||
using (var com = DB.CreateCommand())
|
||||
{
|
||||
com.CommandText =
|
||||
"SELECT * FROM Users WHERE Username=@name";
|
||||
com.AddParameter("@name", lst_userlist.Items[lst_userlist.SelectedIndex]);
|
||||
|
||||
using (var reader = com.ExecuteReader())
|
||||
{
|
||||
if (reader.Read())
|
||||
{
|
||||
txt_username.Text = reader.Get<string>("Username");
|
||||
|
||||
if (reader.Get<string>("IP") != "")
|
||||
txt_userip.Text = reader.Get<string>("IP");
|
||||
else
|
||||
txt_userip.Text = "User does not have IP";
|
||||
|
||||
if (reader.Get<string>("Password") != "")
|
||||
txt_userpass.Text = reader.Get<string>("Password");
|
||||
else
|
||||
txt_userpass.Text = "User does not have Pasword";
|
||||
|
||||
foreach (string name in lst_usergrplist.Items)
|
||||
{
|
||||
if (name == reader.Get<string>("Usergroup"))
|
||||
{
|
||||
lst_usergrplist.SelectedItem = name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
using (var com = DB.CreateCommand())
|
||||
{
|
||||
com.CommandText =
|
||||
"SELECT * FROM Users WHERE IP=@ip";
|
||||
com.AddParameter("@ip", lst_userlist.Items[lst_userlist.SelectedIndex]);
|
||||
|
||||
using (var reader = com.ExecuteReader())
|
||||
{
|
||||
if (reader.Read())
|
||||
{
|
||||
if (reader.Get<string>("Password") != "")
|
||||
txt_userpass.Text = reader.Get<string>("Password");
|
||||
else
|
||||
txt_userpass.Text = "User does not have Pasword";
|
||||
|
||||
txt_userip.Text = lst_userlist.Items[lst_userlist.SelectedIndex].ToString();
|
||||
|
||||
foreach (string name in lst_usergrplist.Items)
|
||||
{
|
||||
if (name == reader.Get<string>("Usergroup"))
|
||||
{
|
||||
lst_usergrplist.SelectedItem = name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void lst_usergrplist_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (lst_userlist.SelectedIndex > -1)
|
||||
{
|
||||
using (var com = DB.CreateCommand())
|
||||
{
|
||||
com.CommandText =
|
||||
"UPDATE Users SET Usergroup=@group WHERE Username=@user OR IP=@ip";
|
||||
com.AddParameter("@group", lst_usergrplist.SelectedItem);
|
||||
com.AddParameter("@user", txt_username.Text);
|
||||
com.AddParameter("@ip", txt_userip.Text);
|
||||
com.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void btn_deluser_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (lst_userlist.SelectedIndex > -1)
|
||||
{
|
||||
using (var com = DB.CreateCommand())
|
||||
{
|
||||
com.CommandText =
|
||||
"DELETE FROM Users WHERE IP=@ip OR Username=@user";
|
||||
com.AddParameter("@user", txt_username.Text);
|
||||
com.AddParameter("@ip", txt_userip.Text);
|
||||
com.ExecuteNonQuery();
|
||||
lst_userlist.Items.Remove(lst_userlist.SelectedItem);
|
||||
txt_userip.Text = "";
|
||||
txt_username.Text = "";
|
||||
txt_userpass.Text = "";
|
||||
lst_usergrplist.SelectedIndex = -1;
|
||||
lst_userlist.SelectedIndex = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void btn_adduser_Click(object sender, EventArgs e)
|
||||
{
|
||||
lbl_useraddstatus.Visible = true;
|
||||
|
||||
for (int i = 0; i == 0; i++)
|
||||
{
|
||||
|
||||
if ((txt_newusername.Text == "" && txt_newuserpass.Text != ""))
|
||||
{
|
||||
lbl_useraddstatus.Text = "Username field cannot be empty";
|
||||
break;
|
||||
}
|
||||
|
||||
if ((txt_newusername.Text != "" && txt_newuserpass.Text == ""))
|
||||
{
|
||||
lbl_useraddstatus.Text = "Password field cannot be empty";
|
||||
break;
|
||||
}
|
||||
|
||||
if (txt_newuserip.Text == "" && (txt_newusername.Text == "" || txt_newuserpass.Text == ""))
|
||||
{
|
||||
lbl_useraddstatus.Text = "IP field cannot be empty";
|
||||
break;
|
||||
}
|
||||
|
||||
if (lst_newusergrplist.SelectedIndex == -1)
|
||||
{
|
||||
lbl_useraddstatus.Text = "Group must be selected";
|
||||
break;
|
||||
}
|
||||
|
||||
using (var com = DB.CreateCommand())
|
||||
{
|
||||
com.CommandText = "INSERT INTO Users (Username, Password, UserGroup, IP) VALUES (@name, @password, @group, @ip);";
|
||||
com.AddParameter("@name", txt_newusername.Text);
|
||||
com.AddParameter("@password", HashPassword(txt_newuserpass.Text));
|
||||
|
||||
com.AddParameter("@group", lst_newusergrplist.SelectedItem);
|
||||
com.AddParameter("@ip", txt_newuserip.Text);
|
||||
|
||||
using (var reader = com.ExecuteReader())
|
||||
{
|
||||
if (reader.RecordsAffected > 0)
|
||||
{
|
||||
if (txt_newusername.Text != "")
|
||||
lst_userlist.Items.Add(txt_newusername.Text);
|
||||
else
|
||||
lst_userlist.Items.Add(txt_newuserip.Text);
|
||||
|
||||
txt_newuserip.Text = "";
|
||||
txt_newusername.Text = "";
|
||||
txt_newuserpass.Text = "";
|
||||
lst_newusergrplist.SelectedIndex = -1;
|
||||
|
||||
lbl_useraddstatus.Text = "User added successfully!";
|
||||
}
|
||||
else
|
||||
lbl_useraddstatus.Text = "SQL error while adding user";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static string HashPassword(string password)
|
||||
{
|
||||
using (var sha = new SHA512CryptoServiceProvider())
|
||||
{
|
||||
if (password == "")
|
||||
{
|
||||
return "nonexistent-password";
|
||||
}
|
||||
var bytes = sha.ComputeHash(Encoding.ASCII.GetBytes(password));
|
||||
return bytes.Aggregate("", (s, b) => s + b.ToString("X2"));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void TShockDBEditor_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -74,8 +74,8 @@
|
|||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Group.cs" />
|
||||
<Compile Include="CommandList.cs" />
|
||||
<Compile Include="Group.cs" />
|
||||
<Compile Include="DbExt.cs" />
|
||||
<Compile Include="Main.cs">
|
||||
<SubType>Form</SubType>
|
||||
|
|
|
|||
|
|
@ -140,6 +140,8 @@ namespace TShockAPI
|
|||
ChatCommands.Add(new Command("managegroup", AddGroup, "addGroup"));
|
||||
ChatCommands.Add(new Command("managegroup", DeleteGroup, "delGroup"));
|
||||
ChatCommands.Add(new Command("managegroup", ModifyGroup, "modGroup"));
|
||||
ChatCommands.Add(new Command("manageitem", AddItem, "addItem"));
|
||||
ChatCommands.Add(new Command("manageitem", DeleteItem, "delItem"));
|
||||
ChatCommands.Add(new Command("cfg", SetSpawn, "setspawn"));
|
||||
ChatCommands.Add(new Command("cfg", Reload, "reload"));
|
||||
ChatCommands.Add(new Command("cfg", ShowConfiguration, "showconfig"));
|
||||
|
|
@ -1349,6 +1351,76 @@ namespace TShockAPI
|
|||
|
||||
#endregion Group Management
|
||||
|
||||
#region Item Management
|
||||
|
||||
private static void AddItem(CommandArgs args)
|
||||
{
|
||||
if (args.Parameters.Count > 0)
|
||||
{
|
||||
var items = Tools.GetItemByIdOrName(args.Parameters[0]);
|
||||
if (items.Count == 0)
|
||||
{
|
||||
args.Player.SendMessage("Invalid item type!", Color.Red);
|
||||
}
|
||||
else if (items.Count > 1)
|
||||
{
|
||||
args.Player.SendMessage(string.Format("More than one ({0}) item matched!", items.Count), Color.Red);
|
||||
}
|
||||
else
|
||||
{
|
||||
var item = items[0];
|
||||
if (item.type >= 1)
|
||||
{
|
||||
TShock.Itembans.AddNewBan(args.Parameters[0]);
|
||||
args.Player.SendMessage(Tools.GetItemByIdOrName(args.Parameters[0])[0].name + " has been banned.", Color.Green);
|
||||
}
|
||||
else
|
||||
{
|
||||
args.Player.SendMessage("Invalid item type!", Color.Red);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
args.Player.SendMessage("Invalid use: /addItem \"item name\" or /addItem ##", Color.Red);
|
||||
}
|
||||
}
|
||||
|
||||
private static void DeleteItem(CommandArgs args)
|
||||
{
|
||||
if (args.Parameters.Count > 0)
|
||||
{
|
||||
var items = Tools.GetItemByIdOrName(args.Parameters[0]);
|
||||
if (items.Count == 0)
|
||||
{
|
||||
args.Player.SendMessage("Invalid item type!", Color.Red);
|
||||
}
|
||||
else if (items.Count > 1)
|
||||
{
|
||||
args.Player.SendMessage(string.Format("More than one ({0}) item matched!", items.Count), Color.Red);
|
||||
}
|
||||
else
|
||||
{
|
||||
var item = items[0];
|
||||
if (item.type >= 1)
|
||||
{
|
||||
TShock.Itembans.RemoveBan(args.Parameters[0]);
|
||||
args.Player.SendMessage(Tools.GetItemByIdOrName(args.Parameters[0])[0].name + " has been unbanned.", Color.Green);
|
||||
}
|
||||
else
|
||||
{
|
||||
args.Player.SendMessage("Invalid item type!", Color.Red);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
args.Player.SendMessage("Invalid use: /delItem \"item name\" or /delItem ##", Color.Red);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Item Management
|
||||
|
||||
#region Server Config Commands
|
||||
|
||||
private static void SetSpawn(CommandArgs args)
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ namespace TShockAPI.DB
|
|||
{typeof(decimal), (s, i) => s.GetDecimal(i)},
|
||||
{typeof(float), (s, i) => s.GetFloat(i)},
|
||||
{typeof(double), (s, i) => s.GetDouble(i)},
|
||||
{typeof(object), (s, i) => s.GetValue(i)},
|
||||
};
|
||||
|
||||
public static T Get<T>(this IDataReader reader, string column)
|
||||
|
|
|
|||
|
|
@ -18,11 +18,16 @@ namespace TShockAPI.DB
|
|||
|
||||
string query;
|
||||
if (TShock.Config.StorageType.ToLower() == "sqlite")
|
||||
query =
|
||||
"CREATE TABLE IF NOT EXISTS 'GroupList' ('GroupName' TEXT PRIMARY KEY, 'Commands' TEXT, 'OrderBy' TEXT);";
|
||||
{
|
||||
db.Query("CREATE TABLE IF NOT EXISTS 'GroupList' (GroupName TEXT PRIMARY KEY, Commands TEXT, 'OrderBy' TEXT);");
|
||||
query = "CREATE TEMPORARY TABLE GroupList_backup('GroupName' TEXT PRIMARY KEY, 'Commands' TEXT); INSERT INTO GroupList_backup SELECT 'GroupName','Commands' FROM GroupList; DROP TABLE GroupList; CREATE TABLE IF NOT EXISTS GroupList('GroupName' TEXT PRIMARY KEY, 'Commands' TEXT); INSERT INTO 'GroupList' SELECT 'GroupName','Commands' FROM GroupList_backup; DROP TABLE GroupList_backup;";
|
||||
}
|
||||
else
|
||||
{
|
||||
query =
|
||||
"CREATE TABLE IF NOT EXISTS GroupList (GroupName VARCHAR(255) PRIMARY, Commands VARCHAR(255), OrderBy VARCHAR(255));";
|
||||
"CREATE TABLE IF NOT EXISTS GroupList (GroupName VARCHAR(255) PRIMARY, Commands VARCHAR(255));";
|
||||
db.Query("ALTER TABLE GroupList DROP COLUMN OrderBy");
|
||||
}
|
||||
|
||||
db.Query(query);
|
||||
|
||||
|
|
@ -46,10 +51,6 @@ namespace TShockAPI.DB
|
|||
String[] info = line.Split(' ');
|
||||
String comms = "";
|
||||
int size = info.Length;
|
||||
int test = 0;
|
||||
bool hasOrder = int.TryParse(info[info.Length - 1], out test);
|
||||
if (hasOrder)
|
||||
size = info.Length - 1;
|
||||
for (int i = 1; i < size; i++)
|
||||
{
|
||||
if (!comms.Equals(""))
|
||||
|
|
@ -58,11 +59,11 @@ namespace TShockAPI.DB
|
|||
}
|
||||
|
||||
if (TShock.Config.StorageType.ToLower() == "sqlite")
|
||||
query = "INSERT OR IGNORE INTO GroupList (GroupName, Commands, OrderBy) VALUES (@0, @1, @2);";
|
||||
query = "INSERT OR IGNORE INTO GroupList (GroupName, Commands) VALUES (@0, @1);";
|
||||
else if (TShock.Config.StorageType.ToLower() == "mysql")
|
||||
query = "INSERT IGNORE INTO GroupList SET GroupName=@0, Commands=@1, OrderBy=@2;";
|
||||
query = "INSERT IGNORE INTO GroupList SET GroupName=@0, Commands=@1;";
|
||||
|
||||
db.Query(query, info[0].Trim(), comms, hasOrder ? info[info.Length - 1] : "0");
|
||||
db.Query(query, info[0].Trim(), comms);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -105,12 +106,10 @@ namespace TShockAPI.DB
|
|||
if (GroupExists(name))
|
||||
return "Error: Group already exists. Use /modGroup to change permissions.";
|
||||
|
||||
|
||||
|
||||
string query = (TShock.Config.StorageType.ToLower() == "sqlite") ?
|
||||
"INSERT OR IGNORE INTO GroupList (GroupName, Commands, OrderBy) VALUES (@0, @1, @2);" :
|
||||
"INSERT IGNORE INTO GroupList SET GroupName=@0, Commands=@1, OrderBy=@2;";
|
||||
if (database.Query(query, name, permissions, "0") == 1)
|
||||
"INSERT OR IGNORE INTO GroupList (GroupName, Commands) VALUES (@0, @1);" :
|
||||
"INSERT IGNORE INTO GroupList SET GroupName=@0, Commands=@1";
|
||||
if (database.Query(query, name, permissions) == 1)
|
||||
message = "Group " + name + " has been created successfully.";
|
||||
Group g = new Group(name);
|
||||
g.permissions.Add(permissions);
|
||||
|
|
|
|||
|
|
@ -1,6 +0,0 @@
|
|||
namespace TShockAPI.DB
|
||||
{
|
||||
class SqlTable
|
||||
{
|
||||
}
|
||||
}
|
||||
317
TShockAPI/DBTools.cs
Normal file
317
TShockAPI/DBTools.cs
Normal file
|
|
@ -0,0 +1,317 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using TShockAPI.DB;
|
||||
|
||||
namespace TShockAPI
|
||||
{
|
||||
public class DBTools
|
||||
{
|
||||
internal static IDbConnection database;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a Table, within the current open DB
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the Table</param>
|
||||
/// <param name="columns">The list of columns that the Table will have</param>
|
||||
/// <param name="IfNotExists">Only try create Table if it does not exist</param>
|
||||
public static void CreateTable(string name, List<Column> columns, bool IfNotExists =true)
|
||||
{
|
||||
//Build up Creation string :)
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("CREATE TABLE ");
|
||||
|
||||
if (IfNotExists)
|
||||
sb.Append("IF NOT EXISTS ");
|
||||
|
||||
if (TShock.Config.StorageType.ToLower() == "sqlite")
|
||||
sb.Append("'" + name + "' (");
|
||||
else if (TShock.Config.StorageType.ToLower() == "mysql")
|
||||
sb.Append(name + " (");
|
||||
|
||||
int count = 0;
|
||||
|
||||
foreach (Column column in columns)
|
||||
{
|
||||
count++;
|
||||
if (column.Type.ToLower() == "int")
|
||||
{
|
||||
if (TShock.Config.StorageType.ToLower() == "sqlite")
|
||||
sb.Append(column.Name + " NUMERIC ");
|
||||
else if (TShock.Config.StorageType.ToLower() == "mysql")
|
||||
sb.Append(column.Name + " INT(255) ");
|
||||
}
|
||||
else if (column.Type.ToLower() == "string")
|
||||
{
|
||||
if (TShock.Config.StorageType.ToLower() == "sqlite")
|
||||
sb.Append(column.Name + " TEXT ");
|
||||
else if (TShock.Config.StorageType.ToLower() == "mysql")
|
||||
sb.Append(column.Name + " VARCHAR(255) ");
|
||||
}
|
||||
|
||||
if (column.Unique)
|
||||
sb.Append("UNIQUE");
|
||||
|
||||
if (columns.Count == count)
|
||||
sb.Append(")");
|
||||
else
|
||||
sb.Append(", ");
|
||||
}
|
||||
|
||||
database.Query(sb.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inserts a list of values into a Table, if conditions are met
|
||||
/// </summary>
|
||||
/// <param name="tablename">Name of the Table</param>
|
||||
/// <param name="Ignore">Ignore insert if feild is unique and there is already a exact entry</param>
|
||||
/// <param name="Values">The list of values to enter into the table</param>
|
||||
/// <param name="WhereStatements">The list of where statements that must be met, can be an empty list</param>
|
||||
public static int InsertTable(string tablename, bool Ignore, List<ColumnData> Values, List<ColumnData> WhereStatements)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("INSERT ");
|
||||
|
||||
if (Ignore)
|
||||
{
|
||||
if (TShock.Config.StorageType.ToLower() == "sqlite")
|
||||
sb.Append("OR IGNORE ");
|
||||
else if (TShock.Config.StorageType.ToLower() == "mysql")
|
||||
sb.Append("IGNORE ");
|
||||
}
|
||||
|
||||
if (TShock.Config.StorageType.ToLower() == "sqlite")
|
||||
sb.Append("INTO '" + tablename + "' (");
|
||||
else if (TShock.Config.StorageType.ToLower() == "mysql")
|
||||
sb.Append("INTO " + tablename + " ");
|
||||
|
||||
using (var com = database.CreateCommand())
|
||||
{
|
||||
//Values
|
||||
if (TShock.Config.StorageType.ToLower() == "sqlite")
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
foreach (ColumnData columnname in Values)
|
||||
{
|
||||
count++;
|
||||
if (Values.Count != count)
|
||||
sb.Append(columnname.Name + ", ");
|
||||
else
|
||||
sb.Append(columnname.Name + ") ");
|
||||
}
|
||||
|
||||
sb.Append("VALUES (");
|
||||
count = 0;
|
||||
|
||||
foreach (ColumnData columnname in Values)
|
||||
{
|
||||
count++;
|
||||
if (Values.Count != count)
|
||||
{
|
||||
sb.Append("@" + columnname.Name.ToLower() + ", ");
|
||||
com.AddParameter("@" + columnname.Name.ToLower(), columnname.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append("@" + columnname.Name.ToLower() + ") ");
|
||||
com.AddParameter("@" + columnname.Name.ToLower(), columnname.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (TShock.Config.StorageType.ToLower() == "mysql")
|
||||
{
|
||||
sb.Append("SET ");
|
||||
int count = 0;
|
||||
|
||||
foreach (ColumnData columnname in Values)
|
||||
{
|
||||
count++;
|
||||
if (Values.Count != count)
|
||||
{
|
||||
sb.Append("@" + columnname.Name.ToLower() + "=" + columnname.Value + ", ");
|
||||
com.AddParameter("@" + columnname.Name.ToLower(), columnname.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append("@" + columnname.Name.ToLower() + "=" + columnname.Value + ") ");
|
||||
com.AddParameter("@" + columnname.Name.ToLower(), columnname.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Where Statement (if any)
|
||||
if (WhereStatements.Count > 0)
|
||||
{
|
||||
sb.Append("WHERE ");
|
||||
int count = 0;
|
||||
|
||||
foreach (ColumnData columnname in WhereStatements)
|
||||
{
|
||||
count++;
|
||||
if (Values.Count != count)
|
||||
{
|
||||
sb.Append("@" + columnname.Name.ToLower() + "-where" + "=" + columnname.Value + " AND ");
|
||||
com.AddParameter("@" + columnname.Name.ToLower() + "-where", columnname.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append("@" + columnname.Name.ToLower() + "-where" + "=" + columnname.Value + ";");
|
||||
com.AddParameter("@" + columnname.Name.ToLower() + "-where", columnname.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
com.CommandText = sb.ToString();
|
||||
|
||||
using (var reader = com.ExecuteReader())
|
||||
return reader.RecordsAffected;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of values from a given Table, where conditions are met
|
||||
/// </summary>
|
||||
/// <param name="tablename">Name of the Table</param>
|
||||
/// <param name="getcolumn">The name of the column you are getting the values from</param>
|
||||
/// <param name="WhereStatements">The list of where statements that must be met, can be an empty list</param>
|
||||
public static List<object> ReadTable(string tablename, string getcolumn, List<ColumnData> WhereStatements)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
List<object> ReturnedValues = new List<object>();
|
||||
|
||||
sb.Append("SELECT * FROM " + tablename + " ");
|
||||
|
||||
using (var com = database.CreateCommand())
|
||||
{
|
||||
//Where Statement (if any)
|
||||
if (WhereStatements.Count > 0)
|
||||
{
|
||||
sb.Append("WHERE ");
|
||||
int count = 0;
|
||||
|
||||
foreach (ColumnData columnname in WhereStatements)
|
||||
{
|
||||
count++;
|
||||
if (WhereStatements.Count != count)
|
||||
{
|
||||
sb.Append(columnname.Name + " =" + columnname.Value + " AND ");
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append(columnname.Name + " =" + columnname.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
com.CommandText = sb.ToString();
|
||||
|
||||
using (var reader = com.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
ReturnedValues.Add(reader.Get<object>(getcolumn));
|
||||
}
|
||||
}
|
||||
return ReturnedValues;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets values in a Table, where statements are met
|
||||
/// </summary>
|
||||
/// <param name="tablename">Name of the Table</param>
|
||||
/// <param name="setcolumn">The column data you are setting</param>
|
||||
/// <param name="WhereStatements">The list of where statements that must be met, can be an empty list</param>
|
||||
public static int SetTable(string tablename, ColumnData setcolumn, List<ColumnData> WhereStatements)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.Append("UPDATE " + tablename + " SET " + setcolumn.Name + "=@setcolumn ");
|
||||
|
||||
using (var com = database.CreateCommand())
|
||||
{
|
||||
//Where Statement (if any)
|
||||
if (WhereStatements.Count > 0)
|
||||
{
|
||||
sb.Append("WHERE ");
|
||||
int count = 0;
|
||||
|
||||
foreach (ColumnData columnname in WhereStatements)
|
||||
{
|
||||
count++;
|
||||
if (WhereStatements.Count != count)
|
||||
{
|
||||
sb.Append(columnname.Name + " =" + columnname.Value + " AND ");
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append(columnname.Name + " =" + columnname.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
com.CommandText = sb.ToString();
|
||||
com.AddParameter("@setcolumn", setcolumn.Value);
|
||||
|
||||
using (var reader = com.ExecuteReader())
|
||||
return reader.RecordsAffected;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class Column
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Type { get; set; }
|
||||
public bool Unique { get; set; }
|
||||
public string Parameters { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The class for creating a new column type
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the column</param>
|
||||
/// <param name="unique">Whether there can be more than one exact value in the column</param>
|
||||
/// <param name="type">The type of column, currently the api only supports "string" or "int"</param>
|
||||
/// <param name="parameters">Extra SQL parameters given, can cause errors cross different SQL (SQLite and MySql)</param>
|
||||
public Column(string name, bool unique, string type, string parameters = "")
|
||||
{
|
||||
Name = name;
|
||||
Type = type;
|
||||
Unique = unique;
|
||||
Parameters = parameters;
|
||||
}
|
||||
|
||||
public Column()
|
||||
{
|
||||
Name = string.Empty;
|
||||
Type = string.Empty;
|
||||
Unique = false;
|
||||
Parameters = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public class ColumnData
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public object Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The class for testing, inserting or setting column data
|
||||
/// </summary>
|
||||
/// <param name="name">Column Name</param>
|
||||
/// <param name="value">Column Value</param>
|
||||
public ColumnData(string name, object value)
|
||||
{
|
||||
Name = name;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public ColumnData()
|
||||
{
|
||||
Name = string.Empty;
|
||||
Value = string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -20,13 +20,13 @@ using System.IO;
|
|||
|
||||
namespace TShockAPI
|
||||
{
|
||||
internal class FileTools
|
||||
public class FileTools
|
||||
{
|
||||
public static string RulesPath { get { return Path.Combine(TShock.SavePath, "rules.txt"); } }
|
||||
public static string MotdPath { get { return Path.Combine(TShock.SavePath, "motd.txt"); } }
|
||||
public static string WhitelistPath { get { return Path.Combine(TShock.SavePath, "whitelist.txt"); } }
|
||||
public static string RememberedPosPath { get { return Path.Combine(TShock.SavePath, "oldpos.xml"); } }
|
||||
public static string ConfigPath { get { return Path.Combine(TShock.SavePath, "config.json"); } }
|
||||
internal static string RulesPath { get { return Path.Combine(TShock.SavePath, "rules.txt"); } }
|
||||
internal static string MotdPath { get { return Path.Combine(TShock.SavePath, "motd.txt"); } }
|
||||
internal static string WhitelistPath { get { return Path.Combine(TShock.SavePath, "whitelist.txt"); } }
|
||||
internal static string RememberedPosPath { get { return Path.Combine(TShock.SavePath, "oldpos.xml"); } }
|
||||
internal static string ConfigPath { get { return Path.Combine(TShock.SavePath, "config.json"); } }
|
||||
|
||||
public static void CreateFile(string file)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -296,6 +296,12 @@ namespace TShockAPI
|
|||
NetMessage.SendData((int)PacketTypes.TogglePVP, -1, -1, "", Index);
|
||||
}
|
||||
|
||||
public virtual void SetTeam(int team)
|
||||
{
|
||||
Main.player[Index].team = team;
|
||||
SendData(PacketTypes.PlayerTeam, "", Index);
|
||||
}
|
||||
|
||||
public virtual void Whoopie(object time)
|
||||
{
|
||||
var time2 = (int)time;
|
||||
|
|
|
|||
|
|
@ -155,6 +155,8 @@ namespace TShockAPI
|
|||
throw new Exception("Invalid storage type");
|
||||
}
|
||||
|
||||
DBTools.database = DB;
|
||||
|
||||
Backups = new BackupManager(Path.Combine(SavePath, "backups"));
|
||||
Backups.KeepFor = Config.BackupKeepFor;
|
||||
Backups.Interval = Config.BackupInterval;
|
||||
|
|
@ -613,6 +615,8 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
|
||||
player.SendData(PacketTypes.WorldInfo);
|
||||
|
||||
Log.Info(string.Format("{0} ({1}) from '{2}' group joined.", player.Name, player.IP, player.Group.Name));
|
||||
|
||||
Tools.ShowFileToUser(player, "motd.txt");
|
||||
|
|
|
|||
|
|
@ -93,10 +93,10 @@
|
|||
<ItemGroup>
|
||||
<Compile Include="BackupManager.cs" />
|
||||
<Compile Include="DB\BanManager.cs" />
|
||||
<Compile Include="DBTools.cs" />
|
||||
<Compile Include="DB\ItemManager.cs" />
|
||||
<Compile Include="DB\DbExt.cs" />
|
||||
<Compile Include="DB\GroupManager.cs" />
|
||||
<Compile Include="DB\SqlTable.cs" />
|
||||
<Compile Include="DB\UserManager.cs" />
|
||||
<Compile Include="IPackable.cs" />
|
||||
<Compile Include="Commands.cs" />
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ using Terraria;
|
|||
|
||||
namespace TShockAPI
|
||||
{
|
||||
internal class Tools
|
||||
public class Tools
|
||||
{
|
||||
public static Random Random = new Random();
|
||||
//private static List<Group> groups = new List<Group>();
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#tphere - allow a player to teleport players to their position
|
||||
#managewarp - allow player to add/delete warp locations
|
||||
#managegroup - allow player to add/delete/modify groups
|
||||
#manageitem - allow a player to add/delete item bans
|
||||
#editspawn - allow player to enable/disable build protection
|
||||
#cfg - allow player to view/change tshock configuration
|
||||
#time - allow player to change time
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue