예제 #1
0
        private XElement ParseElement(IList <byte> document, int next)
        {
            if (next == 0)
            {
                currentPage = GetCurrentToken(document);
                next        = GetCurrentToken(document);
            }
            var codePage     = codePageProvider.GetCodePage(currentPage) + ":";
            var hasContent   = (next & 0x40) == 0x40;
            var currentToken = next & 0x3f;
            var element      = new XElement((XNamespace)codePage + codePageProvider.GetToken(currentPage, currentToken));

            if (hasContent)
            {
                while ((next = GetCurrentToken(document)) != 1)
                {
                    //If value == 3 it marks the start of a string
                    if (next == 3)
                    {
                        element.Value = GetString(document);
                    }
                    //If value == 0xC3 it marks the start of an opaque blob
                    else if (next == 195)
                    {
                        element.Value = GetBlob(document);
                    }
                    else
                    {
                        element.Add(ParseElement(document, next));
                    }
                }
            }
            return(element);
        }
예제 #2
0
 private IList <byte> GetTokenWithContent(int codePage, string token)
 {
     return(new List <byte> {
         (byte)(codePageProvider.GetToken(codePage, token) + 0x40)
     });
 }