Something is working

This commit is contained in:
Christopher
2021-02-05 22:23:28 +01:00
parent 9f12e20478
commit bfe1970fdd
12 changed files with 87 additions and 34 deletions
Binary file not shown.
+19 -7
View File
@@ -52,6 +52,7 @@ namespace ServCreator
this.reasonIpTxt = new System.Windows.Forms.RichTextBox(); this.reasonIpTxt = new System.Windows.Forms.RichTextBox();
this.ipTxt = new System.Windows.Forms.TextBox(); this.ipTxt = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label();
this.serverLabel = new System.Windows.Forms.Label();
this.servMgmtBox.SuspendLayout(); this.servMgmtBox.SuspendLayout();
this.playerMgmtBox.SuspendLayout(); this.playerMgmtBox.SuspendLayout();
this.groupBox3.SuspendLayout(); this.groupBox3.SuspendLayout();
@@ -74,14 +75,14 @@ namespace ServCreator
this.outputText.BorderStyle = System.Windows.Forms.BorderStyle.None; this.outputText.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.outputText.Location = new System.Drawing.Point(175, 12); this.outputText.Location = new System.Drawing.Point(175, 12);
this.outputText.Name = "outputText"; this.outputText.Name = "outputText";
this.outputText.Size = new System.Drawing.Size(613, 462); this.outputText.Size = new System.Drawing.Size(613, 556);
this.outputText.TabIndex = 1; this.outputText.TabIndex = 1;
this.outputText.Text = ""; this.outputText.Text = "";
this.outputText.TextChanged += new System.EventHandler(this.outputChanged); this.outputText.TextChanged += new System.EventHandler(this.outputChanged);
// //
// commandInput // commandInput
// //
this.commandInput.Location = new System.Drawing.Point(175, 482); this.commandInput.Location = new System.Drawing.Point(175, 576);
this.commandInput.Name = "commandInput"; this.commandInput.Name = "commandInput";
this.commandInput.Size = new System.Drawing.Size(518, 20); this.commandInput.Size = new System.Drawing.Size(518, 20);
this.commandInput.TabIndex = 2; this.commandInput.TabIndex = 2;
@@ -89,7 +90,7 @@ namespace ServCreator
// //
// submit // submit
// //
this.submit.Location = new System.Drawing.Point(699, 480); this.submit.Location = new System.Drawing.Point(699, 574);
this.submit.Name = "submit"; this.submit.Name = "submit";
this.submit.Size = new System.Drawing.Size(89, 23); this.submit.Size = new System.Drawing.Size(89, 23);
this.submit.TabIndex = 3; this.submit.TabIndex = 3;
@@ -126,7 +127,7 @@ namespace ServCreator
this.servMgmtBox.Controls.Add(this.stopBtn); this.servMgmtBox.Controls.Add(this.stopBtn);
this.servMgmtBox.Controls.Add(this.editProperties); this.servMgmtBox.Controls.Add(this.editProperties);
this.servMgmtBox.ForeColor = System.Drawing.Color.White; this.servMgmtBox.ForeColor = System.Drawing.Color.White;
this.servMgmtBox.Location = new System.Drawing.Point(12, 12); this.servMgmtBox.Location = new System.Drawing.Point(12, 134);
this.servMgmtBox.Name = "servMgmtBox"; this.servMgmtBox.Name = "servMgmtBox";
this.servMgmtBox.Size = new System.Drawing.Size(157, 82); this.servMgmtBox.Size = new System.Drawing.Size(157, 82);
this.servMgmtBox.TabIndex = 6; this.servMgmtBox.TabIndex = 6;
@@ -141,7 +142,7 @@ namespace ServCreator
this.playerMgmtBox.Controls.Add(this.nicknameTb); this.playerMgmtBox.Controls.Add(this.nicknameTb);
this.playerMgmtBox.Enabled = false; this.playerMgmtBox.Enabled = false;
this.playerMgmtBox.ForeColor = System.Drawing.Color.White; this.playerMgmtBox.ForeColor = System.Drawing.Color.White;
this.playerMgmtBox.Location = new System.Drawing.Point(12, 100); this.playerMgmtBox.Location = new System.Drawing.Point(12, 222);
this.playerMgmtBox.Name = "playerMgmtBox"; this.playerMgmtBox.Name = "playerMgmtBox";
this.playerMgmtBox.Size = new System.Drawing.Size(157, 213); this.playerMgmtBox.Size = new System.Drawing.Size(157, 213);
this.playerMgmtBox.TabIndex = 7; this.playerMgmtBox.TabIndex = 7;
@@ -237,7 +238,7 @@ namespace ServCreator
this.ipBanBox.Controls.Add(this.reasonIpTxt); this.ipBanBox.Controls.Add(this.reasonIpTxt);
this.ipBanBox.Enabled = false; this.ipBanBox.Enabled = false;
this.ipBanBox.ForeColor = System.Drawing.Color.White; this.ipBanBox.ForeColor = System.Drawing.Color.White;
this.ipBanBox.Location = new System.Drawing.Point(12, 321); this.ipBanBox.Location = new System.Drawing.Point(12, 443);
this.ipBanBox.Name = "ipBanBox"; this.ipBanBox.Name = "ipBanBox";
this.ipBanBox.Size = new System.Drawing.Size(157, 153); this.ipBanBox.Size = new System.Drawing.Size(157, 153);
this.ipBanBox.TabIndex = 4; this.ipBanBox.TabIndex = 4;
@@ -289,12 +290,22 @@ namespace ServCreator
this.label4.TabIndex = 4; this.label4.TabIndex = 4;
this.label4.Text = "IP Address:"; this.label4.Text = "IP Address:";
// //
// serverLabel
//
this.serverLabel.Font = new System.Drawing.Font("Consolas", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.serverLabel.ForeColor = System.Drawing.Color.White;
this.serverLabel.Location = new System.Drawing.Point(12, 12);
this.serverLabel.Name = "serverLabel";
this.serverLabel.Size = new System.Drawing.Size(157, 119);
this.serverLabel.TabIndex = 8;
//
// ControlPanelForm // ControlPanelForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40))))); this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40)))));
this.ClientSize = new System.Drawing.Size(800, 514); this.ClientSize = new System.Drawing.Size(800, 608);
this.Controls.Add(this.serverLabel);
this.Controls.Add(this.ipBanBox); this.Controls.Add(this.ipBanBox);
this.Controls.Add(this.playerMgmtBox); this.Controls.Add(this.playerMgmtBox);
this.Controls.Add(this.servMgmtBox); this.Controls.Add(this.servMgmtBox);
@@ -342,5 +353,6 @@ namespace ServCreator
private System.Windows.Forms.Button banIPBtn; private System.Windows.Forms.Button banIPBtn;
private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label3;
private System.Windows.Forms.RichTextBox reasonIpTxt; private System.Windows.Forms.RichTextBox reasonIpTxt;
private System.Windows.Forms.Label serverLabel;
} }
} }
@@ -42,12 +42,31 @@ namespace ServCreator
private void ControlPanelForm_Load(object sender, EventArgs e) private void ControlPanelForm_Load(object sender, EventArgs e)
{ {
string ip = null;
string port = null;
StreamReader jsonToString = new StreamReader(configFilePath); StreamReader jsonToString = new StreamReader(configFilePath);
config = jsonToString.ReadToEnd(); config = jsonToString.ReadToEnd();
Server server = JsonConvert.DeserializeObject<Server>(config); Server server = JsonConvert.DeserializeObject<Server>(config);
serverPath = server.Path; serverPath = server.Path;
serverName = server.Name; serverName = server.Name;
if(File.Exists(serverPath + "\\server.properties"))
{
StreamReader streamReader = new StreamReader(serverPath + "\\server.properties");
string ipLine;
string portLine;
while((ipLine = streamReader.ReadLine()) != null)
{
if (ipLine.Contains("server-ip=")) {
ip = ipLine.Replace("server-ip=", "").ToString();
}
}
serverLabel.Text = serverName + Environment.NewLine + ip;
}
} }
+27 -20
View File
@@ -58,9 +58,9 @@ namespace ServCreator
this.label1.AutoSize = true; this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 9); this.label1.Location = new System.Drawing.Point(12, 9);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(91, 17); this.label1.Size = new System.Drawing.Size(96, 17);
this.label1.TabIndex = 0; this.label1.TabIndex = 0;
this.label1.Text = "Server Engine:"; this.label1.Text = "Server Engine*:";
// //
// serverEngineCB // serverEngineCB
// //
@@ -80,9 +80,9 @@ namespace ServCreator
this.label2.AutoSize = true; this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(157, 9); this.label2.Location = new System.Drawing.Point(157, 9);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(54, 17); this.label2.Size = new System.Drawing.Size(59, 17);
this.label2.TabIndex = 2; this.label2.TabIndex = 2;
this.label2.Text = "Version:"; this.label2.Text = "Version*:";
// //
// serverVersionCB // serverVersionCB
// //
@@ -138,13 +138,7 @@ namespace ServCreator
"1.7.5", "1.7.5",
"1.7.4", "1.7.4",
"1.7.3", "1.7.3",
"1.7.2", "1.7.2"});
"1.7.1",
"1.7",
"1.6.4",
"1.6.2",
"1.6.1",
"1.6"});
this.serverVersionCB.Location = new System.Drawing.Point(160, 29); this.serverVersionCB.Location = new System.Drawing.Point(160, 29);
this.serverVersionCB.Name = "serverVersionCB"; this.serverVersionCB.Name = "serverVersionCB";
this.serverVersionCB.Size = new System.Drawing.Size(214, 25); this.serverVersionCB.Size = new System.Drawing.Size(214, 25);
@@ -155,9 +149,9 @@ namespace ServCreator
this.label3.AutoSize = true; this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(12, 57); this.label3.Location = new System.Drawing.Point(12, 57);
this.label3.Name = "label3"; this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(77, 17); this.label3.Size = new System.Drawing.Size(82, 17);
this.label3.TabIndex = 4; this.label3.TabIndex = 4;
this.label3.Text = "Server Path:"; this.label3.Text = "Server Path*:";
// //
// selectBtn // selectBtn
// //
@@ -175,9 +169,9 @@ namespace ServCreator
this.label4.AutoSize = true; this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(12, 105); this.label4.Location = new System.Drawing.Point(12, 105);
this.label4.Name = "label4"; this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(258, 17); this.label4.Size = new System.Drawing.Size(196, 17);
this.label4.TabIndex = 7; this.label4.TabIndex = 7;
this.label4.Text = "Server Name (in ServManager and Folder):"; this.label4.Text = "Server Name (in ServManager)*:";
// //
// serverNameTB // serverNameTB
// //
@@ -185,6 +179,7 @@ namespace ServCreator
this.serverNameTB.Name = "serverNameTB"; this.serverNameTB.Name = "serverNameTB";
this.serverNameTB.Size = new System.Drawing.Size(362, 25); this.serverNameTB.Size = new System.Drawing.Size(362, 25);
this.serverNameTB.TabIndex = 8; this.serverNameTB.TabIndex = 8;
this.serverNameTB.Text = "New Server";
// //
// argumentsTB // argumentsTB
// //
@@ -207,9 +202,9 @@ namespace ServCreator
this.label6.AutoSize = true; this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(12, 153); this.label6.Location = new System.Drawing.Point(12, 153);
this.label6.Name = "label6"; this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(142, 17); this.label6.Size = new System.Drawing.Size(147, 17);
this.label6.TabIndex = 11; this.label6.TabIndex = 11;
this.label6.Text = "Minimum RAM (in MB):"; this.label6.Text = "Minimum RAM (in MB)*:";
// //
// minRAM // minRAM
// //
@@ -222,6 +217,11 @@ namespace ServCreator
this.minRAM.Name = "minRAM"; this.minRAM.Name = "minRAM";
this.minRAM.Size = new System.Drawing.Size(177, 25); this.minRAM.Size = new System.Drawing.Size(177, 25);
this.minRAM.TabIndex = 12; this.minRAM.TabIndex = 12;
this.minRAM.Value = new decimal(new int[] {
2048,
0,
0,
0});
// //
// maxRAM // maxRAM
// //
@@ -234,15 +234,20 @@ namespace ServCreator
this.maxRAM.Name = "maxRAM"; this.maxRAM.Name = "maxRAM";
this.maxRAM.Size = new System.Drawing.Size(177, 25); this.maxRAM.Size = new System.Drawing.Size(177, 25);
this.maxRAM.TabIndex = 14; this.maxRAM.TabIndex = 14;
this.maxRAM.Value = new decimal(new int[] {
2048,
0,
0,
0});
// //
// label7 // label7
// //
this.label7.AutoSize = true; this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(194, 153); this.label7.Location = new System.Drawing.Point(194, 153);
this.label7.Name = "label7"; this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(145, 17); this.label7.Size = new System.Drawing.Size(150, 17);
this.label7.TabIndex = 13; this.label7.TabIndex = 13;
this.label7.Text = "Maximum RAM (in MB):"; this.label7.Text = "Maximum RAM (in MB)*:";
// //
// createBtn // createBtn
// //
@@ -283,13 +288,14 @@ namespace ServCreator
this.progressBar1.Name = "progressBar1"; this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(142, 28); this.progressBar1.Size = new System.Drawing.Size(142, 28);
this.progressBar1.TabIndex = 18; this.progressBar1.TabIndex = 18;
this.progressBar1.Visible = false;
// //
// CreateForm // CreateForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40))))); this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40)))));
this.ClientSize = new System.Drawing.Size(394, 301); this.ClientSize = new System.Drawing.Size(390, 297);
this.Controls.Add(this.progressBar1); this.Controls.Add(this.progressBar1);
this.Controls.Add(this.serverPathTB); this.Controls.Add(this.serverPathTB);
this.Controls.Add(this.checkJavaBtn); this.Controls.Add(this.checkJavaBtn);
@@ -314,6 +320,7 @@ namespace ServCreator
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.Name = "CreateForm"; this.Name = "CreateForm";
this.Text = "Server Creator - ServManager for Minecraft"; this.Text = "Server Creator - ServManager for Minecraft";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.CreateForm_FormClosing);
this.Load += new System.EventHandler(this.CreateForm_Load); this.Load += new System.EventHandler(this.CreateForm_Load);
((System.ComponentModel.ISupportInitialize)(this.minRAM)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.minRAM)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.maxRAM)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.maxRAM)).EndInit();
+15 -7
View File
@@ -49,10 +49,6 @@ namespace ServCreator
progressBar1.Visible = true; progressBar1.Visible = true;
WebClient downloader = new WebClient(); WebClient downloader = new WebClient();
downloader.DownloadProgressChanged += (s, v) => { progressBar1.Value = v.ProgressPercentage; }; downloader.DownloadProgressChanged += (s, v) => { progressBar1.Value = v.ProgressPercentage; };
downloader.DownloadFileCompleted += (s, v) => {
progressBar1.Visible = false;
MessageBox.Show("Serwer " + serverNameTB.Text + " został utworzony w folderze: " + serverPathTB.Text + ". Za chwilę zostaniesz przekierowany do panelu kontrolnego.");
};
downloader.DownloadFileAsync(new Uri("https://file.siemv.pl/gry/minecraft/server/" + serverVersionCB.Text + "/" + serverEngineCB.Text + "/" + "server.jar"), serverPathTB.Text + "\\server.jar"); downloader.DownloadFileAsync(new Uri("https://file.siemv.pl/gry/minecraft/server/" + serverVersionCB.Text + "/" + serverEngineCB.Text + "/" + "server.jar"), serverPathTB.Text + "\\server.jar");
// Tworzenie pliku EULA // Tworzenie pliku EULA
@@ -75,10 +71,15 @@ namespace ServCreator
configWriter.Write(JsonConvert.SerializeObject(server)); configWriter.Write(JsonConvert.SerializeObject(server));
configWriter.Close(); configWriter.Close();
ControlPanelForm controlPanel = new ControlPanelForm(serverPathTB.Text + "\\servmanager.json"); downloader.DownloadFileCompleted += (s, v) => {
controlPanel.Show(); progressBar1.Visible = false;
MessageBox.Show("Server " + serverNameTB.Text + " was created in a folder: " + serverPathTB.Text + ". After a short moment you will be redirected to the control panel.");
this.Close(); ControlPanelForm controlPanel = new ControlPanelForm(serverPathTB.Text + "\\servmanager.json");
controlPanel.Show();
this.Close();
};
} }
else else
MessageBox.Show("Nie wypełniono wymaganych pól! Uzupełnij je i dopiero wtedy możesz utworzyć serwer"); MessageBox.Show("Nie wypełniono wymaganych pól! Uzupełnij je i dopiero wtedy możesz utworzyć serwer");
@@ -115,7 +116,14 @@ namespace ServCreator
private void CreateForm_Load(object sender, EventArgs e) private void CreateForm_Load(object sender, EventArgs e)
{ {
serverEngineCB.SelectedIndex = 0;
serverVersionCB.SelectedIndex = 0;
}
private void CreateForm_FormClosing(object sender, FormClosingEventArgs e)
{
Form1 form1 = new Form1();
form1.Visible = true;
} }
} }
} }
+1
View File
@@ -112,6 +112,7 @@ namespace ServCreator
this.Name = "Form1"; this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "ServManager for Minecraft"; this.Text = "ServManager for Minecraft";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
+6
View File
@@ -23,6 +23,7 @@ namespace ServCreator
{ {
CreateForm createFrm = new CreateForm(); CreateForm createFrm = new CreateForm();
createFrm.Show(); createFrm.Show();
this.Visible = false;
} }
private void loadBtn_Click(object sender, EventArgs e) private void loadBtn_Click(object sender, EventArgs e)
@@ -51,5 +52,10 @@ namespace ServCreator
public string Engine { get; set; } public string Engine { get; set; }
} }
private void Form1_Load(object sender, EventArgs e)
{
serverList.SelectedIndex = 0;
}
} }
} }
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.