ME3LibWV.PCCPackage.UncompressRange C# (CSharp) Method

UncompressRange() private method

private UncompressRange ( uint offset, uint size ) : void
offset uint
size uint
return void
        private void UncompressRange(uint offset, uint size)
        {
            try
            {
                int startchunk = 0;
                int endchunk = -1;
                for (int i = 0; i < Header.Chunks.Count; i++)
                {
                    if (Header.Chunks[i].UnCompOffset > offset)
                        break;
                    startchunk = i;                    
                }
                for (int i = 0; i < Header.Chunks.Count; i++)
                {
                    if (Header.Chunks[i].UnCompOffset >= offset + size)
                        break;
                    endchunk = i;                    
                }
                if (startchunk == -1 || endchunk == -1)
                    return;
                for (int i = startchunk; i <= endchunk; i++)
                {
                    CompressedChunk c = Header.Chunks[i];
                    Header.DeCompBuffer.Seek(c.UnCompOffset, 0);
                    for (int j = 0; j < c.Blocks.Count; j++)
                    {
                        CompressedChunkBlock b = c.Blocks[j];
                        uint startblock = (uint)Header.DeCompBuffer.Position;
                        uint endblock = (uint)Header.DeCompBuffer.Position + b.UnCompSize;
                        if (((startblock >= offset && startblock < offset + size) ||
                            (endblock >= offset && endblock < offset + size) ||
                            (offset >= startblock && offset < endblock) ||
                            (offset + size > startblock && offset + size <= endblock)) &&
                            !b.loaded)
                        {
                            Header.DeCompBuffer.Write(UncompressBlock(i, j), 0, (int)b.UnCompSize);
                            b.loaded = true;
                            c.Blocks[j] = b;
                            Header.Chunks[i] = c;
                        }
                        else
                            Header.DeCompBuffer.Seek(b.UnCompSize, SeekOrigin.Current);
                    }
                }
            }
            catch (Exception ex)
            {
                DebugLog.PrintLn("PCCPACKAGE::UNCOMPRESSRANGE ERROR:\n" + ex.Message);
            }
        }
        private byte[] UncompressBlock(int ChunkIdx, int BlockIdx)