Exemple #1
0
 public void Write(BinaryWriter bw)
 {
     bw.Write(Ultily.WriteIntTo2Bytes(Unknown1));
     bw.Write(Ultily.WriteIntTo2Bytes(Unknown2));
     bw.Write(Size);
     bw.Write(ID);
     bw.Write(Data);
 }
Exemple #2
0
 public void Write(BinaryWriter bw)
 {
     bw.Write(SubArchiveCount);
     bw.Write(Ultily.WriteIntTo2Bytes(Unknown));
     for (int i = 0; i < SubArchiveCount; i++)
     {
         SubArchives[i].Write(bw);
     }
 }
Exemple #3
0
        public void Write(BinaryWriter bw)
        {
            bw.Write(Unknown1);
            bw.Write(Ultily.WriteIntTo2Bytes(ID));
            bw.Write(Ultily.WriteIntTo2Bytes(Unknown2));
            bw.Write(Ultily.WriteIntTo2Bytes(Unknown3));
            bw.Write(Size);
            long offsetStart = bw.BaseStream.Position;

            Collection.Write(bw);
            long offsetEnd = bw.BaseStream.Position;

            bw.Seek((int)offsetStart - 4, SeekOrigin.Begin);
            Size = (int)(offsetEnd - offsetStart);
            bw.Write(Size);
            bw.Seek(Size, SeekOrigin.Current);
        }
Exemple #4
0
        public void Write(BinaryWriter bw)
        {
            BinaryWriter mos = new BinaryWriter(new MemoryStream());

            int[] DataOffsets = new int[FieldLookupCount];
            DataOffsets[0] = 0;
            for (int i = 1; i <= FieldLookupCount; i++)
            {
                Fields[i - 1].Write(mos);
                Lookups[i - 1].Write(mos);
                if (i < FieldLookupCount)
                {
                    DataOffsets[i] = (int)mos.BaseStream.Position;
                }
                if ((int)mos.BaseStream.Length < 65535)
                {
                    m_maxSize = i;
                }
            }

            SizeDecompressed = (int)mos.BaseStream.Length;

            byte[] DataDecompressed = new byte[SizeDecompressed];

            Array.Copy(((MemoryStream)mos.BaseStream).ToArray(), DataDecompressed, SizeDecompressed);//mos.CopyTo(DataDecompressed, SizeDecompressed);

            int SizeCompressedNew;

            byte[] DataCompressed = m_bnsDat.Inflate(DataDecompressed, SizeDecompressed, out SizeCompressedNew, 6);
            SizeCompressed = SizeCompressedNew;

            bw.Write(StartAndEndFieldId);
            bw.Write(Ultily.WriteIntTo2Bytes(SizeCompressed));
            bw.Write(DataCompressed);
            bw.Write(Ultily.WriteIntTo2Bytes(SizeDecompressed));
            bw.Write(FieldLookupCount);
            for (int i = 0; i < FieldLookupCount; i++)
            {
                bw.Write(Ultily.WriteIntTo2Bytes(DataOffsets[i]));
            }
        }