Пример #1
0
        public void parseSubChunks()
        {
            int index = 8; // skip self

            while (index > 0 && index + 8 <= _data.Length)
            {
                string header = Encoding.UTF8.GetString(_data, index, 4);
                if (ChunkedFile.IsInterestingChunk(header))
                {
                    uint subsize = BitConverter.ToUInt32(_data, index + 4);
                    if (subsize < _size)
                    {
                        header = ChunkedFile.InterestingChunks[header];
                        FileChunk chunk = new FileChunk(_data, index, subsize);
                        chunk.parseSubChunks();
                        if (!subchunks.ContainsKey(header))
                        {
                            subchunks[header] = new List <FileChunk>();
                        }

                        subchunks[header].Add(chunk);
                    }

                    index += (int)(subsize + 8);
                }
                else
                {
                    index += 4;
                }
            }
        }
Пример #2
0
        void parseChunks()
        {
            int index = 0;

            while (index <= _data.Length - 8)
            {
                string header = Encoding.UTF8.GetString(_data, index, 4);
                if (IsInterestingChunk(header))
                {
                    uint size = BitConverter.ToUInt32(_data, index + 4);
                    if (size <= data_size)
                    {
                        header = InterestingChunks[header];
                        FileChunk chunk = new FileChunk(_data, index, size);
                        chunk.parseSubChunks();

                        chunks.Add(header, chunk);
                    }

                    index += (int)size + 8;
                }
                else
                {
                    index++;
                }
            }
        }