Ejemplo n.º 1
0
 // Writes itemObject to an XML file as specified by path
 // Must implement ISerializable, and have a parameterless constructor
 public static void WriteGameStatusObjectToFile <T>(string path, T itemObject) where T : ISerializable
 {
     try
     {
         FileReadWrite.WriteLifeSerializableToFile(itemObject, path);
     }
     catch (Exception e)
     {
         ErrorCatcher(e);
     }
 }
Ejemplo n.º 2
0
 // Returns an object from an XML file in the same directory as the executable, assuming that the file is accessible and the given itemObject implements
 // ISerializable and has a parameterless constructor
 // path is the path to read from, including extension name, itemObject is a backup object that is returned if reading fails
 public static T GetGameStatusObjectFromFile <T>(string path, T itemObject) where T : ISerializable, new()
 {
     try
     {
         return(FileReadWrite.ReadObjectFromXMLFile <T>(path));
     }
     catch (Exception e)
     {
         ErrorCatcher(e);
         return(itemObject);
     }
 }