コード例 #1
0
        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();
        }
コード例 #2
0
        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();
        }