Exemplo n.º 1
0
        public DownloadHandler(BinaryReader stream)
        {
            stream.Skip(2); // DL

            byte b1 = stream.ReadByte();
            byte b2 = stream.ReadByte();
            byte b3 = stream.ReadByte();

            int numFiles = stream.ReadInt32BE();

            short numTags = stream.ReadInt16BE();

            int numMaskBytes = numFiles / 8 + (numFiles % 8 > 0 ? 1 : 0);

            for (int i = 0; i < numFiles; i++)
            {
                byte[]        key   = stream.ReadBytes(0x10);
                byte[]        unk   = stream.ReadBytes(0xA);
                DownloadEntry entry = new DownloadEntry()
                {
                    Index = i, Unk = unk
                };

                DownloadData.Add(key, entry);
            }

            for (int i = 0; i < numTags; i++)
            {
                DownloadTag tag  = new DownloadTag();
                string      name = stream.ReadCString();
                tag.Type = stream.ReadInt16BE();

                byte[] bits = stream.ReadBytes(numMaskBytes);

                for (int j = 0; j < numMaskBytes; j++)
                {
                    bits[j] = (byte)((bits[j] * 0x0202020202 & 0x010884422010) % 1023);
                }

                tag.Bits = new BitArray(bits);

                Tags.Add(name, tag);
            }
        }
Exemplo n.º 2
0
        public DownloadHandler(BinaryReader stream)
        {
            stream.Skip(2); // DL

            byte b1 = stream.ReadByte();
            byte b2 = stream.ReadByte();
            byte b3 = stream.ReadByte();

            int numFiles = stream.ReadInt32BE();

            short numTags = stream.ReadInt16BE();

            int numMaskBytes = numFiles / 8 + (numFiles % 8 > 0 ? 1 : 0);

            for (int i = 0; i < numFiles; i++)
            {
                byte[] key = stream.ReadBytes(0x10);
                byte[] unk = stream.ReadBytes(0xA);
                DownloadEntry entry = new DownloadEntry() { Index = i, Unk = unk };

                DownloadData.Add(key, entry);
            }

            for (int i = 0; i < numTags; i++)
            {
                DownloadTag tag = new DownloadTag();
                string name = stream.ReadCString();
                tag.Type = stream.ReadInt16BE();

                byte[] bits = stream.ReadBytes(numMaskBytes);

                for (int j = 0; j < numMaskBytes; j++)
                    bits[j] = (byte)((bits[j] * 0x0202020202 & 0x010884422010) % 1023);

                tag.Bits = new BitArray(bits);

                Tags.Add(name, tag);
            }
        }