* Created a FileSystem class. FileSystem acts as a back end class for saving and loading data. Adding additional file types or data management options such as SQL will not be easier to implement by creating a new class that the FileSystem class can use. * XmlSerialization class is no longer public. It's changed to internal and has its information passed to it via the FileSystem class. Project Manager: * Project Manager now uses the FileSystem class for saving and loading data instead of the XmlSerialization class.
41 lines
948 B
C#
41 lines
948 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace MUDEngine.FileSystem
|
|
{
|
|
public static class FileSystem
|
|
{
|
|
public enum OutputFormats
|
|
{
|
|
XML = 0,
|
|
}
|
|
|
|
/// <summary>
|
|
/// The filetype that the MUDs files will be saved as
|
|
/// </summary>
|
|
public static OutputFormats FileType
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
public static void Save(string Filename, object o)
|
|
{
|
|
if (FileType == OutputFormats.XML)
|
|
{
|
|
XmlSerialization.Save(Filename, o);
|
|
}
|
|
}
|
|
|
|
public static object Load(string Filename, object o)
|
|
{
|
|
if (FileType == OutputFormats.XML)
|
|
{
|
|
return XmlSerialization.Load(Filename, o);
|
|
}
|
|
else return null;
|
|
}
|
|
}
|
|
}
|