Пример #1
0
        public PsoEnumInfo(MetaName nameHash, byte type, params PsoEnumEntryInfo[] entries)
        {
            IndexInfo          = new PsoElementIndexInfo();
            IndexInfo.NameHash = nameHash;
            IndexInfo.Offset   = 0; //todo: fix?

            EntriesCount = entries?.Length ?? 0;
            Entries      = entries;
        }
Пример #2
0
        public PsoStructureInfo(MetaName nameHash, byte type, byte unk, int length, params PsoStructureEntryInfo[] entries)
        {
            IndexInfo          = new PsoElementIndexInfo();
            IndexInfo.NameHash = nameHash;
            IndexInfo.Offset   = 0; //todo: fix?

            Type            = type;
            EntriesCount    = (short)(entries?.Length ?? 0);
            Unk             = unk;
            StructureLength = length;
            Unk_Ch          = 0;
            Entries         = entries;
        }
Пример #3
0
        public void Read(DataReader reader)
        {
            Ident  = reader.ReadInt32();
            Length = reader.ReadInt32();
            Count  = reader.ReadUInt32();

            this.EntriesIdx = new PsoElementIndexInfo[Count];
            for (int i = 0; i < Count; i++)
            {
                var entry = new PsoElementIndexInfo();
                entry.Read(reader);
                EntriesIdx[i] = entry;
            }

            this.Entries = new PsoElementInfo[Count];
            for (int i = 0; i < Count; i++)
            {
                reader.Position = EntriesIdx[i].Offset;
                var type = reader.ReadByte();

                reader.Position = EntriesIdx[i].Offset;
                if (type == 0)
                {
                    var entry = new PsoStructureInfo();
                    entry.Read(reader);
                    entry.IndexInfo = EntriesIdx[i];
                    Entries[i]      = entry;
                }
                else if (type == 1)
                {
                    var entry = new PsoEnumInfo();
                    entry.Read(reader);
                    entry.IndexInfo = EntriesIdx[i];
                    Entries[i]      = entry;
                }
                else
                {
                    throw new Exception("unknown type!");
                }
            }
        }