Małe kroczki do przodu
Tak ogólnie to Java się naćpała i zaczeła oddawać mi różne cyfry. Nie jestem robotem, ok? Java, weź idź na odwyk.
This commit is contained in:
Binary file not shown.
@@ -31,6 +31,11 @@ namespace ServCreator
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ControlPanelForm));
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.button3 = new System.Windows.Forms.Button();
|
||||
this.button4 = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// button1
|
||||
@@ -43,23 +48,78 @@ namespace ServCreator
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// richTextBox1
|
||||
//
|
||||
this.richTextBox1.Location = new System.Drawing.Point(156, 12);
|
||||
this.richTextBox1.Name = "richTextBox1";
|
||||
this.richTextBox1.Size = new System.Drawing.Size(632, 399);
|
||||
this.richTextBox1.TabIndex = 1;
|
||||
this.richTextBox1.Text = "";
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Location = new System.Drawing.Point(156, 417);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(537, 20);
|
||||
this.textBox1.TabIndex = 2;
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Location = new System.Drawing.Point(699, 415);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(89, 23);
|
||||
this.button2.TabIndex = 3;
|
||||
this.button2.Text = "Sumbit";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// button3
|
||||
//
|
||||
this.button3.Location = new System.Drawing.Point(12, 12);
|
||||
this.button3.Name = "button3";
|
||||
this.button3.Size = new System.Drawing.Size(75, 23);
|
||||
this.button3.TabIndex = 4;
|
||||
this.button3.Text = "Start";
|
||||
this.button3.UseVisualStyleBackColor = true;
|
||||
this.button3.Click += new System.EventHandler(this.button3_Click);
|
||||
//
|
||||
// button4
|
||||
//
|
||||
this.button4.Location = new System.Drawing.Point(12, 41);
|
||||
this.button4.Name = "button4";
|
||||
this.button4.Size = new System.Drawing.Size(75, 23);
|
||||
this.button4.TabIndex = 5;
|
||||
this.button4.Text = "Stop";
|
||||
this.button4.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// ControlPanelForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
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(800, 450);
|
||||
this.Controls.Add(this.button4);
|
||||
this.Controls.Add(this.button3);
|
||||
this.Controls.Add(this.button2);
|
||||
this.Controls.Add(this.textBox1);
|
||||
this.Controls.Add(this.richTextBox1);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.Name = "ControlPanelForm";
|
||||
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.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.RichTextBox richTextBox1;
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
private System.Windows.Forms.Button button2;
|
||||
private System.Windows.Forms.Button button3;
|
||||
private System.Windows.Forms.Button button4;
|
||||
}
|
||||
}
|
||||
@@ -9,11 +9,15 @@ using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Newtonsoft.Json;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
|
||||
namespace ServCreator
|
||||
{
|
||||
public partial class ControlPanelForm : Form
|
||||
{
|
||||
public Process process;
|
||||
|
||||
public string configFilePath;
|
||||
public string config;
|
||||
|
||||
@@ -64,5 +68,41 @@ namespace ServCreator
|
||||
public string Engine { get; set; }
|
||||
|
||||
}
|
||||
|
||||
private void button3_Click(object sender, EventArgs e)
|
||||
{
|
||||
process = new Process
|
||||
{
|
||||
StartInfo = new ProcessStartInfo
|
||||
{
|
||||
WorkingDirectory = serverPath,
|
||||
FileName = serverPath + "\\start.bat",
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true,
|
||||
RedirectStandardInput = true,
|
||||
RedirectStandardOutput = true,
|
||||
RedirectStandardError = true
|
||||
}
|
||||
};
|
||||
|
||||
Thread thread = new Thread(() =>
|
||||
{
|
||||
process.Start();
|
||||
|
||||
while (!process.StandardOutput.EndOfStream)
|
||||
{
|
||||
string line = process.StandardOutput.ReadLine();
|
||||
richTextBox1.Text += line;
|
||||
}
|
||||
});
|
||||
|
||||
thread.Start();
|
||||
}
|
||||
|
||||
private void ControlPanelForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
process.Kill();
|
||||
Application.Exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,6 +117,9 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="backgroundWorker1.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>
|
||||
|
||||
@@ -72,24 +72,6 @@ namespace ServCreator
|
||||
configWriter.Write(JsonConvert.SerializeObject(server));
|
||||
configWriter.Close();
|
||||
|
||||
// Dodawanie wartości do pliku
|
||||
if(File.Exists(Application.StartupPath + "\\servers.json"))
|
||||
{
|
||||
StreamReader serversReader = new StreamReader(Application.StartupPath + "\\servers.json");
|
||||
string serversFile = serversReader.ReadToEnd();
|
||||
|
||||
var servers = JsonConvert.DeserializeObject<List<Server>>(serversFile);
|
||||
servers.Add(new Server());
|
||||
var addedServer = JsonConvert.SerializeObject(servers);
|
||||
StreamWriter serversWriter = new StreamWriter(Application.StartupPath + "\\servers.json");
|
||||
serversWriter.Write(addedServer);
|
||||
serversWriter.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
MessageBox.Show("Serwer " + serverNameTB.Text + " został utworzony w folderze: " + serverPathTB.Text + ". Za chwilę zostaniesz przekierowany do panelu kontrolnego.");
|
||||
|
||||
ControlPanelForm controlPanel = new ControlPanelForm(serverPathTB.Text + "\\servmanager.json");
|
||||
|
||||
+7
@@ -35,6 +35,7 @@ namespace ServCreator
|
||||
this.createBtn = new System.Windows.Forms.Button();
|
||||
this.selectBtn = new System.Windows.Forms.Button();
|
||||
this.loadBtn = new System.Windows.Forms.Button();
|
||||
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
@@ -87,6 +88,11 @@ namespace ServCreator
|
||||
this.loadBtn.TabIndex = 4;
|
||||
this.loadBtn.Text = "Load";
|
||||
this.loadBtn.UseVisualStyleBackColor = true;
|
||||
this.loadBtn.Click += new System.EventHandler(this.loadBtn_Click);
|
||||
//
|
||||
// openFileDialog1
|
||||
//
|
||||
this.openFileDialog1.FileName = "openFileDialog1";
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
@@ -118,6 +124,7 @@ namespace ServCreator
|
||||
private System.Windows.Forms.Button createBtn;
|
||||
private System.Windows.Forms.Button selectBtn;
|
||||
private System.Windows.Forms.Button loadBtn;
|
||||
private System.Windows.Forms.OpenFileDialog openFileDialog1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ServCreator
|
||||
{
|
||||
@@ -22,5 +24,32 @@ namespace ServCreator
|
||||
CreateForm createFrm = new CreateForm();
|
||||
createFrm.Show();
|
||||
}
|
||||
|
||||
private void loadBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(openFileDialog1.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
ControlPanelForm controlPanel = new ControlPanelForm(openFileDialog1.FileName);
|
||||
controlPanel.Show();
|
||||
this.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
[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; }
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,6 +117,9 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="openFileDialog1.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>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user