mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-08-03 19:36:14 -04:00
Don't forget server.properties
This commit is contained in:
parent
ec10970dbd
commit
1e4f389eed
@ -93,14 +93,6 @@ namespace MCGalaxy
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SerialiseSimple(ConfigElement[] elements, string path, object instance) {
|
|
||||||
using (StreamWriter w = FileIO.CreateGuarded(path))
|
|
||||||
{
|
|
||||||
w.WriteLine("#Settings file");
|
|
||||||
SerialiseElements(elements, w, instance);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void SerialiseElements(ConfigElement[] elements, TextWriter w, object instance) {
|
public static void SerialiseElements(ConfigElement[] elements, TextWriter w, object instance) {
|
||||||
foreach (ConfigElement elem in elements)
|
foreach (ConfigElement elem in elements)
|
||||||
{
|
{
|
||||||
|
@ -38,7 +38,12 @@ namespace MCGalaxy.Games
|
|||||||
protected void SaveTo(ConfigElement[] cfg, string propsDir, string map) {
|
protected void SaveTo(ConfigElement[] cfg, string propsDir, string map) {
|
||||||
string path = propsDir + map + ".properties";
|
string path = propsDir + map + ".properties";
|
||||||
if (!Directory.Exists(propsDir)) Directory.CreateDirectory(propsDir);
|
if (!Directory.Exists(propsDir)) Directory.CreateDirectory(propsDir);
|
||||||
ConfigElement.SerialiseSimple(cfg, path, this);
|
|
||||||
|
using (StreamWriter w = FileIO.CreateGuarded(path))
|
||||||
|
{
|
||||||
|
w.WriteLine("#Game settings file");
|
||||||
|
ConfigElement.SerialiseElements(cfg, w, this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Saves this configuration to disc. </summary>
|
/// <summary> Saves this configuration to disc. </summary>
|
||||||
|
@ -121,7 +121,7 @@ namespace MCGalaxy
|
|||||||
public static void Save() {
|
public static void Save() {
|
||||||
try {
|
try {
|
||||||
lock (saveLock) {
|
lock (saveLock) {
|
||||||
using (StreamWriter w = new StreamWriter(Paths.ServerPropsFile))
|
using (StreamWriter w = FileIO.CreateGuarded(Paths.ServerPropsFile))
|
||||||
SaveProps(w);
|
SaveProps(w);
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user