System.StackOverflowException męczy mnie. Help me

This commit is contained in:
Christopher
2021-02-12 23:25:41 +01:00
parent ce02766b6f
commit 44f20ace4a
29 changed files with 8173 additions and 986 deletions
Binary file not shown.
+317
View File
@@ -0,0 +1,317 @@
namespace ServCreator
{
partial class AddServerForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AddServerForm));
this.label1 = new System.Windows.Forms.Label();
this.serverNameBox = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.serverEngineCB = new System.Windows.Forms.ComboBox();
this.label3 = new System.Windows.Forms.Label();
this.serverVersionCB = new System.Windows.Forms.ComboBox();
this.label5 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.maxRAM = new System.Windows.Forms.NumericUpDown();
this.label7 = new System.Windows.Forms.Label();
this.minRAM = new System.Windows.Forms.NumericUpDown();
this.label6 = new System.Windows.Forms.Label();
this.argumentsTB = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.addBtn = new System.Windows.Forms.Button();
this.pathSelectBtn = new System.Windows.Forms.Button();
this.serverPathBox = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.serverPathSelector = new System.Windows.Forms.FolderBrowserDialog();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.maxRAM)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.minRAM)).BeginInit();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 105);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(87, 17);
this.label1.TabIndex = 0;
this.label1.Text = "Server Name:";
//
// serverNameBox
//
this.serverNameBox.Location = new System.Drawing.Point(15, 125);
this.serverNameBox.Name = "serverNameBox";
this.serverNameBox.Size = new System.Drawing.Size(359, 25);
this.serverNameBox.TabIndex = 1;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 57);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(96, 17);
this.label2.TabIndex = 4;
this.label2.Text = "Server Engine*:";
//
// serverEngineCB
//
this.serverEngineCB.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.serverEngineCB.FormattingEnabled = true;
this.serverEngineCB.Location = new System.Drawing.Point(15, 77);
this.serverEngineCB.Name = "serverEngineCB";
this.serverEngineCB.Size = new System.Drawing.Size(142, 25);
this.serverEngineCB.TabIndex = 5;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(160, 57);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(59, 17);
this.label3.TabIndex = 6;
this.label3.Text = "Version*:";
//
// serverVersionCB
//
this.serverVersionCB.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.serverVersionCB.FormattingEnabled = true;
this.serverVersionCB.Items.AddRange(new object[] {
""});
this.serverVersionCB.Location = new System.Drawing.Point(163, 77);
this.serverVersionCB.Name = "serverVersionCB";
this.serverVersionCB.Size = new System.Drawing.Size(211, 25);
this.serverVersionCB.TabIndex = 7;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(15, 157);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(347, 34);
this.label5.TabIndex = 11;
this.label5.Text = "ServManager requires \"start.bat\" file with arguments, that \r\nyou\'re running serve" +
"r your local server.";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.maxRAM);
this.groupBox1.Controls.Add(this.label7);
this.groupBox1.Controls.Add(this.minRAM);
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.argumentsTB);
this.groupBox1.Controls.Add(this.label8);
this.groupBox1.Controls.Add(this.checkBox1);
this.groupBox1.Location = new System.Drawing.Point(12, 194);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(370, 124);
this.groupBox1.TabIndex = 12;
this.groupBox1.TabStop = false;
//
// maxRAM
//
this.maxRAM.Location = new System.Drawing.Point(191, 41);
this.maxRAM.Maximum = new decimal(new int[] {
102400,
0,
0,
0});
this.maxRAM.Name = "maxRAM";
this.maxRAM.Size = new System.Drawing.Size(171, 25);
this.maxRAM.TabIndex = 20;
this.maxRAM.Value = new decimal(new int[] {
2048,
0,
0,
0});
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(188, 21);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(150, 17);
this.label7.TabIndex = 19;
this.label7.Text = "Maximum RAM (in MB)*:";
//
// minRAM
//
this.minRAM.Location = new System.Drawing.Point(6, 41);
this.minRAM.Maximum = new decimal(new int[] {
102400,
0,
0,
0});
this.minRAM.Name = "minRAM";
this.minRAM.Size = new System.Drawing.Size(177, 25);
this.minRAM.TabIndex = 18;
this.minRAM.Value = new decimal(new int[] {
2048,
0,
0,
0});
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(6, 21);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(147, 17);
this.label6.TabIndex = 17;
this.label6.Text = "Minimum RAM (in MB)*:";
//
// argumentsTB
//
this.argumentsTB.Location = new System.Drawing.Point(6, 89);
this.argumentsTB.Name = "argumentsTB";
this.argumentsTB.Size = new System.Drawing.Size(356, 25);
this.argumentsTB.TabIndex = 15;
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(6, 69);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(136, 17);
this.label8.TabIndex = 16;
this.label8.Text = "Additional arguments:";
//
// checkBox1
//
this.checkBox1.AutoSize = true;
this.checkBox1.Location = new System.Drawing.Point(9, 0);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(127, 21);
this.checkBox1.TabIndex = 0;
this.checkBox1.Text = "Create \"start.bat\"";
this.checkBox1.UseVisualStyleBackColor = true;
//
// addBtn
//
this.addBtn.ForeColor = System.Drawing.Color.Black;
this.addBtn.Location = new System.Drawing.Point(307, 324);
this.addBtn.Name = "addBtn";
this.addBtn.Size = new System.Drawing.Size(75, 25);
this.addBtn.TabIndex = 13;
this.addBtn.Text = "Add";
this.addBtn.UseVisualStyleBackColor = true;
this.addBtn.Click += new System.EventHandler(this.addServer);
//
// pathSelectBtn
//
this.pathSelectBtn.ForeColor = System.Drawing.Color.Black;
this.pathSelectBtn.Location = new System.Drawing.Point(299, 29);
this.pathSelectBtn.Name = "pathSelectBtn";
this.pathSelectBtn.Size = new System.Drawing.Size(75, 25);
this.pathSelectBtn.TabIndex = 16;
this.pathSelectBtn.Text = "Select";
this.pathSelectBtn.UseVisualStyleBackColor = true;
this.pathSelectBtn.Click += new System.EventHandler(this.selectPath);
//
// serverPathBox
//
this.serverPathBox.Location = new System.Drawing.Point(15, 29);
this.serverPathBox.Name = "serverPathBox";
this.serverPathBox.Size = new System.Drawing.Size(278, 25);
this.serverPathBox.TabIndex = 15;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(12, 9);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(41, 17);
this.label4.TabIndex = 14;
this.label4.Text = "Path*:";
//
// serverPathSelector
//
this.serverPathSelector.Description = "Select a path, where your installed server is...";
this.serverPathSelector.ShowNewFolderButton = false;
//
// AddServerForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40)))));
this.ClientSize = new System.Drawing.Size(394, 360);
this.Controls.Add(this.pathSelectBtn);
this.Controls.Add(this.serverPathBox);
this.Controls.Add(this.label4);
this.Controls.Add(this.addBtn);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.label5);
this.Controls.Add(this.label2);
this.Controls.Add(this.serverEngineCB);
this.Controls.Add(this.label3);
this.Controls.Add(this.serverVersionCB);
this.Controls.Add(this.serverNameBox);
this.Controls.Add(this.label1);
this.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.ForeColor = System.Drawing.Color.White;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.Name = "AddServerForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Add Server - ServManager for Minecraft";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.AddServerForm_FormClosing);
this.Load += new System.EventHandler(this.AddServerForm_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.maxRAM)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.minRAM)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox serverNameBox;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ComboBox serverEngineCB;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.ComboBox serverVersionCB;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.NumericUpDown maxRAM;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.NumericUpDown minRAM;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.TextBox argumentsTB;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Button addBtn;
private System.Windows.Forms.Button pathSelectBtn;
private System.Windows.Forms.TextBox serverPathBox;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.FolderBrowserDialog serverPathSelector;
}
}
+113
View File
@@ -0,0 +1,113 @@
using System;
using System.Windows.Forms;
using System.IO;
using Newtonsoft.Json;
using System.Net;
namespace ServCreator
{
public partial class AddServerForm : Form
{
public AddServerForm()
{
InitializeComponent();
}
private void selectPath(object sender, EventArgs e)
{
if (serverPathSelector.ShowDialog() == DialogResult.OK)
serverPathBox.Text = serverPathSelector.SelectedPath;
}
private void addServer(object sender, EventArgs e)
{
if (File.Exists(serverPathBox.Text + "\\start.bat"))
CreateServManager();
else if (checkBox1.Checked)
{
CreateStart();
CreateServManager();
}
else
MessageBox.Show("The file \"start.bat\" was not found. Create a new one.", "start.bat not found", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
void CreateServManager()
{
if (serverPathBox.Text != "" && serverEngineCB.Text != "" && serverVersionCB.Text != "" && serverNameBox.Text != "")
{
Server server = new Server();
server.Name = serverNameBox.Text;
server.Path = serverPathBox.Text;
server.Engine = serverEngineCB.Text;
server.Version = serverVersionCB.Text;
StreamWriter configWriter = new StreamWriter(serverPathBox.Text + "\\servmanager.srv");
configWriter.Write(JsonConvert.SerializeObject(server));
configWriter.Close();
MessageBox.Show("Server " + serverNameBox.Text + " has been added. You'll be moved to Control Panel");
ControlPanelForm controlPanel = new ControlPanelForm(serverPathBox.Text + "\\servmanager.srv");
controlPanel.Show();
this.Visible = false;
}
else
MessageBox.Show("The required fields have not been completed! Complete them and try again.", "Required fields are empty", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
void CreateStart()
{
if (minRAM.Value <= maxRAM.Value && maxRAM.Value >= minRAM.Value && minRAM.Value != 0)
{
StreamWriter startWriter = new StreamWriter(serverPathBox.Text + "\\start.bat");
startWriter.Write("@echo off" + Environment.NewLine + "java -Xms" + minRAM.Value + "M -Xmx" + maxRAM.Value + "M " + argumentsTB.Text + " -jar server.jar nogui");
startWriter.Close();
} else
MessageBox.Show("The required fields have not been completed! Complete them and try again.", "Required fields are empty", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
[JsonObject(MemberSerialization.OptIn)]
public class Server
{
[JsonProperty]
public string Name { get; set; }
[JsonProperty]
public string Path { get; set; }
[JsonProperty]
public string Version { get; set; }
[JsonProperty]
public string Engine { get; set; }
}
private void AddServerForm_Load(object sender, EventArgs e)
{
string json = new WebClient().DownloadString("https://raw.githubusercontent.com/KrzysiekSiemv/ServCreator-for-Minecraft/main/creator.json");
Creator x = JsonConvert.DeserializeObject<Creator>(json);
for (int i = 0; i < x.Versions.Length; i++)
serverVersionCB.Items.Add(x.Versions[i]);
for (int i = 0; i < x.Engines.Length; i++)
serverEngineCB.Items.Add(x.Engines[i]);
serverEngineCB.SelectedIndex = 0;
serverVersionCB.SelectedIndex = 1;
}
public class Creator
{
[JsonProperty]
public string[] Versions { get; set; }
[JsonProperty]
public string[] Engines { get; set; }
}
private void AddServerForm_FormClosing(object sender, FormClosingEventArgs e)
{
Form1 form1 = new Form1();
form1.Visible = true;
}
}
}
File diff suppressed because it is too large Load Diff
+49 -53
View File
@@ -29,7 +29,6 @@ namespace ServCreator
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ControlPanelForm));
this.editProperties = new System.Windows.Forms.Button();
this.outputText = new System.Windows.Forms.RichTextBox();
@@ -38,20 +37,18 @@ namespace ServCreator
this.startBtn = new System.Windows.Forms.Button();
this.killBtn = new System.Windows.Forms.Button();
this.servMgmtBox = new System.Windows.Forms.GroupBox();
this.pluginsBtn = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.easyManagementBtn = new System.Windows.Forms.Button();
this.stopBtn = new System.Windows.Forms.Button();
this.serverLabel = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.panel1 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
this.panel3 = new System.Windows.Forms.Panel();
this.panel4 = new System.Windows.Forms.Panel();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.panel5 = new System.Windows.Forms.Panel();
this.panel6 = new System.Windows.Forms.Panel();
this.servMgmtBox.SuspendLayout();
this.groupBox1.SuspendLayout();
this.panel1.SuspendLayout();
this.panel5.SuspendLayout();
this.SuspendLayout();
@@ -73,7 +70,7 @@ namespace ServCreator
this.outputText.Dock = System.Windows.Forms.DockStyle.Fill;
this.outputText.Location = new System.Drawing.Point(179, 12);
this.outputText.Name = "outputText";
this.outputText.Size = new System.Drawing.Size(609, 371);
this.outputText.Size = new System.Drawing.Size(609, 365);
this.outputText.TabIndex = 1;
this.outputText.Text = "";
this.outputText.TextChanged += new System.EventHandler(this.outputChanged);
@@ -128,23 +125,52 @@ namespace ServCreator
// servMgmtBox
//
this.servMgmtBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.servMgmtBox.Controls.Add(this.pluginsBtn);
this.servMgmtBox.Controls.Add(this.button1);
this.servMgmtBox.Controls.Add(this.easyManagementBtn);
this.servMgmtBox.Controls.Add(this.stopBtn);
this.servMgmtBox.Controls.Add(this.startBtn);
this.servMgmtBox.Controls.Add(this.killBtn);
this.servMgmtBox.Controls.Add(this.editProperties);
this.servMgmtBox.ForeColor = System.Drawing.Color.White;
this.servMgmtBox.Location = new System.Drawing.Point(12, 157);
this.servMgmtBox.Location = new System.Drawing.Point(12, 179);
this.servMgmtBox.Name = "servMgmtBox";
this.servMgmtBox.Size = new System.Drawing.Size(157, 140);
this.servMgmtBox.Size = new System.Drawing.Size(157, 224);
this.servMgmtBox.TabIndex = 6;
this.servMgmtBox.TabStop = false;
this.servMgmtBox.Text = "Server Management";
//
// pluginsBtn
//
this.pluginsBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.pluginsBtn.ForeColor = System.Drawing.Color.Black;
this.pluginsBtn.Location = new System.Drawing.Point(6, 137);
this.pluginsBtn.Name = "pluginsBtn";
this.pluginsBtn.Size = new System.Drawing.Size(145, 23);
this.pluginsBtn.TabIndex = 9;
this.pluginsBtn.Text = "Open Plugins Folder";
this.pluginsBtn.UseVisualStyleBackColor = true;
this.pluginsBtn.Visible = false;
this.pluginsBtn.Click += new System.EventHandler(this.pluginsBtn_Click);
//
// button1
//
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.button1.ForeColor = System.Drawing.Color.Black;
this.button1.Location = new System.Drawing.Point(6, 166);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(145, 23);
this.button1.TabIndex = 8;
this.button1.Text = "Change Server Engine";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click_1);
//
// easyManagementBtn
//
this.easyManagementBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.easyManagementBtn.Enabled = false;
this.easyManagementBtn.ForeColor = System.Drawing.Color.Black;
this.easyManagementBtn.Location = new System.Drawing.Point(6, 107);
this.easyManagementBtn.Location = new System.Drawing.Point(6, 195);
this.easyManagementBtn.Name = "easyManagementBtn";
this.easyManagementBtn.Size = new System.Drawing.Size(145, 23);
this.easyManagementBtn.TabIndex = 7;
@@ -173,40 +199,8 @@ namespace ServCreator
this.serverLabel.Size = new System.Drawing.Size(157, 94);
this.serverLabel.TabIndex = 8;
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.ForeColor = System.Drawing.Color.White;
this.groupBox1.Location = new System.Drawing.Point(12, 303);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(157, 100);
this.groupBox1.TabIndex = 9;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "System Resources Usage";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(7, 42);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(68, 13);
this.label2.TabIndex = 1;
this.label2.Text = "RAM Usage:";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(7, 20);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(66, 13);
this.label1.TabIndex = 0;
this.label1.Text = "CPU Usage:";
//
// panel1
//
this.panel1.Controls.Add(this.groupBox1);
this.panel1.Controls.Add(this.serverLabel);
this.panel1.Controls.Add(this.servMgmtBox);
this.panel1.Dock = System.Windows.Forms.DockStyle.Left;
@@ -239,11 +233,6 @@ namespace ServCreator
this.panel4.Size = new System.Drawing.Size(12, 391);
this.panel4.TabIndex = 13;
//
// timer1
//
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.systemUsage);
//
// panel5
//
this.panel5.Controls.Add(this.commandInput);
@@ -254,6 +243,14 @@ namespace ServCreator
this.panel5.Size = new System.Drawing.Size(609, 20);
this.panel5.TabIndex = 14;
//
// panel6
//
this.panel6.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel6.Location = new System.Drawing.Point(179, 377);
this.panel6.Name = "panel6";
this.panel6.Size = new System.Drawing.Size(609, 6);
this.panel6.TabIndex = 15;
//
// ControlPanelForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -261,6 +258,7 @@ namespace ServCreator
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40)))));
this.ClientSize = new System.Drawing.Size(800, 415);
this.Controls.Add(this.outputText);
this.Controls.Add(this.panel6);
this.Controls.Add(this.panel5);
this.Controls.Add(this.panel4);
this.Controls.Add(this.panel3);
@@ -268,12 +266,11 @@ namespace ServCreator
this.Controls.Add(this.panel1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "ControlPanelForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Control Panel - ServManager for Minecraft";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ControlPanelForm_FormClosing);
this.Load += new System.EventHandler(this.ControlPanelForm_Load);
this.servMgmtBox.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.panel1.ResumeLayout(false);
this.panel5.ResumeLayout(false);
this.panel5.PerformLayout();
@@ -293,14 +290,13 @@ namespace ServCreator
private System.Windows.Forms.Label serverLabel;
private System.Windows.Forms.Button stopBtn;
private System.Windows.Forms.Button easyManagementBtn;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.Panel panel4;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Panel panel5;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Panel panel6;
private System.Windows.Forms.Button pluginsBtn;
}
}
+29 -27
View File
@@ -1,11 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Newtonsoft.Json;
using System.IO;
@@ -24,6 +17,7 @@ namespace ServCreator
public string serverPath;
public string serverName;
Server server;
ServerManagementForm easyManagementFrm;
public ControlPanelForm(string configFile)
{
@@ -46,25 +40,24 @@ namespace ServCreator
{
string ip = null;
GetFreshConfig();
Form1 frm1 = new Form1();
frm1.Visible = false;
StreamReader jsonToString = new StreamReader(configFilePath);
config = jsonToString.ReadToEnd();
Server server = JsonConvert.DeserializeObject<Server>(config);
serverPath = server.Path;
serverName = server.Name;
if(File.Exists(serverPath + "\\server.properties"))
if (File.Exists(serverPath + "\\server.properties"))
{
StreamReader streamReader = new StreamReader(serverPath + "\\server.properties");
string ipLine;
while((ipLine = streamReader.ReadLine()) != null)
while ((ipLine = streamReader.ReadLine()) != null)
{
if (ipLine.Contains("server-ip=")) {
if (ipLine.Contains("server-ip="))
{
ip = ipLine.Replace("server-ip=", "").ToString();
}
}
@@ -72,9 +65,17 @@ namespace ServCreator
serverLabel.Text = serverName + Environment.NewLine + ip;
streamReader.Close();
}
if (server.Engine != "vanilla")
pluginsBtn.Visible = true;
}
public void GetFreshConfig()
{
StreamReader jsonToString = new StreamReader(configFilePath);
config = jsonToString.ReadToEnd();
server = JsonConvert.DeserializeObject<Server>(config);
}
[JsonObject(MemberSerialization.OptIn)]
public class Server
@@ -137,15 +138,9 @@ namespace ServCreator
easyManagementFrm = new ServerManagementForm(process);
}
private void ControlPanelForm_FormClosing(object sender, FormClosingEventArgs e)
{
Application.Exit();
}
private void ControlPanelForm_FormClosing(object sender, FormClosingEventArgs e) { Application.Exit(); }
private void submit_Click(object sender, EventArgs e) { process.StandardInput.WriteLine(commandInput.Text); commandInput.Text = ""; commandInput.Focus(); }
private void easyManagement(object sender, EventArgs e) { easyManagementFrm.Show(); }
private void outputChanged(object sender, EventArgs e) { outputText.SelectionStart = outputText.Text.Length; outputText.ScrollToCaret(); }
private void submitCommand(object sender, KeyEventArgs e)
@@ -182,15 +177,22 @@ namespace ServCreator
easyManagementFrm.Close();
}
private void systemUsage(object sender, EventArgs e)
{
label2.Text = "RAM Usage: " + process.PrivateMemorySize64;
}
private void commandInput_TextChanged(object sender, EventArgs e)
{
}
private void pluginsBtn_Click(object sender, EventArgs e)
{
Process.Start("explorer.exe", serverPath + "\\plugins");
}
private void button1_Click_1(object sender, EventArgs e)
{
UpgradeServerEngineForm upgrader = new UpgradeServerEngineForm(configFilePath);
upgrader.controlPanel = this;
upgrader.Show();
this.Enabled = false;
}
}
}
@@ -117,9 +117,6 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
+142 -187
View File
@@ -87,21 +87,21 @@ namespace ServCreator
this.spawnProtection = new System.Windows.Forms.NumericUpDown();
this.label18 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.label19 = new System.Windows.Forms.Label();
this.label20 = new System.Windows.Forms.Label();
this.maxBuildingHeight = new System.Windows.Forms.NumericUpDown();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.linkLabel2 = new System.Windows.Forms.LinkLabel();
this.label21 = new System.Windows.Forms.Label();
this.label22 = new System.Windows.Forms.Label();
this.levelType = new System.Windows.Forms.TextBox();
this.levelSeed = new System.Windows.Forms.TextBox();
this.label23 = new System.Windows.Forms.Label();
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
this.label23 = new System.Windows.Forms.Label();
this.levelSeed = new System.Windows.Forms.TextBox();
this.levelType = new System.Windows.Forms.TextBox();
this.label22 = new System.Windows.Forms.Label();
this.label21 = new System.Windows.Forms.Label();
this.linkLabel2 = new System.Windows.Forms.LinkLabel();
this.maxBuildingHeight = new System.Windows.Forms.NumericUpDown();
this.label20 = new System.Windows.Forms.Label();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.label19 = new System.Windows.Forms.Label();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.checkBox2 = new System.Windows.Forms.CheckBox();
this.linkLabel3 = new System.Windows.Forms.LinkLabel();
this.eulaBox = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.minRAM)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.maxRAM)).BeginInit();
this.groupBox1.SuspendLayout();
@@ -111,9 +111,9 @@ namespace ServCreator
((System.ComponentModel.ISupportInitialize)(this.maxPlayers)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.spawnProtection)).BeginInit();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.maxBuildingHeight)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.maxBuildingHeight)).BeginInit();
this.groupBox3.SuspendLayout();
this.groupBox4.SuspendLayout();
this.SuspendLayout();
//
@@ -130,10 +130,6 @@ namespace ServCreator
//
this.serverEngineCB.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.serverEngineCB.FormattingEnabled = true;
this.serverEngineCB.Items.AddRange(new object[] {
"vanilla",
"craftbukkit",
"spigot"});
this.serverEngineCB.Location = new System.Drawing.Point(6, 41);
this.serverEngineCB.Name = "serverEngineCB";
this.serverEngineCB.Size = new System.Drawing.Size(142, 25);
@@ -153,56 +149,7 @@ namespace ServCreator
this.serverVersionCB.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.serverVersionCB.FormattingEnabled = true;
this.serverVersionCB.Items.AddRange(new object[] {
"1.16.5",
"1.16.4",
"1.16.3",
"1.16.2",
"1.16.1",
"1.16",
"1.15.2",
"1.15.1",
"1.15",
"1.14.4",
"1.14.3",
"1.14.2",
"1.14.1",
"1.14",
"1.13.2",
"1.13.1",
"1.13",
"1.12.2",
"1.12.1",
"1.12",
"1.11.2",
"1.11.1",
"1.11",
"1.10.2",
"1.10.1",
"1.10",
"1.9.4",
"1.9.3",
"1.9.2",
"1.9.1",
"1.9",
"1.8.9",
"1.8.8",
"1.8.7",
"1.8.6",
"1.8.5",
"1.8.4",
"1.8.3",
"1.8.2",
"1.8.1",
"1.8",
"1.7.10",
"1.7.9",
"1.7.8",
"1.7.7",
"1.7.6",
"1.7.5",
"1.7.4",
"1.7.3",
"1.7.2"});
""});
this.serverVersionCB.Location = new System.Drawing.Point(154, 41);
this.serverVersionCB.Name = "serverVersionCB";
this.serverVersionCB.Size = new System.Drawing.Size(214, 25);
@@ -371,6 +318,7 @@ namespace ServCreator
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.argumentsTB);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.ForeColor = System.Drawing.Color.White;
this.groupBox1.Location = new System.Drawing.Point(600, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(377, 272);
@@ -806,6 +754,7 @@ namespace ServCreator
this.groupBox2.Controls.Add(this.difficulty);
this.groupBox2.Controls.Add(this.label14);
this.groupBox2.Controls.Add(this.maxPlayers);
this.groupBox2.ForeColor = System.Drawing.Color.White;
this.groupBox2.Location = new System.Drawing.Point(12, 12);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(582, 414);
@@ -813,48 +762,76 @@ namespace ServCreator
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Server Properties";
//
// groupBox3
// numericUpDown1
//
this.groupBox3.Controls.Add(this.checkBox1);
this.groupBox3.Controls.Add(this.allowNether);
this.groupBox3.Controls.Add(this.generateStructures);
this.groupBox3.Controls.Add(this.forceGamemode);
this.groupBox3.Controls.Add(this.enablePvp);
this.groupBox3.Controls.Add(this.allowFlight);
this.groupBox3.Controls.Add(this.whiteList);
this.groupBox3.Controls.Add(this.onlineMode);
this.groupBox3.Controls.Add(this.spawnNpcs);
this.groupBox3.Controls.Add(this.spawnAnimals);
this.groupBox3.Controls.Add(this.spawnMonsters);
this.groupBox3.Controls.Add(this.enableStatus);
this.groupBox3.Controls.Add(this.enableCommandBlocks);
this.groupBox3.Controls.Add(this.hardcore);
this.groupBox3.Location = new System.Drawing.Point(324, 14);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(252, 292);
this.groupBox3.TabIndex = 72;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Options";
this.numericUpDown1.Location = new System.Drawing.Point(173, 281);
this.numericUpDown1.Maximum = new decimal(new int[] {
4,
0,
0,
0});
this.numericUpDown1.Name = "numericUpDown1";
this.numericUpDown1.Size = new System.Drawing.Size(145, 25);
this.numericUpDown1.TabIndex = 82;
this.numericUpDown1.Value = new decimal(new int[] {
4,
0,
0,
0});
//
// label19
// label23
//
this.label19.AutoSize = true;
this.label19.Location = new System.Drawing.Point(597, 344);
this.label19.Name = "label19";
this.label19.Size = new System.Drawing.Size(380, 51);
this.label19.TabIndex = 73;
this.label19.Text = "This server.properties is universal for every Minecraft version.\r\nSome of options" +
" can not work in earlier versions properly. You \r\ncan later add or change settin" +
"gs on properties in Control Panel.";
this.label23.AutoSize = true;
this.label23.Location = new System.Drawing.Point(173, 261);
this.label23.Name = "label23";
this.label23.Size = new System.Drawing.Size(129, 17);
this.label23.TabIndex = 81;
this.label23.Text = "Op Permission Level:";
//
// label20
// levelSeed
//
this.label20.AutoSize = true;
this.label20.Location = new System.Drawing.Point(6, 309);
this.label20.Name = "label20";
this.label20.Size = new System.Drawing.Size(128, 17);
this.label20.TabIndex = 73;
this.label20.Text = "Max Building Height:";
this.levelSeed.Location = new System.Drawing.Point(173, 233);
this.levelSeed.Name = "levelSeed";
this.levelSeed.Size = new System.Drawing.Size(145, 25);
this.levelSeed.TabIndex = 80;
//
// levelType
//
this.levelType.Location = new System.Drawing.Point(9, 377);
this.levelType.Name = "levelType";
this.levelType.Size = new System.Drawing.Size(155, 25);
this.levelType.TabIndex = 79;
this.levelType.Text = "default";
//
// label22
//
this.label22.AutoSize = true;
this.label22.Location = new System.Drawing.Point(6, 357);
this.label22.Name = "label22";
this.label22.Size = new System.Drawing.Size(71, 17);
this.label22.TabIndex = 78;
this.label22.Text = "Level Type:";
//
// label21
//
this.label21.AutoSize = true;
this.label21.Location = new System.Drawing.Point(173, 213);
this.label21.Name = "label21";
this.label21.Size = new System.Drawing.Size(73, 17);
this.label21.TabIndex = 76;
this.label21.Text = "Level Seed:";
//
// linkLabel2
//
this.linkLabel2.AutoSize = true;
this.linkLabel2.LinkColor = System.Drawing.Color.White;
this.linkLabel2.Location = new System.Drawing.Point(485, -3);
this.linkLabel2.Name = "linkLabel2";
this.linkLabel2.Size = new System.Drawing.Size(97, 17);
this.linkLabel2.TabIndex = 75;
this.linkLabel2.TabStop = true;
this.linkLabel2.Text = "Settings Helper";
this.linkLabel2.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel2_LinkClicked);
//
// maxBuildingHeight
//
@@ -878,6 +855,39 @@ namespace ServCreator
0,
0});
//
// label20
//
this.label20.AutoSize = true;
this.label20.Location = new System.Drawing.Point(6, 309);
this.label20.Name = "label20";
this.label20.Size = new System.Drawing.Size(128, 17);
this.label20.TabIndex = 73;
this.label20.Text = "Max Building Height:";
//
// groupBox3
//
this.groupBox3.Controls.Add(this.checkBox1);
this.groupBox3.Controls.Add(this.allowNether);
this.groupBox3.Controls.Add(this.generateStructures);
this.groupBox3.Controls.Add(this.forceGamemode);
this.groupBox3.Controls.Add(this.enablePvp);
this.groupBox3.Controls.Add(this.allowFlight);
this.groupBox3.Controls.Add(this.whiteList);
this.groupBox3.Controls.Add(this.onlineMode);
this.groupBox3.Controls.Add(this.spawnNpcs);
this.groupBox3.Controls.Add(this.spawnAnimals);
this.groupBox3.Controls.Add(this.spawnMonsters);
this.groupBox3.Controls.Add(this.enableStatus);
this.groupBox3.Controls.Add(this.enableCommandBlocks);
this.groupBox3.Controls.Add(this.hardcore);
this.groupBox3.ForeColor = System.Drawing.Color.White;
this.groupBox3.Location = new System.Drawing.Point(324, 14);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(252, 292);
this.groupBox3.TabIndex = 72;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Options";
//
// checkBox1
//
this.checkBox1.AutoSize = true;
@@ -888,80 +898,22 @@ namespace ServCreator
this.checkBox1.Text = "Enable Rcon";
this.checkBox1.UseVisualStyleBackColor = true;
//
// linkLabel2
// label19
//
this.linkLabel2.AutoSize = true;
this.linkLabel2.Location = new System.Drawing.Point(485, -3);
this.linkLabel2.Name = "linkLabel2";
this.linkLabel2.Size = new System.Drawing.Size(97, 17);
this.linkLabel2.TabIndex = 75;
this.linkLabel2.TabStop = true;
this.linkLabel2.Text = "Settings Helper";
this.linkLabel2.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel2_LinkClicked);
//
// label21
//
this.label21.AutoSize = true;
this.label21.Location = new System.Drawing.Point(173, 213);
this.label21.Name = "label21";
this.label21.Size = new System.Drawing.Size(73, 17);
this.label21.TabIndex = 76;
this.label21.Text = "Level Seed:";
//
// label22
//
this.label22.AutoSize = true;
this.label22.Location = new System.Drawing.Point(6, 357);
this.label22.Name = "label22";
this.label22.Size = new System.Drawing.Size(71, 17);
this.label22.TabIndex = 78;
this.label22.Text = "Level Type:";
//
// levelType
//
this.levelType.Location = new System.Drawing.Point(9, 377);
this.levelType.Name = "levelType";
this.levelType.Size = new System.Drawing.Size(155, 25);
this.levelType.TabIndex = 79;
this.levelType.Text = "default";
//
// levelSeed
//
this.levelSeed.Location = new System.Drawing.Point(173, 233);
this.levelSeed.Name = "levelSeed";
this.levelSeed.Size = new System.Drawing.Size(145, 25);
this.levelSeed.TabIndex = 80;
//
// label23
//
this.label23.AutoSize = true;
this.label23.Location = new System.Drawing.Point(173, 261);
this.label23.Name = "label23";
this.label23.Size = new System.Drawing.Size(129, 17);
this.label23.TabIndex = 81;
this.label23.Text = "Op Permission Level:";
//
// numericUpDown1
//
this.numericUpDown1.Location = new System.Drawing.Point(173, 281);
this.numericUpDown1.Maximum = new decimal(new int[] {
4,
0,
0,
0});
this.numericUpDown1.Name = "numericUpDown1";
this.numericUpDown1.Size = new System.Drawing.Size(145, 25);
this.numericUpDown1.TabIndex = 82;
this.numericUpDown1.Value = new decimal(new int[] {
4,
0,
0,
0});
this.label19.AutoSize = true;
this.label19.Location = new System.Drawing.Point(597, 344);
this.label19.Name = "label19";
this.label19.Size = new System.Drawing.Size(380, 51);
this.label19.TabIndex = 73;
this.label19.Text = "This server.properties is universal for every Minecraft version.\r\nSome of options" +
" can not work in earlier versions properly. You \r\ncan later add or change settin" +
"gs on properties in Control Panel.";
//
// groupBox4
//
this.groupBox4.Controls.Add(this.linkLabel3);
this.groupBox4.Controls.Add(this.checkBox2);
this.groupBox4.Controls.Add(this.eulaBox);
this.groupBox4.ForeColor = System.Drawing.Color.White;
this.groupBox4.Location = new System.Drawing.Point(600, 290);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(377, 51);
@@ -969,16 +921,6 @@ namespace ServCreator
this.groupBox4.TabStop = false;
this.groupBox4.Text = "Minecraft - End User License Agreement";
//
// checkBox2
//
this.checkBox2.AutoSize = true;
this.checkBox2.Location = new System.Drawing.Point(6, 20);
this.checkBox2.Name = "checkBox2";
this.checkBox2.Size = new System.Drawing.Size(100, 21);
this.checkBox2.TabIndex = 0;
this.checkBox2.Text = "Accept EULA";
this.checkBox2.UseVisualStyleBackColor = true;
//
// linkLabel3
//
this.linkLabel3.AutoSize = true;
@@ -990,6 +932,16 @@ namespace ServCreator
this.linkLabel3.Text = "Read about EULA ";
this.linkLabel3.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel3_LinkClicked);
//
// eulaBox
//
this.eulaBox.AutoSize = true;
this.eulaBox.Location = new System.Drawing.Point(6, 20);
this.eulaBox.Name = "eulaBox";
this.eulaBox.Size = new System.Drawing.Size(100, 21);
this.eulaBox.TabIndex = 0;
this.eulaBox.Text = "Accept EULA";
this.eulaBox.UseVisualStyleBackColor = true;
//
// CreateForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
@@ -1007,7 +959,10 @@ namespace ServCreator
this.ForeColor = System.Drawing.Color.White;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.MaximumSize = new System.Drawing.Size(1006, 477);
this.MinimumSize = new System.Drawing.Size(1006, 477);
this.Name = "CreateForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
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);
@@ -1022,10 +977,10 @@ namespace ServCreator
((System.ComponentModel.ISupportInitialize)(this.spawnProtection)).EndInit();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.maxBuildingHeight)).EndInit();
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.maxBuildingHeight)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
this.groupBox4.ResumeLayout(false);
this.groupBox4.PerformLayout();
this.ResumeLayout(false);
@@ -1106,6 +1061,6 @@ namespace ServCreator
private System.Windows.Forms.Label label22;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.LinkLabel linkLabel3;
private System.Windows.Forms.CheckBox checkBox2;
private System.Windows.Forms.CheckBox eulaBox;
}
}
+98 -81
View File
@@ -1,11 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
@@ -44,82 +37,100 @@ namespace ServCreator
private void createServer(object sender, EventArgs e)
{
if (serverEngineCB.Text != "" && serverNameTB.Text != "" && serverPathTB.Text != "" && serverVersionCB.Text != "" && minRAM.Value <= maxRAM.Value && maxRAM.Value >= minRAM.Value && minRAM.Value != 0)
try
{
// Pobieranie pliku serwerowego
progressBar1.Visible = true;
WebClient downloader = new WebClient();
downloader.DownloadProgressChanged += (s, v) => { progressBar1.Value = v.ProgressPercentage; };
downloader.DownloadFileAsync(new Uri("https://file.siemv.pl/gry/minecraft/server/" + serverVersionCB.Text + "/" + serverEngineCB.Text + "/" + "server.jar"), serverPathTB.Text + "\\server.jar");
if (serverEngineCB.Text != "" && serverNameTB.Text != "" && serverPathTB.Text != "" && serverVersionCB.Text != "" && minRAM.Value <= maxRAM.Value && maxRAM.Value >= minRAM.Value && minRAM.Value != 0)
{
if (eulaBox.Checked)
{
groupBox1.Enabled = false;
groupBox2.Enabled = false;
groupBox3.Enabled = false;
groupBox4.Enabled = false;
// Tworzenie pliku EULA
StreamWriter eulaWriter = new StreamWriter(serverPathTB.Text + "\\eula.txt");
eulaWriter.Write("#By changing the setting below to TRUE you are indicating your agreement to our EULA (https://account.mojang.com/documents/minecraft_eula)." + Environment.NewLine + "#" + DateTime.Now + Environment.NewLine + "eula=true");
eulaWriter.Close();
// Pobieranie pliku serwerowego
progressBar1.Visible = true;
WebClient downloader = new WebClient();
downloader.DownloadProgressChanged += (s, v) => { progressBar1.Value = v.ProgressPercentage; };
downloader.DownloadFileAsync(new Uri("https://file.siemv.pl/gry/minecraft/server/" + serverVersionCB.Text + "/" + serverEngineCB.Text + "/" + "server.jar"), serverPathTB.Text + "\\server.jar");
// Tworzenie pliku startowego serwera
StreamWriter startWriter = new StreamWriter(serverPathTB.Text + "\\start.bat");
startWriter.Write("@echo off" + Environment.NewLine + "java -Xms" + minRAM.Value + "M -Xmx" + maxRAM.Value + "M " + argumentsTB.Text + " -jar server.jar nogui");
startWriter.Close();
// Tworzenie pliku EULA
StreamWriter eulaWriter = new StreamWriter(serverPathTB.Text + "\\eula.txt");
eulaWriter.Write("#By changing the setting below to TRUE you are indicating your agreement to our EULA (https://account.mojang.com/documents/minecraft_eula)." + Environment.NewLine + "#" + DateTime.Now + Environment.NewLine + "eula=true");
eulaWriter.Close();
// Tworzenie pliku dla ServManager
Server server = new Server();
server.Name = serverNameTB.Text;
server.Path = serverPathTB.Text;
server.Engine = serverEngineCB.Text;
server.Version = serverVersionCB.Text;
StreamWriter configWriter = new StreamWriter(serverPathTB.Text + "\\servmanager.srv");
configWriter.Write(JsonConvert.SerializeObject(server));
configWriter.Close();
// Tworzenie pliku startowego serwera
StreamWriter startWriter = new StreamWriter(serverPathTB.Text + "\\start.bat");
startWriter.Write("@echo off" + Environment.NewLine + "java -Xms" + minRAM.Value + "M -Xmx" + maxRAM.Value + "M " + argumentsTB.Text + " -jar server.jar nogui");
startWriter.Close();
// Tworzenie pliku server.properties
var nowalinia = Environment.NewLine;
// Tworzenie pliku dla ServManager
Server server = new Server();
server.Name = serverNameTB.Text;
server.Path = serverPathTB.Text;
server.Engine = serverEngineCB.Text;
server.Version = serverVersionCB.Text;
StreamWriter configWriter = new StreamWriter(serverPathTB.Text + "\\servmanager.srv");
configWriter.Write(JsonConvert.SerializeObject(server));
configWriter.Close();
StreamWriter writer = new StreamWriter(serverPathTB.Text + "\\server.properties");
string serverproperties =
"#Minecraft server properties" + nowalinia +
"#" + DateTime.Now + nowalinia +
"spawn-protection=" + spawnProtection.Value + nowalinia +
"generator-settings=" + generatorSettings.Text + nowalinia +
"force-gamemode=" + forceGamemode.Checked.ToString().ToLower() + nowalinia +
"allow-nether=" + allowNether.Checked.ToString().ToLower() + nowalinia +
"gamemode=" + gamemode.SelectedIndex.ToString() + nowalinia +
"difficulty=" + difficulty.SelectedIndex.ToString() + nowalinia +
"spawn-monstars=" + spawnMonsters.Checked.ToString().ToLower() + nowalinia +
"pvp=" + enablePvp.Checked.ToString().ToLower() + nowalinia +
"level-type=default" + nowalinia +
"hardcore=" + hardcore.Checked.ToString().ToLower() + nowalinia +
"enable-status=" + enableStatus.Checked.ToString().ToLower() + nowalinia +
"enable-command-block=" + enableCommandBlocks.Checked.ToString().ToLower() + nowalinia +
"max-players=" + maxPlayers.Value + nowalinia +
"max-world-size=" + maxWorldSize.Value + nowalinia +
"server-port=" + serverPort.Value + nowalinia +
"server-ip=" + serverIp.Text + nowalinia +
"max-build-height=" + maxBuildingHeight.Value.ToString() + nowalinia +
"spawn-npcs=" + spawnNpcs.Checked.ToString().ToLower() + nowalinia +
"allow-flight=" + allowFlight.Checked.ToString().ToLower() + nowalinia +
"level-name=" + levelName.Text + nowalinia +
"view-distance=" + viewDistance.Value + nowalinia +
"spawn-animals=" + spawnAnimals.Checked.ToString().ToLower() + nowalinia +
"white-list=" + whiteList.Checked.ToString().ToLower() + nowalinia +
"generate-structures=" + generateStructures.Checked.ToString().ToLower() + nowalinia +
"online-mode=" + onlineMode.Checked.ToString().ToLower() + nowalinia +
"motd=" + motd.Text + nowalinia;
writer.Write(serverproperties);
writer.Close();
// Tworzenie pliku server.properties
var nowalinia = Environment.NewLine;
downloader.DownloadFileCompleted += (s, v) => {
progressBar1.Visible = false;
MessageBox.Show("Server " + serverNameTB.Text + " has been created in: " + serverPathTB.Text + ". After pressing the OK button you'll be taken to the control panel.");
StreamWriter writer = new StreamWriter(serverPathTB.Text + "\\server.properties");
string serverproperties =
"#Minecraft server properties" + nowalinia +
"#" + DateTime.Now + nowalinia +
"spawn-protection=" + spawnProtection.Value + nowalinia +
"generator-settings=" + generatorSettings.Text + nowalinia +
"force-gamemode=" + forceGamemode.Checked.ToString().ToLower() + nowalinia +
"allow-nether=" + allowNether.Checked.ToString().ToLower() + nowalinia +
"gamemode=" + gamemode.SelectedIndex.ToString() + nowalinia +
"difficulty=" + difficulty.SelectedIndex.ToString() + nowalinia +
"spawn-monstars=" + spawnMonsters.Checked.ToString().ToLower() + nowalinia +
"pvp=" + enablePvp.Checked.ToString().ToLower() + nowalinia +
"level-type=default" + nowalinia +
"hardcore=" + hardcore.Checked.ToString().ToLower() + nowalinia +
"enable-status=" + enableStatus.Checked.ToString().ToLower() + nowalinia +
"enable-command-block=" + enableCommandBlocks.Checked.ToString().ToLower() + nowalinia +
"max-players=" + maxPlayers.Value + nowalinia +
"max-world-size=" + maxWorldSize.Value + nowalinia +
"server-port=" + serverPort.Value + nowalinia +
"server-ip=" + serverIp.Text + nowalinia +
"max-build-height=" + maxBuildingHeight.Value.ToString() + nowalinia +
"spawn-npcs=" + spawnNpcs.Checked.ToString().ToLower() + nowalinia +
"allow-flight=" + allowFlight.Checked.ToString().ToLower() + nowalinia +
"level-name=" + levelName.Text + nowalinia +
"view-distance=" + viewDistance.Value + nowalinia +
"spawn-animals=" + spawnAnimals.Checked.ToString().ToLower() + nowalinia +
"white-list=" + whiteList.Checked.ToString().ToLower() + nowalinia +
"generate-structures=" + generateStructures.Checked.ToString().ToLower() + nowalinia +
"online-mode=" + onlineMode.Checked.ToString().ToLower() + nowalinia +
"motd=" + motd.Text + nowalinia;
writer.Write(serverproperties);
writer.Close();
ControlPanelForm controlPanel = new ControlPanelForm(serverPathTB.Text + "\\servmanager.srv");
controlPanel.Show();
downloader.DownloadFileCompleted += (s, v) =>
{
progressBar1.Visible = false;
MessageBox.Show("Server " + serverNameTB.Text + " has been created in: " + serverPathTB.Text + ". After pressing the OK button you'll be taken to the control panel.");
this.Close();
};
ControlPanelForm controlPanel = new ControlPanelForm(serverPathTB.Text + "\\servmanager.srv");
controlPanel.Show();
this.Visible = false;
};
}
else
MessageBox.Show("You have to accept an EULA, to run a server.", "Accept EULA", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
MessageBox.Show("The required fields have not been completed! Complete them and try again.", "Required fields are empty", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
else
MessageBox.Show("Nie wypełniono wymaganych pól! Uzupełnij je i dopiero wtedy możesz utworzyć serwer");
}
private void selectPath(object sender, EventArgs e)
@@ -151,22 +162,28 @@ namespace ServCreator
public class Creator
{
[JsonProperty]
public string Versions { get; set; }
public string[] Versions { get; set; }
[JsonProperty]
public string Engines { get; set; }
public string[] Engines { get; set; }
}
private void CreateForm_Load(object sender, EventArgs e)
{
serverEngineCB.SelectedIndex = 0;
serverVersionCB.SelectedIndex = 0;
string json = new WebClient().DownloadString("https://raw.githubusercontent.com/KrzysiekSiemv/ServCreator-for-Minecraft/main/creator.json");
var x = JsonConvert.DeserializeObject<Creator>(json);
foreach (var engine in x.Engines) { serverEngineCB.Items.Add(engine); }
foreach (var version in x.Versions) { serverVersionCB.Items.Add(version); }
Creator x = JsonConvert.DeserializeObject<Creator>(json);
for(int i = 0; i < x.Versions.Length; i++)
serverVersionCB.Items.Add(x.Versions[i]);
for (int i = 0; i < x.Engines.Length; i++)
serverEngineCB.Items.Add(x.Engines[i]);
serverVersionCB.SelectedIndex = 1;
serverEngineCB.SelectedIndex = 0;
difficulty.SelectedIndex = 2;
gamemode.SelectedIndex = 0;
}
private void CreateForm_FormClosing(object sender, FormClosingEventArgs e)
+16 -2
View File
@@ -34,6 +34,7 @@ namespace ServCreator
this.createBtn = new System.Windows.Forms.Button();
this.loadBtn = new System.Windows.Forms.Button();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label1
@@ -48,7 +49,7 @@ namespace ServCreator
// createBtn
//
this.createBtn.ForeColor = System.Drawing.Color.Black;
this.createBtn.Location = new System.Drawing.Point(141, 50);
this.createBtn.Location = new System.Drawing.Point(176, 50);
this.createBtn.Name = "createBtn";
this.createBtn.Size = new System.Drawing.Size(64, 25);
this.createBtn.TabIndex = 2;
@@ -59,7 +60,7 @@ namespace ServCreator
// loadBtn
//
this.loadBtn.ForeColor = System.Drawing.Color.Black;
this.loadBtn.Location = new System.Drawing.Point(71, 50);
this.loadBtn.Location = new System.Drawing.Point(106, 50);
this.loadBtn.Name = "loadBtn";
this.loadBtn.Size = new System.Drawing.Size(64, 25);
this.loadBtn.TabIndex = 4;
@@ -73,12 +74,24 @@ namespace ServCreator
this.openFileDialog1.Filter = "ServManager File (servmanager.srv)|servmanager.srv";
this.openFileDialog1.FilterIndex = 0;
//
// button1
//
this.button1.ForeColor = System.Drawing.Color.Black;
this.button1.Location = new System.Drawing.Point(36, 50);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(64, 25);
this.button1.TabIndex = 5;
this.button1.Text = "Add";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40)))));
this.ClientSize = new System.Drawing.Size(276, 104);
this.Controls.Add(this.button1);
this.Controls.Add(this.loadBtn);
this.Controls.Add(this.createBtn);
this.Controls.Add(this.label1);
@@ -106,6 +119,7 @@ namespace ServCreator
private System.Windows.Forms.Button createBtn;
private System.Windows.Forms.Button loadBtn;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.Button button1;
}
}
+7
View File
@@ -67,5 +67,12 @@ namespace ServCreator
process.Start();
Application.Exit();
}
private void button1_Click(object sender, EventArgs e)
{
AddServerForm addServer = new AddServerForm();
addServer.Show();
this.Visible = false;
}
}
}
+22 -592
View File
@@ -33,62 +33,15 @@ namespace ServCreator
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PropertiesEditorForm));
this.label1 = new System.Windows.Forms.Label();
this.panel1 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
this.panel3 = new System.Windows.Forms.Panel();
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.simple = new System.Windows.Forms.TabPage();
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
this.motd = new System.Windows.Forms.RichTextBox();
this.label12 = new System.Windows.Forms.Label();
this.onlineMode = new System.Windows.Forms.CheckBox();
this.generateStructures = new System.Windows.Forms.CheckBox();
this.whiteList = new System.Windows.Forms.CheckBox();
this.spawnAnimals = new System.Windows.Forms.CheckBox();
this.viewDistance = new System.Windows.Forms.NumericUpDown();
this.label11 = new System.Windows.Forms.Label();
this.levelName = new System.Windows.Forms.TextBox();
this.label10 = new System.Windows.Forms.Label();
this.allowFlight = new System.Windows.Forms.CheckBox();
this.spawnNpcs = new System.Windows.Forms.CheckBox();
this.serverIp = new System.Windows.Forms.TextBox();
this.label9 = new System.Windows.Forms.Label();
this.serverPort = new System.Windows.Forms.NumericUpDown();
this.label8 = new System.Windows.Forms.Label();
this.maxWorldSize = new System.Windows.Forms.NumericUpDown();
this.label7 = new System.Windows.Forms.Label();
this.maxPlayers = new System.Windows.Forms.NumericUpDown();
this.label6 = new System.Windows.Forms.Label();
this.enableCommandBlocks = new System.Windows.Forms.CheckBox();
this.enableStatus = new System.Windows.Forms.CheckBox();
this.hardcore = new System.Windows.Forms.CheckBox();
this.enablePvp = new System.Windows.Forms.CheckBox();
this.spawnMonsters = new System.Windows.Forms.CheckBox();
this.difficulty = new System.Windows.Forms.ComboBox();
this.label5 = new System.Windows.Forms.Label();
this.gamemode = new System.Windows.Forms.ComboBox();
this.label4 = new System.Windows.Forms.Label();
this.allowNether = new System.Windows.Forms.CheckBox();
this.forceGamemode = new System.Windows.Forms.CheckBox();
this.generatorSettings = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.spawnProtection = new System.Windows.Forms.NumericUpDown();
this.label2 = new System.Windows.Forms.Label();
this.advanced = new System.Windows.Forms.TabPage();
this.panel2 = new System.Windows.Forms.Panel();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.panel3.SuspendLayout();
this.contextMenuStrip1.SuspendLayout();
this.tabControl1.SuspendLayout();
this.simple.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.viewDistance)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.serverPort)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.maxWorldSize)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.maxPlayers)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.spawnProtection)).BeginInit();
this.advanced.SuspendLayout();
this.SuspendLayout();
//
// label1
@@ -111,14 +64,6 @@ namespace ServCreator
this.panel1.Size = new System.Drawing.Size(12, 382);
this.panel1.TabIndex = 1;
//
// panel2
//
this.panel2.Dock = System.Windows.Forms.DockStyle.Right;
this.panel2.Location = new System.Drawing.Point(523, 45);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(9, 382);
this.panel2.TabIndex = 2;
//
// panel3
//
this.panel3.Controls.Add(this.button2);
@@ -151,15 +96,6 @@ namespace ServCreator
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// richTextBox1
//
this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.richTextBox1.Location = new System.Drawing.Point(3, 3);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(497, 350);
this.richTextBox1.TabIndex = 4;
this.richTextBox1.Text = "";
//
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -173,481 +109,22 @@ namespace ServCreator
this.copyToolStripMenuItem.Size = new System.Drawing.Size(102, 22);
this.copyToolStripMenuItem.Text = "Copy";
//
// tabControl1
//
this.tabControl1.Controls.Add(this.simple);
this.tabControl1.Controls.Add(this.advanced);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(12, 45);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(511, 382);
this.tabControl1.TabIndex = 5;
//
// simple
//
this.simple.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40)))));
this.simple.Controls.Add(this.linkLabel1);
this.simple.Controls.Add(this.motd);
this.simple.Controls.Add(this.label12);
this.simple.Controls.Add(this.onlineMode);
this.simple.Controls.Add(this.generateStructures);
this.simple.Controls.Add(this.whiteList);
this.simple.Controls.Add(this.spawnAnimals);
this.simple.Controls.Add(this.viewDistance);
this.simple.Controls.Add(this.label11);
this.simple.Controls.Add(this.levelName);
this.simple.Controls.Add(this.label10);
this.simple.Controls.Add(this.allowFlight);
this.simple.Controls.Add(this.spawnNpcs);
this.simple.Controls.Add(this.serverIp);
this.simple.Controls.Add(this.label9);
this.simple.Controls.Add(this.serverPort);
this.simple.Controls.Add(this.label8);
this.simple.Controls.Add(this.maxWorldSize);
this.simple.Controls.Add(this.label7);
this.simple.Controls.Add(this.maxPlayers);
this.simple.Controls.Add(this.label6);
this.simple.Controls.Add(this.enableCommandBlocks);
this.simple.Controls.Add(this.enableStatus);
this.simple.Controls.Add(this.hardcore);
this.simple.Controls.Add(this.enablePvp);
this.simple.Controls.Add(this.spawnMonsters);
this.simple.Controls.Add(this.difficulty);
this.simple.Controls.Add(this.label5);
this.simple.Controls.Add(this.gamemode);
this.simple.Controls.Add(this.label4);
this.simple.Controls.Add(this.allowNether);
this.simple.Controls.Add(this.forceGamemode);
this.simple.Controls.Add(this.generatorSettings);
this.simple.Controls.Add(this.label3);
this.simple.Controls.Add(this.spawnProtection);
this.simple.Controls.Add(this.label2);
this.simple.ForeColor = System.Drawing.Color.White;
this.simple.Location = new System.Drawing.Point(4, 22);
this.simple.Name = "simple";
this.simple.Padding = new System.Windows.Forms.Padding(3);
this.simple.Size = new System.Drawing.Size(503, 356);
this.simple.TabIndex = 1;
this.simple.Text = "Simple configuration";
//
// linkLabel1
//
this.linkLabel1.AutoSize = true;
this.linkLabel1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.linkLabel1.LinkColor = System.Drawing.Color.White;
this.linkLabel1.Location = new System.Drawing.Point(402, 225);
this.linkLabel1.Name = "linkLabel1";
this.linkLabel1.Size = new System.Drawing.Size(88, 13);
this.linkLabel1.TabIndex = 35;
this.linkLabel1.TabStop = true;
this.linkLabel1.Text = "MOTD Creator";
this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
//
// motd
//
this.motd.Location = new System.Drawing.Point(261, 126);
this.motd.Name = "motd";
this.motd.Size = new System.Drawing.Size(229, 96);
this.motd.TabIndex = 34;
this.motd.Text = "A Minecraft Server";
//
// label12
//
this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(258, 109);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(137, 13);
this.label12.TabIndex = 33;
this.label12.Text = "Message of the Day (motd):";
//
// onlineMode
//
this.onlineMode.AutoSize = true;
this.onlineMode.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.onlineMode.Location = new System.Drawing.Point(401, 82);
this.onlineMode.Name = "onlineMode";
this.onlineMode.Size = new System.Drawing.Size(89, 17);
this.onlineMode.TabIndex = 32;
this.onlineMode.Text = "Online-Mode:";
this.onlineMode.UseVisualStyleBackColor = true;
//
// generateStructures
//
this.generateStructures.AutoSize = true;
this.generateStructures.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.generateStructures.Checked = true;
this.generateStructures.CheckState = System.Windows.Forms.CheckState.Checked;
this.generateStructures.Location = new System.Drawing.Point(258, 81);
this.generateStructures.Name = "generateStructures";
this.generateStructures.Size = new System.Drawing.Size(124, 17);
this.generateStructures.TabIndex = 31;
this.generateStructures.Text = "Generate Structures:";
this.generateStructures.UseVisualStyleBackColor = true;
//
// whiteList
//
this.whiteList.AutoSize = true;
this.whiteList.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.whiteList.Location = new System.Drawing.Point(418, 59);
this.whiteList.Name = "whiteList";
this.whiteList.Size = new System.Drawing.Size(72, 17);
this.whiteList.TabIndex = 30;
this.whiteList.Text = "White-list:";
this.whiteList.UseVisualStyleBackColor = true;
//
// spawnAnimals
//
this.spawnAnimals.AutoSize = true;
this.spawnAnimals.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.spawnAnimals.Checked = true;
this.spawnAnimals.CheckState = System.Windows.Forms.CheckState.Checked;
this.spawnAnimals.Location = new System.Drawing.Point(281, 59);
this.spawnAnimals.Name = "spawnAnimals";
this.spawnAnimals.Size = new System.Drawing.Size(101, 17);
this.spawnAnimals.TabIndex = 29;
this.spawnAnimals.Text = "Spawn Animals:";
this.spawnAnimals.UseVisualStyleBackColor = true;
//
// viewDistance
//
this.viewDistance.Location = new System.Drawing.Point(369, 33);
this.viewDistance.Maximum = new decimal(new int[] {
64,
0,
0,
0});
this.viewDistance.Name = "viewDistance";
this.viewDistance.Size = new System.Drawing.Size(60, 20);
this.viewDistance.TabIndex = 28;
this.viewDistance.Value = new decimal(new int[] {
10,
0,
0,
0});
//
// label11
//
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(287, 36);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(76, 13);
this.label11.TabIndex = 27;
this.label11.Text = "View distance:";
//
// levelName
//
this.levelName.Location = new System.Drawing.Point(369, 6);
this.levelName.Name = "levelName";
this.levelName.Size = new System.Drawing.Size(121, 20);
this.levelName.TabIndex = 26;
this.levelName.Text = "world";
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(296, 9);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(67, 13);
this.label10.TabIndex = 25;
this.label10.Text = "Level Name:";
//
// allowFlight
//
this.allowFlight.AutoSize = true;
this.allowFlight.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.allowFlight.Location = new System.Drawing.Point(170, 309);
this.allowFlight.Name = "allowFlight";
this.allowFlight.Size = new System.Drawing.Size(82, 17);
this.allowFlight.TabIndex = 24;
this.allowFlight.Text = "Allow Flight:";
this.allowFlight.UseVisualStyleBackColor = true;
//
// spawnNpcs
//
this.spawnNpcs.AutoSize = true;
this.spawnNpcs.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.spawnNpcs.Checked = true;
this.spawnNpcs.CheckState = System.Windows.Forms.CheckState.Checked;
this.spawnNpcs.Location = new System.Drawing.Point(53, 309);
this.spawnNpcs.Name = "spawnNpcs";
this.spawnNpcs.Size = new System.Drawing.Size(92, 17);
this.spawnNpcs.TabIndex = 23;
this.spawnNpcs.Text = "Spawn NPCs:";
this.spawnNpcs.UseVisualStyleBackColor = true;
//
// serverIp
//
this.serverIp.Location = new System.Drawing.Point(131, 283);
this.serverIp.MaxLength = 15;
this.serverIp.Name = "serverIp";
this.serverIp.Size = new System.Drawing.Size(121, 20);
this.serverIp.TabIndex = 22;
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(69, 286);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(54, 13);
this.label9.TabIndex = 21;
this.label9.Text = "Server IP:";
//
// serverPort
//
this.serverPort.Location = new System.Drawing.Point(131, 257);
this.serverPort.Maximum = new decimal(new int[] {
69420,
0,
0,
0});
this.serverPort.Name = "serverPort";
this.serverPort.Size = new System.Drawing.Size(60, 20);
this.serverPort.TabIndex = 20;
this.serverPort.Value = new decimal(new int[] {
25565,
0,
0,
0});
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(62, 259);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(63, 13);
this.label8.TabIndex = 19;
this.label8.Text = "Server Port:";
//
// maxWorldSize
//
this.maxWorldSize.Location = new System.Drawing.Point(131, 231);
this.maxWorldSize.Maximum = new decimal(new int[] {
1410065408,
2,
0,
0});
this.maxWorldSize.Name = "maxWorldSize";
this.maxWorldSize.Size = new System.Drawing.Size(121, 20);
this.maxWorldSize.TabIndex = 18;
this.maxWorldSize.Value = new decimal(new int[] {
29999984,
0,
0,
0});
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(41, 233);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(84, 13);
this.label7.TabIndex = 17;
this.label7.Text = "Max World Size:";
//
// maxPlayers
//
this.maxPlayers.Location = new System.Drawing.Point(131, 205);
this.maxPlayers.Maximum = new decimal(new int[] {
100000,
0,
0,
0});
this.maxPlayers.Name = "maxPlayers";
this.maxPlayers.Size = new System.Drawing.Size(60, 20);
this.maxPlayers.TabIndex = 16;
this.maxPlayers.Value = new decimal(new int[] {
20,
0,
0,
0});
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(58, 207);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(67, 13);
this.label6.TabIndex = 15;
this.label6.Text = "Max Players:";
//
// enableCommandBlocks
//
this.enableCommandBlocks.AutoSize = true;
this.enableCommandBlocks.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.enableCommandBlocks.Location = new System.Drawing.Point(105, 182);
this.enableCommandBlocks.Name = "enableCommandBlocks";
this.enableCommandBlocks.Size = new System.Drawing.Size(147, 17);
this.enableCommandBlocks.TabIndex = 14;
this.enableCommandBlocks.Text = "Enable Command Blocks:";
this.enableCommandBlocks.UseVisualStyleBackColor = true;
//
// enableStatus
//
this.enableStatus.AutoSize = true;
this.enableStatus.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.enableStatus.Checked = true;
this.enableStatus.CheckState = System.Windows.Forms.CheckState.Checked;
this.enableStatus.Location = new System.Drawing.Point(159, 159);
this.enableStatus.Name = "enableStatus";
this.enableStatus.Size = new System.Drawing.Size(93, 17);
this.enableStatus.TabIndex = 13;
this.enableStatus.Text = "Enable status:";
this.enableStatus.UseVisualStyleBackColor = true;
//
// hardcore
//
this.hardcore.AutoSize = true;
this.hardcore.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.hardcore.Location = new System.Drawing.Point(72, 159);
this.hardcore.Name = "hardcore";
this.hardcore.Size = new System.Drawing.Size(73, 17);
this.hardcore.TabIndex = 12;
this.hardcore.Text = "Hardcore:";
this.hardcore.UseVisualStyleBackColor = true;
//
// enablePvp
//
this.enablePvp.AutoSize = true;
this.enablePvp.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.enablePvp.Checked = true;
this.enablePvp.CheckState = System.Windows.Forms.CheckState.Checked;
this.enablePvp.Location = new System.Drawing.Point(167, 136);
this.enablePvp.Name = "enablePvp";
this.enablePvp.Size = new System.Drawing.Size(85, 17);
this.enablePvp.TabIndex = 11;
this.enablePvp.Text = "Enable PvP:";
this.enablePvp.UseVisualStyleBackColor = true;
//
// spawnMonsters
//
this.spawnMonsters.AutoSize = true;
this.spawnMonsters.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.spawnMonsters.Checked = true;
this.spawnMonsters.CheckState = System.Windows.Forms.CheckState.Checked;
this.spawnMonsters.Location = new System.Drawing.Point(37, 136);
this.spawnMonsters.Name = "spawnMonsters";
this.spawnMonsters.Size = new System.Drawing.Size(108, 17);
this.spawnMonsters.TabIndex = 10;
this.spawnMonsters.Text = "Spawn Monsters:";
this.spawnMonsters.UseVisualStyleBackColor = true;
//
// difficulty
//
this.difficulty.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.difficulty.FormattingEnabled = true;
this.difficulty.Items.AddRange(new object[] {
"peaceful",
"easy",
"normal",
"hard"});
this.difficulty.Location = new System.Drawing.Point(131, 109);
this.difficulty.Name = "difficulty";
this.difficulty.Size = new System.Drawing.Size(121, 21);
this.difficulty.TabIndex = 9;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(75, 112);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(50, 13);
this.label5.TabIndex = 8;
this.label5.Text = "Difficulty:";
//
// gamemode
//
this.gamemode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.gamemode.FormattingEnabled = true;
this.gamemode.Items.AddRange(new object[] {
"survival",
"adventure",
"creative"});
this.gamemode.Location = new System.Drawing.Point(131, 82);
this.gamemode.Name = "gamemode";
this.gamemode.Size = new System.Drawing.Size(121, 21);
this.gamemode.TabIndex = 1;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(61, 85);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(64, 13);
this.label4.TabIndex = 6;
this.label4.Text = "Gamemode:";
//
// allowNether
//
this.allowNether.AutoSize = true;
this.allowNether.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.allowNether.Checked = true;
this.allowNether.CheckState = System.Windows.Forms.CheckState.Checked;
this.allowNether.Location = new System.Drawing.Point(163, 59);
this.allowNether.Name = "allowNether";
this.allowNether.Size = new System.Drawing.Size(89, 17);
this.allowNether.TabIndex = 5;
this.allowNether.Text = "Allow Nether:";
this.allowNether.UseVisualStyleBackColor = true;
//
// forceGamemode
//
this.forceGamemode.AutoSize = true;
this.forceGamemode.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.forceGamemode.Location = new System.Drawing.Point(32, 59);
this.forceGamemode.Name = "forceGamemode";
this.forceGamemode.Size = new System.Drawing.Size(113, 17);
this.forceGamemode.TabIndex = 4;
this.forceGamemode.Text = "Force Gamemode:";
this.forceGamemode.UseVisualStyleBackColor = true;
//
// generatorSettings
//
this.generatorSettings.Location = new System.Drawing.Point(131, 33);
this.generatorSettings.Name = "generatorSettings";
this.generatorSettings.Size = new System.Drawing.Size(121, 20);
this.generatorSettings.TabIndex = 3;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(27, 36);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(98, 13);
this.label3.TabIndex = 2;
this.label3.Text = "Generator Settings:";
//
// spawnProtection
//
this.spawnProtection.Location = new System.Drawing.Point(131, 7);
this.spawnProtection.Name = "spawnProtection";
this.spawnProtection.Size = new System.Drawing.Size(60, 20);
this.spawnProtection.TabIndex = 1;
this.spawnProtection.Value = new decimal(new int[] {
16,
0,
0,
0});
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(31, 9);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(94, 13);
this.label2.TabIndex = 0;
this.label2.Text = "Spawn Protection:";
//
// advanced
//
this.advanced.Controls.Add(this.richTextBox1);
this.advanced.Location = new System.Drawing.Point(4, 22);
this.advanced.Name = "advanced";
this.advanced.Padding = new System.Windows.Forms.Padding(3);
this.advanced.Size = new System.Drawing.Size(503, 356);
this.advanced.TabIndex = 0;
this.advanced.Text = "Full server.properties file";
this.advanced.UseVisualStyleBackColor = true;
// panel2
//
this.panel2.Dock = System.Windows.Forms.DockStyle.Right;
this.panel2.Location = new System.Drawing.Point(523, 45);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(9, 382);
this.panel2.TabIndex = 2;
//
// richTextBox1
//
this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.richTextBox1.Location = new System.Drawing.Point(12, 45);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(511, 382);
this.richTextBox1.TabIndex = 5;
this.richTextBox1.Text = "";
//
// PropertiesEditorForm
//
@@ -655,26 +132,18 @@ namespace ServCreator
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40)))));
this.ClientSize = new System.Drawing.Size(532, 467);
this.Controls.Add(this.tabControl1);
this.Controls.Add(this.richTextBox1);
this.Controls.Add(this.panel2);
this.Controls.Add(this.panel1);
this.Controls.Add(this.label1);
this.Controls.Add(this.panel3);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "PropertiesEditorForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Server Properties Editor - ServManager";
this.Load += new System.EventHandler(this.PropertiesEditorForm_Load);
this.panel3.ResumeLayout(false);
this.contextMenuStrip1.ResumeLayout(false);
this.tabControl1.ResumeLayout(false);
this.simple.ResumeLayout(false);
this.simple.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.viewDistance)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.serverPort)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.maxWorldSize)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.maxPlayers)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.spawnProtection)).EndInit();
this.advanced.ResumeLayout(false);
this.ResumeLayout(false);
}
@@ -683,51 +152,12 @@ namespace ServCreator
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage simple;
private System.Windows.Forms.TabPage advanced;
private System.Windows.Forms.CheckBox enableStatus;
private System.Windows.Forms.CheckBox hardcore;
private System.Windows.Forms.CheckBox enablePvp;
private System.Windows.Forms.CheckBox spawnMonsters;
private System.Windows.Forms.ComboBox difficulty;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.ComboBox gamemode;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.CheckBox allowNether;
private System.Windows.Forms.CheckBox forceGamemode;
private System.Windows.Forms.TextBox generatorSettings;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.NumericUpDown spawnProtection;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.CheckBox enableCommandBlocks;
private System.Windows.Forms.LinkLabel linkLabel1;
private System.Windows.Forms.RichTextBox motd;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.CheckBox onlineMode;
private System.Windows.Forms.CheckBox generateStructures;
private System.Windows.Forms.CheckBox whiteList;
private System.Windows.Forms.CheckBox spawnAnimals;
private System.Windows.Forms.NumericUpDown viewDistance;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.TextBox levelName;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.CheckBox allowFlight;
private System.Windows.Forms.CheckBox spawnNpcs;
private System.Windows.Forms.TextBox serverIp;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.NumericUpDown serverPort;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.NumericUpDown maxWorldSize;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.NumericUpDown maxPlayers;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.RichTextBox richTextBox1;
}
}
@@ -23,7 +23,6 @@ namespace ServCreator
StreamReader streamReader = new StreamReader(pathToEdit);
richTextBox1.Text = streamReader.ReadToEnd();
streamReader.Close();
}
void saveIt()
@@ -33,31 +32,7 @@ namespace ServCreator
writer.Close();
}
void simpleSave()
{
MessageBox.Show("Server Properties has been saved.");
}
private void button1_Click(object sender, EventArgs e) {
if (tabControl1.SelectedIndex == 1)
saveIt();
else
simpleSave();
}
private void button2_Click(object sender, EventArgs e)
{
if (tabControl1.SelectedIndex == 1)
saveIt();
else
simpleSave();
this.Close();
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Process.Start("https://minecraft.tools/en/motd.php");
}
private void button1_Click(object sender, EventArgs e) { saveIt(); }
private void button2_Click(object sender, EventArgs e) { saveIt(); this.Close(); }
}
}
@@ -47,6 +47,12 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AddServerForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="AddServerForm.Designer.cs">
<DependentUpon>AddServerForm.cs</DependentUpon>
</Compile>
<Compile Include="ControlPanelForm.cs">
<SubType>Form</SubType>
</Compile>
@@ -79,6 +85,15 @@
<Compile Include="ServerManagementForm.Designer.cs">
<DependentUpon>ServerManagementForm.cs</DependentUpon>
</Compile>
<Compile Include="UpgradeServerEngineForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UpgradeServerEngineForm.Designer.cs">
<DependentUpon>UpgradeServerEngineForm.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="AddServerForm.resx">
<DependentUpon>AddServerForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="ControlPanelForm.resx">
<DependentUpon>ControlPanelForm.cs</DependentUpon>
</EmbeddedResource>
@@ -103,6 +118,9 @@
<EmbeddedResource Include="ServerManagementForm.resx">
<DependentUpon>ServerManagementForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UpgradeServerEngineForm.resx">
<DependentUpon>UpgradeServerEngineForm.cs</DependentUpon>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
+33 -4
View File
@@ -54,6 +54,8 @@ namespace ServCreator
this.banPlayerBtn = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.reasonPlayerTxt = new System.Windows.Forms.RichTextBox();
this.unbanIpBtn = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.ipBanBox.SuspendLayout();
this.playerMgmtBox.SuspendLayout();
this.groupBox5.SuspendLayout();
@@ -65,6 +67,7 @@ namespace ServCreator
//
// ipBanBox
//
this.ipBanBox.Controls.Add(this.unbanIpBtn);
this.ipBanBox.Controls.Add(this.label4);
this.ipBanBox.Controls.Add(this.ipTxt);
this.ipBanBox.Controls.Add(this.banIPBtn);
@@ -99,7 +102,7 @@ namespace ServCreator
this.banIPBtn.ForeColor = System.Drawing.Color.Black;
this.banIPBtn.Location = new System.Drawing.Point(6, 103);
this.banIPBtn.Name = "banIPBtn";
this.banIPBtn.Size = new System.Drawing.Size(145, 23);
this.banIPBtn.Size = new System.Drawing.Size(68, 23);
this.banIPBtn.TabIndex = 2;
this.banIPBtn.Text = "Ban";
this.banIPBtn.UseVisualStyleBackColor = true;
@@ -275,6 +278,7 @@ namespace ServCreator
//
// groupBox3
//
this.groupBox3.Controls.Add(this.button1);
this.groupBox3.Controls.Add(this.kickBtn);
this.groupBox3.Controls.Add(this.banPlayerBtn);
this.groupBox3.Controls.Add(this.label2);
@@ -290,9 +294,9 @@ namespace ServCreator
// kickBtn
//
this.kickBtn.ForeColor = System.Drawing.Color.Black;
this.kickBtn.Location = new System.Drawing.Point(77, 101);
this.kickBtn.Location = new System.Drawing.Point(6, 72);
this.kickBtn.Name = "kickBtn";
this.kickBtn.Size = new System.Drawing.Size(62, 23);
this.kickBtn.Size = new System.Drawing.Size(133, 23);
this.kickBtn.TabIndex = 3;
this.kickBtn.Text = "Kick";
this.kickBtn.UseVisualStyleBackColor = true;
@@ -323,10 +327,30 @@ namespace ServCreator
this.reasonPlayerTxt.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.reasonPlayerTxt.Location = new System.Drawing.Point(6, 36);
this.reasonPlayerTxt.Name = "reasonPlayerTxt";
this.reasonPlayerTxt.Size = new System.Drawing.Size(133, 59);
this.reasonPlayerTxt.Size = new System.Drawing.Size(133, 30);
this.reasonPlayerTxt.TabIndex = 0;
this.reasonPlayerTxt.Text = "";
//
// unbanIpBtn
//
this.unbanIpBtn.ForeColor = System.Drawing.Color.Black;
this.unbanIpBtn.Location = new System.Drawing.Point(83, 102);
this.unbanIpBtn.Name = "unbanIpBtn";
this.unbanIpBtn.Size = new System.Drawing.Size(68, 23);
this.unbanIpBtn.TabIndex = 5;
this.unbanIpBtn.Text = "Unban";
this.unbanIpBtn.UseVisualStyleBackColor = true;
//
// button1
//
this.button1.ForeColor = System.Drawing.Color.Black;
this.button1.Location = new System.Drawing.Point(77, 101);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(62, 23);
this.button1.TabIndex = 4;
this.button1.Text = "Unban";
this.button1.UseVisualStyleBackColor = true;
//
// ServerManagementForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -337,8 +361,11 @@ namespace ServCreator
this.ForeColor = System.Drawing.Color.White;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(525, 274);
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(525, 274);
this.Name = "ServerManagementForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Manage with Server - ServManager for Minecraft";
this.Load += new System.EventHandler(this.ServerManagementForm_Load);
this.ipBanBox.ResumeLayout(false);
@@ -382,5 +409,7 @@ namespace ServCreator
private System.Windows.Forms.Button gmBtn;
private System.Windows.Forms.ComboBox gmBox;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.Button unbanIpBtn;
private System.Windows.Forms.Button button1;
}
}
@@ -1,11 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;
@@ -14,14 +7,13 @@ namespace ServCreator
public partial class ServerManagementForm : Form
{
Process process;
string config;
public ServerManagementForm(Process server)
{
InitializeComponent();
process = server;
}
private void ServerManagementForm_Load(object sender, EventArgs e) { }
private void ServerManagementForm_Load(object sender, EventArgs e) { gmBox.SelectedIndex = 0; }
private void banPlayerBtn_Click(object sender, EventArgs e)
@@ -0,0 +1,157 @@
namespace ServCreator
{
partial class UpgradeServerEngineForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UpgradeServerEngineForm));
this.label1 = new System.Windows.Forms.Label();
this.currentEngineLabel = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.serverEngineCB = new System.Windows.Forms.ComboBox();
this.serverVersionCB = new System.Windows.Forms.ComboBox();
this.label4 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(13, 9);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(223, 20);
this.label1.TabIndex = 0;
this.label1.Text = "Currently installed server engine:";
//
// currentEngineLabel
//
this.currentEngineLabel.AutoSize = true;
this.currentEngineLabel.Location = new System.Drawing.Point(29, 37);
this.currentEngineLabel.Name = "currentEngineLabel";
this.currentEngineLabel.Size = new System.Drawing.Size(148, 20);
this.currentEngineLabel.TabIndex = 1;
this.currentEngineLabel.Text = "{ENGINE}, {VERSION}";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(17, 69);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(63, 20);
this.label3.TabIndex = 2;
this.label3.Text = "Engine*:";
//
// serverEngineCB
//
this.serverEngineCB.FormattingEnabled = true;
this.serverEngineCB.Location = new System.Drawing.Point(15, 92);
this.serverEngineCB.Name = "serverEngineCB";
this.serverEngineCB.Size = new System.Drawing.Size(162, 28);
this.serverEngineCB.TabIndex = 3;
//
// serverVersionCB
//
this.serverVersionCB.FormattingEnabled = true;
this.serverVersionCB.Location = new System.Drawing.Point(183, 92);
this.serverVersionCB.Name = "serverVersionCB";
this.serverVersionCB.Size = new System.Drawing.Size(162, 28);
this.serverVersionCB.TabIndex = 5;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(185, 69);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(66, 20);
this.label4.TabIndex = 4;
this.label4.Text = "Version*:";
//
// button1
//
this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
this.button1.ForeColor = System.Drawing.Color.Black;
this.button1.Location = new System.Drawing.Point(270, 126);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 6;
this.button1.Text = "Update";
this.button1.UseVisualStyleBackColor = true;
//
// progressBar1
//
this.progressBar1.Location = new System.Drawing.Point(15, 126);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(249, 23);
this.progressBar1.TabIndex = 7;
this.progressBar1.Visible = false;
//
// UpgradeServerEngineForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40)))));
this.ClientSize = new System.Drawing.Size(355, 157);
this.Controls.Add(this.progressBar1);
this.Controls.Add(this.button1);
this.Controls.Add(this.serverVersionCB);
this.Controls.Add(this.label4);
this.Controls.Add(this.serverEngineCB);
this.Controls.Add(this.label3);
this.Controls.Add(this.currentEngineLabel);
this.Controls.Add(this.label1);
this.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.ForeColor = System.Drawing.Color.White;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "UpgradeServerEngineForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Change Server Engine - ServManager for Minecraft";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.UpgradeServerEngineForm_FormClosing);
this.Load += new System.EventHandler(this.UpgradeServerEngineForm_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label currentEngineLabel;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.ComboBox serverEngineCB;
private System.Windows.Forms.ComboBox serverVersionCB;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.ProgressBar progressBar1;
}
}
@@ -0,0 +1,125 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Net;
using Newtonsoft.Json;
using System.IO;
namespace ServCreator
{
public partial class UpgradeServerEngineForm : Form
{
string filePath;
Server server;
public ControlPanelForm controlPanel;
public UpgradeServerEngineForm(string configFilePath)
{
InitializeComponent();
filePath = configFilePath;
}
private void UpgradeServerEngineForm_Load(object sender, EventArgs e)
{
GetItems();
GettingCurrerntEngine();
serverEngineCB.SelectedIndex = 0;
serverVersionCB.SelectedIndex = 1;
}
void GetItems()
{
string json = new WebClient().DownloadString("https://raw.githubusercontent.com/KrzysiekSiemv/ServCreator-for-Minecraft/main/creator.json");
Creator x = JsonConvert.DeserializeObject<Creator>(json);
for (int i = 0; i < x.Versions.Length; i++)
serverVersionCB.Items.Add(x.Versions[i]);
for (int i = 0; i < x.Engines.Length; i++)
serverEngineCB.Items.Add(x.Engines[i]);
}
void GettingCurrerntEngine()
{
StreamReader reader = new StreamReader(filePath);
server = JsonConvert.DeserializeObject<Server>(reader.ReadToEnd());
label1.Text = "Currently installed on " + server.Name;
currentEngineLabel.Text = server.Engine + ", " + server.Version;
reader.Close();
}
void GetOtherVersion()
{
if (serverEngineCB.Text != "" && serverVersionCB.Text != "")
{
serverVersionCB.Enabled = false;
serverEngineCB.Enabled = false;
string name = server.Name;
string path = server.Path;
File.Delete(server.Path + "\\server.jar");
// Pobieranie pliku serwerowego
progressBar1.Visible = true;
WebClient downloader = new WebClient();
downloader.DownloadProgressChanged += (s, v) => { progressBar1.Value = v.ProgressPercentage; };
downloader.DownloadFileAsync(new Uri("https://file.siemv.pl/gry/minecraft/server/" + serverVersionCB.Text + "/" + serverEngineCB.Text + "/" + "server.jar"), server.Path + "\\server.jar");
server.Name = name;
server.Path = path;
server.Engine = serverEngineCB.Text;
server.Version = serverVersionCB.Text;
StreamWriter configWriter = new StreamWriter(path + "\\servmanager.srv");
configWriter.Write(JsonConvert.SerializeObject(server));
configWriter.Close();
downloader.DownloadFileCompleted += (s, v) =>
{
progressBar1.Visible = false;
MessageBox.Show("Server engine on " + server.Name + " has been changed to: " + serverEngineCB.Text + ", " + serverVersionCB.Text + ". After pressing the OK button you'll be taken back to the control panel.");
this.Close();
};
} else
{
MessageBox.Show("These fields can't be empty.");
}
}
[JsonObject(MemberSerialization.OptIn)]
public class Server
{
[JsonProperty]
public string Name { get; set; }
[JsonProperty]
public string Path { get; set; }
[JsonProperty]
public string Version { get; set; }
[JsonProperty]
public string Engine { get; set; }
}
public class Creator
{
[JsonProperty]
public string[] Versions { get; set; }
[JsonProperty]
public string[] Engines { get; set; }
}
private void UpgradeServerEngineForm_FormClosing(object sender, FormClosingEventArgs e)
{
controlPanel.Enabled = true;
controlPanel.GetFreshConfig();
this.Close();
}
}
}
File diff suppressed because it is too large Load Diff
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
df26dbb6470533f2ee8217b502d2b28017069b09
28f17a13ab8a797f473af684890ab20ce3a64485
@@ -29,3 +29,5 @@ C:\Users\Krzysiek\Documents\GitHub\ServCreator-for-Minecraft\ServCreator\ServCre
C:\Users\Krzysiek\Documents\GitHub\ServCreator-for-Minecraft\ServCreator\ServCreator\obj\Debug\ServCreator.exe
C:\Users\Krzysiek\Documents\GitHub\ServCreator-for-Minecraft\ServCreator\ServCreator\obj\Debug\ServCreator.pdb
D:\GitHub (krzysiek-smaga@outlook.com)\ServCreator-for-Minecraft\ServCreator\ServCreator\obj\Debug\ServCreator.ServerManagementForm.resources
D:\GitHub (krzysiek-smaga@outlook.com)\ServCreator-for-Minecraft\ServCreator\ServCreator\obj\Debug\ServCreator.AddServerForm.resources
D:\GitHub (krzysiek-smaga@outlook.com)\ServCreator-for-Minecraft\ServCreator\ServCreator\obj\Debug\ServCreator.UpgradeServerEngineForm.resources
Binary file not shown.
Binary file not shown.