private void CreateInstruction(JsonReader reader, IXmlDocument document, IXmlNode currentNode, string propertyName)
        {
            if (propertyName == "?xml")
            {
                string version    = null;
                string encoding   = null;
                string standalone = null;
                while (reader.Read() && reader.TokenType != JsonToken.EndObject)
                {
                    string text = reader.Value.ToString();
                    if (text != null)
                    {
                        if (XmlNodeConverter.< > f__switch$map1 == null)
                        {
                            Dictionary <string, int> dictionary = new Dictionary <string, int>(3);
                            dictionary.Add("@version", 0);
                            dictionary.Add("@encoding", 1);
                            dictionary.Add("@standalone", 2);
                            XmlNodeConverter.< > f__switch$map1 = dictionary;
                        }
                        int num;
                        if (XmlNodeConverter.< > f__switch$map1.TryGetValue(text, ref num))
                        {
                            switch (num)
                            {
                            case 0:
                                reader.Read();
                                version = reader.Value.ToString();
                                continue;

                            case 1:
                                reader.Read();
                                encoding = reader.Value.ToString();
                                continue;

                            case 2:
                                reader.Read();
                                standalone = reader.Value.ToString();
                                continue;
                            }
                        }
                    }
                    throw new JsonSerializationException("Unexpected property name encountered while deserializing XmlDeclaration: " + reader.Value);
                }
                IXmlNode newChild = document.CreateXmlDeclaration(version, encoding, standalone);
                currentNode.AppendChild(newChild);
            }
            else
            {
                IXmlNode newChild2 = document.CreateProcessingInstruction(propertyName.Substring(1), reader.Value.ToString());
                currentNode.AppendChild(newChild2);
            }
        }
Example #2
0
 private void CreateInstruction(JsonReader reader, IXmlDocument document, IXmlNode currentNode, string propertyName)
 {
     if (propertyName != "?xml")
     {
         IXmlNode xmlNode = document.CreateProcessingInstruction(propertyName.Substring(1), reader.Value.ToString());
         currentNode.AppendChild(xmlNode);
     }
     else
     {
         string str  = null;
         string str1 = null;
         string str2 = null;
         while (true)
         {
             if (!reader.Read() || reader.TokenType == JsonToken.EndObject)
             {
                 IXmlNode xmlNode1 = document.CreateXmlDeclaration(str, str1, str2);
                 currentNode.AppendChild(xmlNode1);
                 return;
             }
             else
             {
                 string str3 = reader.Value.ToString();
                 if (str3 == null)
                 {
                     break;
                 }
                 if (str3 == "@version")
                 {
                     reader.Read();
                     str = reader.Value.ToString();
                 }
                 else if (str3 == "@encoding")
                 {
                     reader.Read();
                     str1 = reader.Value.ToString();
                 }
                 else if (str3 == "@standalone")
                 {
                     reader.Read();
                     str2 = reader.Value.ToString();
                 }
                 else
                 {
                     break;
                 }
             }
         }
         throw new JsonSerializationException(string.Concat("Unexpected property name encountered while deserializing XmlDeclaration: ", reader.Value));
     }
 }
Example #3
0
        private void CreateInstruction(
            JsonReader reader,
            IXmlDocument document,
            IXmlNode currentNode,
            string propertyName)
        {
            if (propertyName == "?xml")
            {
                string version    = (string)null;
                string encoding   = (string)null;
                string standalone = (string)null;
                while (reader.Read() && reader.TokenType != JsonToken.EndObject)
                {
                    string str = reader.Value.ToString();
                    if (!(str == "@version"))
                    {
                        if (!(str == "@encoding"))
                        {
                            if (!(str == "@standalone"))
                            {
                                throw JsonSerializationException.Create(reader,
                                                                        "Unexpected property name encountered while deserializing XmlDeclaration: " + reader.Value);
                            }
                            reader.Read();
                            standalone = this.ConvertTokenToXmlValue(reader);
                        }
                        else
                        {
                            reader.Read();
                            encoding = this.ConvertTokenToXmlValue(reader);
                        }
                    }
                    else
                    {
                        reader.Read();
                        version = this.ConvertTokenToXmlValue(reader);
                    }
                }

                IXmlNode xmlDeclaration = document.CreateXmlDeclaration(version, encoding, standalone);
                currentNode.AppendChild(xmlDeclaration);
            }
            else
            {
                IXmlNode processingInstruction =
                    document.CreateProcessingInstruction(propertyName.Substring(1), this.ConvertTokenToXmlValue(reader));
                currentNode.AppendChild(processingInstruction);
            }
        }
