Exemple #1
0
        private void readBase(StringBuilder cb, int level)
        {
            string varType = a_Stream.ReadStringToNull();
            string varName = a_Stream.ReadStringToNull();
            //a_Stream.Position += 20;
            int size          = a_Stream.ReadInt32();
            int index         = a_Stream.ReadInt32();
            int isArray       = a_Stream.ReadInt32();
            int num0          = a_Stream.ReadInt32();
            int num1          = a_Stream.ReadInt16();
            int num2          = a_Stream.ReadInt16();
            int childrenCount = a_Stream.ReadInt32();

            //Debug.WriteLine(baseFormat + " " + baseName + " " + childrenCount);
            cb.AppendFormat("{0}{1} {2} {3}\r\n", (new string('\t', level)), varType, varName, size);
            for (int i = 0; i < childrenCount; i++)
            {
                readBase(cb, level + 1);
            }
        }
Exemple #2
0
        private void readBundle(EndianStream b_Stream)
        {
            var header = b_Stream.ReadStringToNull();

            if (header == "UnityWeb" || header == "UnityRaw" || header == "\xFA\xFA\xFA\xFA\xFA\xFA\xFA\xFA")
            {
                ver1 = b_Stream.ReadInt32();
                ver2 = b_Stream.ReadStringToNull();
                ver3 = b_Stream.ReadStringToNull();
                if (ver1 < 6)
                {
                    int bundleSize = b_Stream.ReadInt32();
                }
                else
                {
                    long bundleSize = b_Stream.ReadInt64();
                    return;
                }
                short dummy2     = b_Stream.ReadInt16();
                int   offset     = b_Stream.ReadInt16();
                int   dummy3     = b_Stream.ReadInt32();
                int   lzmaChunks = b_Stream.ReadInt32();

                int  lzmaSize   = 0;
                long streamSize = 0;

                for (int i = 0; i < lzmaChunks; i++)
                {
                    lzmaSize   = b_Stream.ReadInt32();
                    streamSize = b_Stream.ReadInt32();
                }

                b_Stream.Position = offset;
                switch (header)
                {
                case "\xFA\xFA\xFA\xFA\xFA\xFA\xFA\xFA":     //.bytes
                case "UnityWeb":
                {
                    byte[] lzmaBuffer = new byte[lzmaSize];
                    b_Stream.Read(lzmaBuffer, 0, lzmaSize);

                    using (var lzmaStream = new EndianStream(SevenZip.Compression.LZMA.SevenZipHelper.StreamDecompress(new MemoryStream(lzmaBuffer)), EndianType.BigEndian))
                    {
                        getFiles(lzmaStream, 0);
                    }
                    break;
                }

                case "UnityRaw":
                {
                    getFiles(b_Stream, offset);
                    break;
                }
                }
            }
            else if (header == "UnityFS")
            {
                ver1 = b_Stream.ReadInt32();
                ver2 = b_Stream.ReadStringToNull();
                ver3 = b_Stream.ReadStringToNull();
                long bundleSize = b_Stream.ReadInt64();
            }
        }