Zmiany w PropertiesEditorForm.cs

No to tak... Nie, tak nie powinno być. To co się stało to kurde... To będzie potrzebowało egzorcysty... A jeszcze będzie potem musiał zapisywać do pliku servmanager.srv. [screams internally]
This commit is contained in:
Christopher
2021-02-08 00:02:48 +01:00
parent 78c4e7cd93
commit 83c7dea52b
9 changed files with 519 additions and 479 deletions
Binary file not shown.
File diff suppressed because it is too large Load Diff
+51 -12
View File
@@ -1,20 +1,16 @@
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.Diagnostics;
using System.Windows.Forms;
using System.IO;
using Newtonsoft.Json;
namespace ServCreator
{
public partial class PropertiesEditorForm : Form
{
string pathToEdit;
public string pathToEdit;
StreamWriter writer;
public PropertiesEditorForm(string path, string name)
{
InitializeComponent();
@@ -27,16 +23,59 @@ namespace ServCreator
StreamReader streamReader = new StreamReader(pathToEdit);
richTextBox1.Text = streamReader.ReadToEnd();
streamReader.Close();
}
void saveIt()
{
StreamWriter streamWriter = new StreamWriter(pathToEdit);
streamWriter.Write(richTextBox1.Text);
streamWriter.Close();
writer = new StreamWriter(pathToEdit);
writer.Write(richTextBox1.Text);
writer.Close();
}
private void button1_Click(object sender, EventArgs e) { saveIt(); }
void simpleSave()
{
var nowalinia = Environment.NewLine;
writer = new StreamWriter(pathToEdit);
writer.Write("#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.Text + nowalinia +
"difficulty=" + difficulty.Text + 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 +
"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.Close();
MessageBox.Show("ja pier...")
}
private void button1_Click(object sender, EventArgs e) {
if (tabControl1.SelectedIndex == 1)
saveIt();
else
MessageBox.Show("Idź do manualnego, lol");
}
private void button2_Click(object sender, EventArgs e) { saveIt(); this.Close(); }
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
@@ -44,4 +83,4 @@ namespace ServCreator
Process.Start("https://minecraft.tools/en/motd.php");
}
}
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.