- Converted all Types from C# types to .NET Types (such as bool changed to Boolean, and int changed to Int32). - Zone no longer gets saved from within GameWorld.Save, but rather in Realm.Save() - Room no longer gets saved from within GameWorld.Save(), but rather in Zone.Save(); - Added new SaveWorld command that admins only can execute to force save the world. It's not fully implemented at this time. MudGame: - began work on command execution from within the server while it's running.
40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
//Microsoft .NET Framework
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.IO;
|
|
using System.Xml.Serialization;
|
|
|
|
namespace MudEngine.FileSystem
|
|
{
|
|
internal class XmlSerialization
|
|
{
|
|
internal static void Save(String Filename, object o)
|
|
{
|
|
Stream stream = File.Create(Filename);
|
|
|
|
XmlSerializer serializer = new XmlSerializer(o.GetType());
|
|
serializer.Serialize(stream, o);
|
|
stream.Close();
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Loads an item via Xml Deserialization
|
|
/// </summary>
|
|
/// <param name="Filename">The Xml document to deserialize.</param>
|
|
/// <returns></returns>
|
|
internal static object Load(String Filename, object o)
|
|
{
|
|
Stream stream = File.OpenRead(Filename);
|
|
|
|
object obj = new object();
|
|
XmlSerializer serializer = new XmlSerializer(o.GetType());
|
|
obj = (object)serializer.Deserialize(stream);
|
|
|
|
stream.Close();
|
|
return obj;
|
|
}
|
|
}
|
|
}
|