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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        /// <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));
        }
Beispiel #4
0
 public static byte[] DeserialiseBytes(this MfcDeserialiser archive, int length)
 {
     return(archive.Stream.ReadBytes(length));
 }
Beispiel #5
0
 public static byte DeserialiseByte(this MfcDeserialiser archive)
 {
     return(archive.Stream.ReadByte());
 }
Beispiel #6
0
 public static ushort DeserialiseUInt16(this MfcDeserialiser archive)
 {
     return(archive.Stream.ReadUInt16());
 }
Beispiel #7
0
 public static uint DeserialiseUInt32(this MfcDeserialiser archive)
 {
     return(archive.Stream.ReadUInt32());
 }