Example #1
0
        // Token: 0x06000261 RID: 609 RVA: 0x0000837C File Offset: 0x0000657C
        internal XmlDocument ReadXmlDocument()
        {
            this.ReadHeader();
            XmlDocument result;

            try
            {
                bool   flag;
                bool   flag2;
                int    tag       = this.ReadTag(out flag, out flag2);
                string name      = WBXmlBase.Schema.GetName(tag);
                string nameSpace = WBXmlBase.Schema.GetNameSpace(tag);
                if (name == null || nameSpace == null)
                {
                    result = WBXmlReader.ErrorDocument;
                }
                else
                {
                    XmlDocument xmlDocument = new SafeXmlDocument();
                    bool        flag3       = WBXmlBase.Schema.IsTagSecure(tag);
                    bool        flag4       = WBXmlBase.Schema.IsTagAnOpaqueBlob(tag);
                    XmlElement  xmlElement;
                    if (flag3)
                    {
                        xmlElement = new WBXmlSecureStringNode(null, name, nameSpace, xmlDocument);
                    }
                    else if (flag4)
                    {
                        xmlElement = new WBxmlBlobNode(null, name, nameSpace, xmlDocument);
                    }
                    else
                    {
                        xmlElement = xmlDocument.CreateElement(name, nameSpace);
                    }
                    xmlDocument.AppendChild(xmlElement);
                    if (flag)
                    {
                        this.SkipAttributes();
                    }
                    if (flag2 && !this.FillXmlElement(xmlElement, 0, flag3, flag4))
                    {
                        result = WBXmlReader.ErrorDocument;
                    }
                    else
                    {
                        result = xmlDocument;
                    }
                }
            }
            catch (IndexOutOfRangeException innerException)
            {
                throw new EasWBXmlTransientException("Invalid WBXML code/codepage from client", innerException);
            }
            catch (ArgumentOutOfRangeException innerException2)
            {
                throw new EasWBXmlTransientException("Invalid WBXML code from client", innerException2);
            }
            return(result);
        }
Example #2
0
 // Token: 0x06000264 RID: 612 RVA: 0x00008548 File Offset: 0x00006748
 private bool FillXmlElement(XmlElement elem, int depth, bool elemIsSecureData, bool elemIsBlobData)
 {
     if (depth > 20)
     {
         throw new EasWBXmlTransientException("Document nested too deep");
     }
     for (;;)
     {
         bool flag;
         bool flag2;
         int  num = this.ReadTag(out flag, out flag2);
         if (num == 1)
         {
             return(true);
         }
         if (num == 3)
         {
             if (elemIsSecureData)
             {
                 WBXmlSecureStringNode wbxmlSecureStringNode = (WBXmlSecureStringNode)elem;
                 wbxmlSecureStringNode.SecureData = this.ReadInlineSecureString();
             }
             else
             {
                 string innerText = this.ReadInlineString();
                 elem.InnerText = innerText;
             }
         }
         else if (num == 195)
         {
             if (elemIsSecureData)
             {
                 WBXmlSecureStringNode wbxmlSecureStringNode2 = (WBXmlSecureStringNode)elem;
                 wbxmlSecureStringNode2.SecureData = this.ReadOpaqueSecureString();
             }
             else if (elemIsBlobData)
             {
                 WBxmlBlobNode wbxmlBlobNode = elem as WBxmlBlobNode;
                 int           num2          = this.ReadMultiByteInteger();
                 if (this.stream.Position + (long)num2 > this.stream.Length)
                 {
                     break;
                 }
                 if (this.parseBlobAsByteArray)
                 {
                     wbxmlBlobNode.ByteArray = this.ReadBytes(num2);
                 }
                 else
                 {
                     wbxmlBlobNode.Stream = new WBXmlSubStream(this.underlyingStream, this.stream.Position, (long)num2);
                     this.stream.Seek((long)num2, SeekOrigin.Current);
                 }
             }
             else
             {
                 string innerText2 = this.ReadOpaqueString();
                 elem.InnerText = innerText2;
             }
         }
         if ((num & 63) >= 5)
         {
             if (flag)
             {
                 this.SkipAttributes();
             }
             string name      = WBXmlBase.Schema.GetName(num);
             string nameSpace = WBXmlBase.Schema.GetNameSpace(num);
             if (name == null || nameSpace == null)
             {
                 return(false);
             }
             bool       flag3 = WBXmlBase.Schema.IsTagSecure(num);
             bool       flag4 = WBXmlBase.Schema.IsTagAnOpaqueBlob(num);
             XmlElement xmlElement;
             if (flag3)
             {
                 xmlElement = new WBXmlSecureStringNode(null, name, nameSpace, elem.OwnerDocument);
             }
             else if (flag4)
             {
                 xmlElement = new WBxmlBlobNode(null, name, nameSpace, elem.OwnerDocument);
             }
             else
             {
                 xmlElement = elem.OwnerDocument.CreateElement(name, nameSpace);
             }
             if (flag2 && !this.FillXmlElement(xmlElement, depth + 1, flag3, flag4))
             {
                 return(false);
             }
             elem.AppendChild(xmlElement);
         }
     }
     return(false);
 }