Example #4
0
        private void CreateInstruction(JsonReader reader, IXmlDocument document, IXmlNode currentNode, string propertyName)
        {
            if (propertyName != "?xml")
            {
                IXmlNode newChild = document.CreateProcessingInstruction(propertyName.Substring(1), reader.Value.ToString());
                currentNode.AppendChild(newChild);
            }
            else
            {
                string version    = null;
                string encoding   = null;
                string standalone = null;
                while (reader.Read() && (reader.TokenType != JsonToken.EndObject))
                {
                    string str4 = reader.Value.ToString();
                    if (str4 != "@version")
                    {
                        if (str4 != "@encoding")
                        {
                            if (str4 != "@standalone")
                            {
                                throw JsonSerializationException.Create(reader, "Unexpected property name encountered while deserializing XmlDeclaration: " + reader.Value);
                            }
                            goto Label_008D;
                        }
                    }
                    else
                    {
                        reader.Read();
                        version = reader.Value.ToString();
                        continue;
                    }
                    reader.Read();
                    encoding = reader.Value.ToString();
                    continue;
Label_008D:
                    reader.Read();
                    standalone = reader.Value.ToString();
                }
                IXmlNode newChild = document.CreateXmlDeclaration(version, encoding, standalone);
                currentNode.AppendChild(newChild);
            }
        }
        private void CreateInstruction(JsonReader reader, IXmlDocument document, IXmlNode currentNode, string propertyName)
        {
            if (propertyName == "?xml")
            {
                string version    = null;
                string encoding   = null;
                string standalone = null;
                while (reader.Read() && reader.TokenType != JsonToken.EndObject)
                {
                    string a;
                    if ((a = reader.Value.ToString()) != null)
                    {
                        if (a == "@version")
                        {
                            reader.Read();
                            version = reader.Value.ToString();
                            continue;
                        }
                        if (a == "@encoding")
                        {
                            reader.Read();
                            encoding = reader.Value.ToString();
                            continue;
                        }
                        if (a == "@standalone")
                        {
                            reader.Read();
                            standalone = reader.Value.ToString();
                            continue;
                        }
                    }
                    throw new JsonSerializationException("Unexpected property name encountered while deserializing XmlDeclaration: " + reader.Value);
                }
                IXmlNode newChild = document.CreateXmlDeclaration(version, encoding, standalone);
                currentNode.AppendChild(newChild);
                return;
            }
            IXmlNode newChild2 = document.CreateProcessingInstruction(propertyName.Substring(1), reader.Value.ToString());

            currentNode.AppendChild(newChild2);
        }
        private void CreateInstruction(JsonReader reader, IXmlDocument document, IXmlNode currentNode, string propertyName)
        {
            if (propertyName == DeclarationName)
            {
                string version    = null;
                string encoding   = null;
                string standalone = null;
                while (reader.Read() && reader.TokenType != JsonToken.EndObject)
                {
                    switch (reader.Value.ToString())
                    {
                    case "@version":
                        reader.Read();
                        version = reader.Value.ToString();
                        break;

                    case "@encoding":
                        reader.Read();
                        encoding = reader.Value.ToString();
                        break;

                    case "@standalone":
                        reader.Read();
                        standalone = reader.Value.ToString();
                        break;

                    default:
                        throw new JsonSerializationException("Unexpected property name encountered while deserializing XmlDeclaration: " + reader.Value);
                    }
                }

                IXmlNode declaration = document.CreateXmlDeclaration(version, encoding, standalone);
                currentNode.AppendChild(declaration);
            }
            else
            {
                IXmlNode instruction = document.CreateProcessingInstruction(propertyName.Substring(1), reader.Value.ToString());
                currentNode.AppendChild(instruction);
            }
        }
Example #7
0
    private void CreateInstruction(JsonReader reader, IXmlDocument document, IXmlNode currentNode, string propertyName)
    {
      if (propertyName == DeclarationName)
      {
        string version = null;
        string encoding = null;
        string standalone = null;
        while (reader.Read() && reader.TokenType != JsonToken.EndObject)
        {
          switch (reader.Value.ToString())
          {
            case "@version":
              reader.Read();
              version = reader.Value.ToString();
              break;
            case "@encoding":
              reader.Read();
              encoding = reader.Value.ToString();
              break;
            case "@standalone":
              reader.Read();
              standalone = reader.Value.ToString();
              break;
            default:
              throw new JsonSerializationException("Unexpected property name encountered while deserializing XmlDeclaration: " + reader.Value);
          }
        }

        IXmlNode declaration = document.CreateXmlDeclaration(version, encoding, standalone);
        currentNode.AppendChild(declaration);
      }
      else
      {
        IXmlNode instruction = document.CreateProcessingInstruction(propertyName.Substring(1), reader.Value.ToString());
        currentNode.AppendChild(instruction);
      }
    }
 // Token: 0x060006E9 RID: 1769
 // RVA: 0x00038868 File Offset: 0x00036A68
 private void CreateInstruction(JsonReader reader, IXmlDocument document, IXmlNode currentNode, string propertyName)
 {
     if (propertyName == "?xml")
     {
         string version = null;
         string encoding = null;
         string standalone = null;
         while (reader.Read())
         {
             if (reader.TokenType == JsonToken.EndObject)
             {
                 break;
             }
             string a;
             if ((a = reader.Value.ToString()) != null)
             {
                 if (a == "@version")
                 {
                     reader.Read();
                     version = reader.Value.ToString();
                     continue;
                 }
                 if (a == "@encoding")
                 {
                     reader.Read();
                     encoding = reader.Value.ToString();
                     continue;
                 }
                 if (a == "@standalone")
                 {
                     reader.Read();
                     standalone = reader.Value.ToString();
                     continue;
                 }
             }
             throw new JsonSerializationException("Unexpected property name encountered while deserializing XmlDeclaration: " + reader.Value);
         }
         IXmlNode newChild = document.CreateXmlDeclaration(version, encoding, standalone);
         currentNode.AppendChild(newChild);
         return;
     }
     IXmlNode newChild2 = document.CreateProcessingInstruction(propertyName.Substring(1), reader.Value.ToString());
     currentNode.AppendChild(newChild2);
 }