public void Read(byte[] data, ref int offset)
    {
        if (data == null || offset < 0 || offset >= data.Length)
        {
            return;
        }
        int num = offset;

        if (CMemoryManager.ReadInt(data, ref offset) > data.Length - num)
        {
            return;
        }
        this.m_version     = CMemoryManager.ReadString(data, ref offset);
        this.m_buildNumber = CMemoryManager.ReadString(data, ref offset);
        this.m_publish     = CMemoryManager.ReadString(data, ref offset);
        this.m_ifsPath     = CMemoryManager.ReadString(data, ref offset);
        int num2 = CMemoryManager.ReadShort(data, ref offset);

        this.m_resourcePackerInfosAll.Clear();
        for (int i = 0; i < num2; i++)
        {
            CResourcePackerInfo cResourcePackerInfo = new CResourcePackerInfo(false);
            cResourcePackerInfo.Read(data, ref offset);
            this.AddResourcePackerInfo(cResourcePackerInfo);
        }
    }
Exemplo n.º 2
0
 public void Read(byte[] data, ref int offset)
 {
     this.m_cachedTextureInfos.Clear();
     this.m_cachedTextureInfoMap.Clear();
     if (data != null)
     {
         int num = data.Length - offset;
         if (num >= 6)
         {
             int num2 = CMemoryManager.ReadInt(data, ref offset);
             if (((num2 >= 6) && (num2 <= num)) && (CMemoryManager.ReadShort(data, ref offset) == 0x2713))
             {
                 int num4 = CMemoryManager.ReadShort(data, ref offset);
                 for (int i = 0; i < num4; i++)
                 {
                     CCachedTextureInfo info = new CCachedTextureInfo {
                         m_key            = CMemoryManager.ReadString(data, ref offset),
                         m_width          = CMemoryManager.ReadShort(data, ref offset),
                         m_height         = CMemoryManager.ReadShort(data, ref offset),
                         m_lastModifyTime = CMemoryManager.ReadDateTime(data, ref offset),
                         m_isGif          = CMemoryManager.ReadByte(data, ref offset) > 0
                     };
                     if (!this.m_cachedTextureInfoMap.ContainsKey(info.m_key))
                     {
                         this.m_cachedTextureInfoMap.Add(info.m_key, info);
                         this.m_cachedTextureInfos.Add(info);
                     }
                 }
                 this.m_cachedTextureInfos.Sort();
             }
         }
     }
 }
Exemplo n.º 3
0
    public static string ReadString(byte[] data, ref int offset)
    {
        int    num     = CMemoryManager.ReadShort(data, ref offset);
        string @string = Encoding.get_UTF8().GetString(data, offset, num);

        offset += num;
        return(@string);
    }
Exemplo n.º 4
0
    public void Read(byte[] data, ref int offset)
    {
        this.m_version = CMemoryManager.ReadString(data, ref offset);
        this.m_publish = CMemoryManager.ReadString(data, ref offset);
        this.m_ifsPath = CMemoryManager.ReadString(data, ref offset);
        int num = CMemoryManager.ReadShort(data, ref offset);

        this.m_resourcePackerInfosInTreeStruct.Clear();
        this.m_resourcePackerInfosAll.Clear();
        for (int i = 0; i < num; i++)
        {
            CResourcePackerInfo resourceInfo = new CResourcePackerInfo(false);
            resourceInfo.Read(data, ref offset);
            this.AddResourcePackerInfo(resourceInfo);
        }
    }
