public static void Load(string filename) { if (ClassIDDatabase.Classes == null || ClassIDDatabase.Classes.Count < 1) { throw new InvalidOperationException("The class ID database must be loaded before the RTTI database is loaded."); } DataReader reader = DataReader.OpenFile(filename, false); Version = reader.ReadInt32(); Types = new TypeNode[reader.ReadInt32()]; for (int i = 0; i < Types.Length; i++) { Types[i] = TypeNode.Read(reader); } Versions = new string[reader.ReadInt32()]; for (int i = 0; i < Versions.Length; i++) { Versions[i] = reader.ReadString(); } Mappings = new RTTIDatabaseMapping[reader.ReadInt32()]; for (int i = 0; i < Mappings.Length; i++) { int nodeIndex = reader.ReadInt32(); int classID = reader.ReadInt32(); int versionIndex = reader.ReadInt32(); Mappings[i] = new RTTIDatabaseMapping(nodeIndex, classID, versionIndex); } reader.Close(); }
public static TypeNode Read(DataReader reader) { TypeNode tn = new TypeNode(); tn.Type = reader.ReadString(); tn.Name = reader.ReadString(); tn.ByteSize = reader.ReadInt32(); tn.Index = reader.ReadInt32(); tn.IsArray = reader.ReadInt32(); tn.Version = reader.ReadInt32(); tn.MetaFlag = reader.ReadInt32(); int numberOfChildren = reader.ReadInt32(); tn.Children = new TypeNode[numberOfChildren]; for (int i = 0; i < numberOfChildren; i++) { tn.Children[i] = TypeNode.Read(reader); } return(tn); }