public void TestDeserialiseMerlinStatic() { FileStream smallMazeFile = new FileStream(@"C:\Users\Philip\Desktop\HoverGame\HOVER\MAZES\MAZE1.MAZ", FileMode.Open); var classRegistry = new MfcClassRegistry(); classRegistry.RegisterClass("CMerlinStatic", typeof(CMerlinStatic)); classRegistry.RegisterClass("CMerlinLocation", typeof(CMerlinLocation)); MfcDeserialiser archive = new MfcDeserialiser(smallMazeFile, classRegistry); Maze maze = new Maze(); maze.Deserialise(archive); }
public static List <T> DeserialiseBuggyList <T>(this MfcDeserialiser archive) where T : MfcObject { List <T> result = new List <T>(); ushort listLength = archive.DeserialiseUInt16(); if (listLength >= 1) { // First object has a valid runtime class header result.Add(archive.DeserialiseObject <T>()); } for (int i = 1; i < listLength; i++) { // Subsequent objects are missing the runtime class header but have a word preceding them // that looks like an invalid runtime classs header. uint test = archive.DeserialiseUInt16(); result.Add(archive.DeserialiseObjectNoHeader <T>()); } return(result); }
/// <summary> /// Deserialise an MFC-format ASCII CString /// </summary> public static string DeserialiseString(this MfcDeserialiser archive) { int length = ReadStringLength(archive.Stream); return(archive.Stream.ReadAsciiString(length)); }
public static byte[] DeserialiseBytes(this MfcDeserialiser archive, int length) { return(archive.Stream.ReadBytes(length)); }
public static byte DeserialiseByte(this MfcDeserialiser archive) { return(archive.Stream.ReadByte()); }
public static ushort DeserialiseUInt16(this MfcDeserialiser archive) { return(archive.Stream.ReadUInt16()); }
public static uint DeserialiseUInt32(this MfcDeserialiser archive) { return(archive.Stream.ReadUInt32()); }