Exemplo n.º 5
0
    //--------------------------------------------------
    /// 读出数据
    /// @buffer
    /// @offset
    /// @dataLength
    //--------------------------------------------------
    public int Read(byte[] buffer, int offset, uint dataLength)
    {
        m_cachedFileInfos.Clear();
        m_cachedFileInfoMap.Clear();

        //数据长度不合法,不能读取数据
        if (dataLength < 6 || offset + (int)dataLength > buffer.Length)
        {
            return(-1);
        }

        //校验数据长度
        int storedDataLength = CMemoryManager.ReadInt(buffer, ref offset);

        if (storedDataLength < 6 || storedDataLength != (int)dataLength)
        {
            return(-2);
        }

        //校验版本号
        int version = CMemoryManager.ReadShort(buffer, ref offset);

        if (version != c_version)
        {
            return(-3);
        }

        //读取数据
        int infoAmount = CMemoryManager.ReadShort(buffer, ref offset);

        for (int i = 0; i < infoAmount; i++)
        {
            CCachedFileInfo cacheFileInfo = new CCachedFileInfo();
            cacheFileInfo.Read(buffer, ref offset);

            //防止key重复
            if (m_cachedFileInfoMap.ContainsKey(cacheFileInfo.m_key) == false)
            {
                m_cachedFileInfoMap.Add(cacheFileInfo.m_key, cacheFileInfo);
                m_cachedFileInfos.Add(cacheFileInfo);
            }
        }
        //按最后修改时间排序
        m_cachedFileInfos.Sort();
        return(0);
    }
        public void Read(byte[] data, ref int offset)
        {
            this.m_cachedTextureInfos.Clear();
            this.m_cachedTextureInfoMap.Clear();
            if (data == null)
            {
                return;
            }
            int num = data.Length - offset;

            if (num < 6)
            {
                return;
            }
            int num2 = CMemoryManager.ReadInt(data, ref offset);

            if (num2 < 6 || num2 > num)
            {
                return;
            }
            int num3 = CMemoryManager.ReadShort(data, ref offset);

            if (num3 != 10003)
            {
                return;
            }
            int num4 = CMemoryManager.ReadShort(data, ref offset);

            for (int i = 0; i < num4; i++)
            {
                CCachedTextureInfo cCachedTextureInfo = new CCachedTextureInfo();
                cCachedTextureInfo.m_key            = CMemoryManager.ReadString(data, ref offset);
                cCachedTextureInfo.m_width          = CMemoryManager.ReadShort(data, ref offset);
                cCachedTextureInfo.m_height         = CMemoryManager.ReadShort(data, ref offset);
                cCachedTextureInfo.m_lastModifyTime = CMemoryManager.ReadDateTime(data, ref offset);
                cCachedTextureInfo.m_isGif          = (CMemoryManager.ReadByte(data, ref offset) > 0);
                if (!this.m_cachedTextureInfoMap.ContainsKey(cCachedTextureInfo.m_key))
                {
                    this.m_cachedTextureInfoMap.Add(cCachedTextureInfo.m_key, cCachedTextureInfo);
                    this.m_cachedTextureInfos.Add(cCachedTextureInfo);
                }
            }
            this.m_cachedTextureInfos.Sort();
        }
Exemplo n.º 7
0
    public virtual void Read(byte[] data, ref int offset)
    {
        this.m_isAssetBundle = (CMemoryManager.ReadByte(data, ref offset) > 0);
        this.m_pathInIFS     = CMemoryManager.ReadString(data, ref offset);
        this.m_tag           = CMemoryManager.ReadString(data, ref offset);
        this.m_flags         = (ushort)CMemoryManager.ReadInt(data, ref offset);
        int num = CMemoryManager.ReadShort(data, ref offset);

        this.m_resourceInfos.Clear();
        if (!this.m_isAssetBundle)
        {
            this.m_fileExtMap = new Dictionary <int, string>();
        }
        for (int i = 0; i < num; i++)
        {
            stResourceInfo stResourceInfo = new stResourceInfo();
            string         s = CMemoryManager.ReadString(data, ref offset);
            stResourceInfo.m_hashCode = s.JavaHashCodeIgnoreCase();
            stResourceInfo.extension  = CMemoryManager.ReadString(data, ref offset);
            stResourceInfo.m_flags    = (byte)CMemoryManager.ReadInt(data, ref offset);
            bool flag = CMemoryManager.ReadByte(data, ref offset) > 0;
            if (flag)
            {
                stResourceInfo.m_fullPathInResourcesWithoutExtension_Renamed = CMemoryManager.ReadString(data, ref offset);
            }
            if (!this.m_isAssetBundle)
            {
                string text = stResourceInfo.extension.Replace(".", string.Empty);
                this.m_fileExtMap.set_Item(stResourceInfo.m_hashCode, text);
            }
            this.m_resourceInfos.Add(stResourceInfo);
        }
        num = CMemoryManager.ReadShort(data, ref offset);
        this.m_children.Clear();
        for (int j = 0; j < num; j++)
        {
            CResourcePackerInfo cResourcePackerInfo = new CResourcePackerInfo(true);
            cResourcePackerInfo.Read(data, ref offset);
            cResourcePackerInfo.dependency = this;
        }
    }
Exemplo n.º 8
0
 public void Read(byte[] data, ref int offset)
 {
     if (((data != null) && (offset >= 0)) && (offset < data.Length))
     {
         int num = offset;
         if (CMemoryManager.ReadInt(data, ref offset) <= (data.Length - num))
         {
             this.m_version     = CMemoryManager.ReadString(data, ref offset);
             this.m_buildNumber = CMemoryManager.ReadString(data, ref offset);
             this.m_publish     = CMemoryManager.ReadString(data, ref offset);
             this.m_ifsPath     = CMemoryManager.ReadString(data, ref offset);
             int num2 = CMemoryManager.ReadShort(data, ref offset);
             this.m_resourcePackerInfosInTreeStruct.Clear();
             this.m_resourcePackerInfosAll.Clear();
             for (int i = 0; i < num2; i++)
             {
                 CResourcePackerInfo resourceInfo = new CResourcePackerInfo(false);
                 resourceInfo.Read(data, ref offset);
                 this.AddResourcePackerInfo(resourceInfo);
             }
         }
     }
 }