public void Read(ByteArray inData, AssetHeader assetHeader)
        {
            if (assetHeader.GetVersion() >= 7)
            {
                inData.ReadStringNull();
                attributes = inData.ReadInt();
            }

            int numBaseClasses = inData.ReadInt();
            Debug.Log("numBaseClasses:" + numBaseClasses);
            for (int i = 0; i < numBaseClasses; i++)
            {
                int classID = inData.ReadInt();

                FieldTypeNode node = new FieldTypeNode();
                node.Read(inData);

                typeMap.Add(classID, node);
            }

            // padding
            if (assetHeader.GetVersion() >= 7)
            {
                inData.ReadInt();
            }
        }
Пример #2
0
        public void Read(ByteArray inData, AssetHeader assetHeader)
        {
            if (assetHeader.GetVersion() >= 7)
            {
                inData.ReadStringNull();
                attributes = inData.ReadInt();
            }

            int numBaseClasses = inData.ReadInt();

            Debug.Log("numBaseClasses:" + numBaseClasses);
            for (int i = 0; i < numBaseClasses; i++)
            {
                int classID = inData.ReadInt();

                FieldTypeNode node = new FieldTypeNode();
                node.Read(inData);

                typeMap.Add(classID, node);
            }

            // padding
            if (assetHeader.GetVersion() >= 7)
            {
                inData.ReadInt();
            }
        }
 public void Read(ByteArray inData, AssetHeader assetHeader)
 {
     uint entries = inData.ReadUInt();
     Debug.Log("FileIdentifierTable:" + entries);
     for (int i = 0; i < entries; i++)
     {
         FileIdentifier fileRef = new FileIdentifier();
         fileRef.Read(inData, assetHeader);
         fileIDs.Add(fileRef);
     }
 }
        public void Read(ByteArray inData, AssetHeader assetHeader)
        {
            uint entries = inData.ReadUInt();

            Debug.Log("FileIdentifierTable:" + entries);
            for (int i = 0; i < entries; i++)
            {
                FileIdentifier fileRef = new FileIdentifier();
                fileRef.Read(inData, assetHeader);
                fileIDs.Add(fileRef);
            }
        }
Пример #5
0
        public void Read(ByteArray inData, AssetHeader assetHeader)
        {
            if (assetHeader.GetVersion() > 5)
            {
                assetPath = inData.ReadStringNull();
            }
            guid_high = inData.ReadLong();
            guid_low  = inData.ReadLong();
            type      = inData.ReadInt();
            filePath  = inData.ReadStringNull();

            Debug.Log(string.Format("assetPath={0},filePath={1},type={3}", assetPath, filePath, type));
        }
        public void Read(ByteArray inData, AssetHeader assetHeader)
        {
            if (assetHeader.GetVersion() > 5)
            {
                assetPath = inData.ReadStringNull();
            }
            guid_high = inData.ReadLong();
            guid_low = inData.ReadLong();
            type = inData.ReadInt();
            filePath = inData.ReadStringNull();

            Debug.Log(string.Format("assetPath={0},filePath={1},type={3}",assetPath,filePath,type));
        }
Пример #7
0
        public AssetBundleReader(string file)
        {
            FileStream     fs  = new FileStream(file, FileMode.Open);
            BufferedStream bfs = new BufferedStream(fs);

            byte[] bf = new byte[(int)fs.Length];
            fs.Read(bf, 0, (int)fs.Length);
            inData = new ByteArray(bf);

            header.Read(inData);

            if (!header.HasValidSignature())
            {
                Debug.LogError("Invalid signature");
                return;
            }

            if (header.IsCompressed())
            {
                SevenZip.Compression.LZMA.Decoder coder = new SevenZip.Compression.LZMA.Decoder();

                uint   length  = (uint)(fs.Length - header.GetHeaderSize());
                byte[] inBytes = new byte[length];
                inData.ReadBytes(inBytes, 0, length);
                MemoryStream input  = new MemoryStream(inBytes);
                MemoryStream output = new MemoryStream();

                // Read the decoder properties
                byte[] properties = new byte[5];
                input.Read(properties, 0, 5);

                // Read in the decompress file size.
                byte[] fileLengthBytes = new byte[8];
                input.Read(fileLengthBytes, 0, 8);
                long fileLength = BitConverter.ToInt64(fileLengthBytes, 0);

                coder.SetDecoderProperties(properties);
                coder.Code(input, output, input.Length, fileLength, null);
                output.Position = 0;

                inData = new ByteArray(output);

                Debug.Log("fileLength:" + fileLength);
            }

            uint files = inData.ReadUInt();

            Debug.Log(files);
            for (int i = 0; i < files; i++)
            {
                AssetBundleEntryInfo entryInfo = new AssetBundleEntryInfo();
                entryInfo.Read(inData);
                entryInfos.Add(entryInfo);
                Debug.Log("AssetBundleEntryInfo");

                inData.Postion = (int)entryInfo.GetOffset();
                AssetHeader assetHeader = new AssetHeader();
                assetHeader.Read(inData);
                Debug.Log("AssetHeader");

                MetadataInfo metadataInfo = new MetadataInfo();
                metadataInfo.Read(inData, assetHeader);
                Debug.Log("MetadataInfo");

                //后面的都是小端读取
                inData.IsBigEndian = false;

                ObjectInfoTable objectInfoTable = new ObjectInfoTable();
                objectInfoTable.Read(inData);
                Debug.Log("ObjectInfoTable");

                FileIdentifierTable fileIdentifierTable = new FileIdentifierTable();
                fileIdentifierTable.Read(inData, assetHeader);
                Debug.Log("FileIdentifierTable");
            }

            Debug.Log(inData.Postion);
        }