Added MudEngine Project to the Solution. I will slowly be moving the MudDesigner.MudEngine classes out of the Mud Designer Solution and into it's own.
Currently the Mud Designer still contains the old MudEngine classes until migration has been completed.
This commit is contained in:
parent
7d3b6e471d
commit
dc311f5aa5
21 changed files with 1330 additions and 0 deletions
40
MudEngine/FileSystem/XmlSerialization.cs
Normal file
40
MudEngine/FileSystem/XmlSerialization.cs
Normal file
|
@ -0,0 +1,40 @@
|
|||
//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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue