Exemplo n.º 1
0
Arquivo: PB.cs Projeto: X-Hax/SA3D
        public int GetCurrentOffset(int index, int total)
        {
            int offset_base = 8 + 16 * total;

            if (index == 0)
            {
                return(offset_base);
            }
            for (int u = 0; u < index; u++)
            {
                PBEntry entry = (PBEntry)Entries[u];
                offset_base += entry.GetHeaderless().Length;
            }
            return(offset_base);
        }
Exemplo n.º 2
0
Arquivo: PB.cs Projeto: X-Hax/SA3D
        public override byte[] GetBytes()
        {
            List <byte> result = new List <byte>();

            result.Add(0x50); // P
            result.Add(0x56); // B
            result.Add(0x42); // V
            result.Add(0x02); // Version ID
            result.AddRange(BitConverter.GetBytes((uint)Entries.Count));
            for (int u = 0; u < Entries.Count; u++)
            {
                PBEntry entry = (PBEntry)Entries[u];
                result.AddRange(entry.GetHeader());
            }
            for (int u = 0; u < Entries.Count; u++)
            {
                PBEntry entry = (PBEntry)Entries[u];
                result.AddRange(entry.GetHeaderless());
            }
            return(result.ToArray());
        }