Exemplo n.º 1
0
        public DocHeaderType GetDocType(uint i)
        {
            SVGDocumentIndexEntry entry = this.GetDocIndexEntry(i);

            byte [] buf    = new byte[4];
            uint    offset = this.offsetToSVGDocIndex /* should be 10 */ + entry.svgDocOffset;

            System.Buffer.BlockCopy(m_bufTable.GetBuffer(), (int)offset, buf, 0, 4);
            return(DetectType(buf));
        }
Exemplo n.º 2
0
        public SVGDocumentIndexEntry GetDocIndexEntry(uint i)
        {
            SVGDocumentIndexEntry entry = null;

            if (i < numEntries)
            {
                uint offset = this.offsetToSVGDocIndex
                              + 2
                              + 12 * i;
                entry = new SVGDocumentIndexEntry(offset, m_bufTable);
            }
            return(entry);
        }
Exemplo n.º 3
0
        public byte[] GetDoc(uint i, bool autodecompress)
        {
            SVGDocumentIndexEntry entry = this.GetDocIndexEntry(i);
            uint length = entry.svgDocLength;

            byte [] buf    = new byte[length];
            uint    offset = this.offsetToSVGDocIndex + entry.svgDocOffset;

            System.Buffer.BlockCopy(m_bufTable.GetBuffer(), (int)offset, buf, 0, (int)length);

            if (autodecompress && buf[0] == 0x1F && buf[1] == 0x8B)
            {
                byte[] decompressed = null;
                using (MemoryStream output = new MemoryStream())
                {
                    using (MemoryStream input = new MemoryStream(buf))
                    {
                        using (GZipStream zip = new GZipStream(input, CompressionMode.Decompress))
                        {
                            byte[] buffer = new byte[16 * 1024];
                            int    byteRead;
                            while ((byteRead = zip.Read(buffer, 0, buffer.Length)) > 0)
                            {
                                output.Write(buffer, 0, byteRead);
                            }
                        }
                    }
                    decompressed = output.ToArray();
                }
                return(decompressed);
            }
            else
            {
                return(buf);
            }
        }
Exemplo n.º 4
0
        public SVGDocumentIndexEntry GetDocIndexEntry(uint i)
        {
            SVGDocumentIndexEntry entry = null;

            if ( i < numEntries )
            {
                uint offset = this.offsetToSVGDocIndex
                    + 2
                    + 12 * i ;
                entry = new SVGDocumentIndexEntry( offset, m_bufTable );
            }
            return entry;
        }