Esempio n. 1
0
        private void ParseElement(IAsn1TaggedEventHandler handler, Asn1Tag tag, IntHolder len)
        {
            _parserCaptureBuffer.Seek(0L, SeekOrigin.Begin);
            _parserCaptureBuffer.SetLength(0L);

            len.Value = DecodeTagAndLength(tag);

            if (!tag.IsEoc() || (len.Value != 0))
            {
                handler.StartElement(tag, len.Value, _parserCaptureBuffer.ToArray());

                _parserCaptureBuffer.Seek(0L, SeekOrigin.Begin);
                _parserCaptureBuffer.SetLength(0L);

                if ((len.Value > 0) || (len.Value == Asn1Status.IndefiniteLength))
                {
                    if (tag.Constructed)
                    {
                        ParseCons(handler, len.Value);
                    }
                    else
                    {
                        ParsePrim(handler, len.Value);
                    }
                }

                handler.EndElement(tag);
            }
        }
        private void ParseElement(IAsn1TaggedEventHandler handler, Asn1Tag tag, IntHolder len)
        {
            _parserCaptureBuffer.Seek(0L, SeekOrigin.Begin);
            _parserCaptureBuffer.SetLength(0L);

            len.Value = DecodeTagAndLength(tag);

            if (!tag.IsEoc() || (len.Value != 0))
            {
                handler.StartElement(tag, len.Value, _parserCaptureBuffer.ToArray());

                _parserCaptureBuffer.Seek(0L, SeekOrigin.Begin);
                _parserCaptureBuffer.SetLength(0L);

                if ((len.Value > 0) || (len.Value == Asn1Status.IndefiniteLength))
                {
                    if (tag.Constructed)
                    {
                        ParseCons(handler, len.Value);
                    }
                    else
                    {
                        ParsePrim(handler, len.Value);
                    }
                }

                handler.EndElement(tag);
            }
        }