Esempio n. 1
0
        // Token: 0x06001035 RID: 4149 RVA: 0x00051A38 File Offset: 0x0004FC38
        private void tmethod_2972(Class_285 arg_0, Class_389 arg_1, string str_0, Class_387 arg_2, XmlNamespaceManager arg_3)
        {
            Func <Class_391, bool> func = null;

            Class_407.NClass_1 nclass_ = new Class_407.NClass_1();
            nclass_.field_2 = str_0;
            string    prefix = Class_513.GetPrefix(nclass_.field_2);
            Class_391 class_ = this.kmethod_2977(nclass_.field_2, arg_1, prefix, arg_3);

            arg_2.kmethod_2817(class_);
            int num = 0;

            while (arg_0.vmethod_1885() && arg_0.prop_9 != Class_508.EndArray)
            {
                this.pmethod_2969(arg_0, arg_1, arg_3, nclass_.field_2, class_);
                num++;
            }
            if (this.prop_1)
            {
                this.gmethod_2973(class_, arg_1);
            }
            if (num == 1 && this.prop_1)
            {
                IEnumerable <Class_391> source = class_.prop_2.OfType <Class_391>();
                if (func == null)
                {
                    func = new Func <Class_391, bool>(nclass_.nmethod_3);
                }
                Class_391 arg_4 = source.Single(func);
                this.gmethod_2973(arg_4, arg_1);
            }
        }
Esempio n. 2
0
 // Token: 0x06001036 RID: 4150 RVA: 0x00051B04 File Offset: 0x0004FD04
 private void gmethod_2973(Class_391 arg_0, Class_389 arg_1)
 {
     arg_0.kmethod_2857(arg_1.tmethod_2842("json:Array", "http://james.newtonking.com/projects/json", "true"));
     if (arg_0 is Class_406 && arg_0.lmethod_2858("http://james.newtonking.com/projects/json") == null)
     {
         arg_0.kmethod_2857(arg_1.tmethod_2842("xmlns:json", "http://www.w3.org/2000/xmlns/", "http://james.newtonking.com/projects/json"));
     }
 }
Esempio n. 3
0
        // Token: 0x06001031 RID: 4145 RVA: 0x00051454 File Offset: 0x0004F654
        public virtual object lmethod_2968(Class_285 arg_0, Type arg_1, object obje_0, Class_418 arg_2)
        {
            if (arg_0.prop_9 == Class_508.Null)
            {
                return(null);
            }
            XmlNamespaceManager xmlNamespaceManager = new XmlNamespaceManager(new NameTable());
            Class_389           class_  = null;
            Class_387           class_2 = null;

            if (typeof(XObject).IsAssignableFrom(arg_1))
            {
                if (arg_1 != typeof(XDocument) && arg_1 != typeof(XElement))
                {
                    throw new Class_417("XmlNodeConverter only supports deserializing XDocument or XElement.");
                }
                XDocument arg_3 = new XDocument();
                class_  = new Class_401(arg_3);
                class_2 = class_;
            }
            if (typeof(XmlNode).IsAssignableFrom(arg_1))
            {
                if (arg_1 != typeof(XmlDocument))
                {
                    throw new Class_417("XmlNodeConverter only supports deserializing XmlDocuments");
                }
                class_ = new Class_390(new XmlDocument
                {
                    XmlResolver = null
                });
                class_2 = class_;
            }
            if (class_ == null || class_2 == null)
            {
                throw new Class_417("Unexpected type when converting XML: " + arg_1);
            }
            if (arg_0.prop_9 != Class_508.StartObject)
            {
                throw new Class_417("XmlNodeConverter can only convert JSON that begins with an object.");
            }
            if (!string.IsNullOrEmpty(this.prop_0))
            {
                this.smethod_2970(arg_0, class_, class_2, this.prop_0, xmlNamespaceManager);
            }
            else
            {
                arg_0.vmethod_1885();
                this.lmethod_2978(arg_0, class_, xmlNamespaceManager, class_2);
            }
            if (arg_1 == typeof(XElement))
            {
                XElement xelement = (XElement)class_.prop_0.prop_7;
                xelement.Remove();
                return(xelement);
            }
            return(class_.prop_7);
        }
Esempio n. 4
0
        // Token: 0x06001033 RID: 4147 RVA: 0x000516F8 File Offset: 0x0004F8F8
        private void smethod_2970(Class_285 arg_0, Class_389 arg_1, Class_387 arg_2, string str_0, XmlNamespaceManager arg_3)
        {
            if (string.IsNullOrEmpty(str_0))
            {
                throw new Class_417("XmlNodeConverter cannot convert JSON with an empty property name to XML.");
            }
            Dictionary <string, string> dictionary = this.cmethod_2974(arg_0, arg_3);
            string prefix = Class_513.GetPrefix(str_0);

            if (str_0.StartsWith('@'))
            {
                string    text    = str_0.Substring(1);
                string    text2   = arg_0.prop_10.ToString();
                string    prefix2 = Class_513.GetPrefix(text);
                Class_387 arg_4   = (!string.IsNullOrEmpty(prefix2)) ? arg_1.tmethod_2842(text, arg_3.LookupNamespace(prefix2), text2) : arg_1.xmethod_2841(text, text2);
                ((Class_391)arg_2).kmethod_2857(arg_4);
                return;
            }
            Class_391 class_ = this.kmethod_2977(str_0, arg_1, prefix, arg_3);

            arg_2.kmethod_2817(class_);
            foreach (KeyValuePair <string, string> keyValuePair in dictionary)
            {
                string    prefix3 = Class_513.GetPrefix(keyValuePair.Key);
                Class_387 arg_5   = (!string.IsNullOrEmpty(prefix3)) ? arg_1.tmethod_2842(keyValuePair.Key, arg_3.LookupNamespace(prefix3), keyValuePair.Value) : arg_1.xmethod_2841(keyValuePair.Key, keyValuePair.Value);
                class_.kmethod_2857(arg_5);
            }
            if (arg_0.prop_9 == Class_508.String || arg_0.prop_9 == Class_508.Integer || arg_0.prop_9 == Class_508.Float || arg_0.prop_9 == Class_508.Boolean || arg_0.prop_9 == Class_508.Date)
            {
                class_.kmethod_2817(arg_1.tmethod_2832(this.xmethod_2971(arg_0)));
                return;
            }
            if (arg_0.prop_9 == Class_508.Null)
            {
                return;
            }
            if (arg_0.prop_9 != Class_508.EndObject)
            {
                arg_3.PushScope();
                this.lmethod_2978(arg_0, arg_1, arg_3, class_);
                arg_3.PopScope();
            }
            arg_3.RemoveNamespace(string.Empty, arg_3.DefaultNamespace);
        }
Esempio n. 5
0
        // Token: 0x06001039 RID: 4153 RVA: 0x00051EA0 File Offset: 0x000500A0
        private void dmethod_2976(Class_285 arg_0, Class_389 arg_1, Class_387 arg_2)
        {
            string str_  = null;
            string str_2 = null;
            string str_3 = null;
            string str_4 = null;

            while (arg_0.vmethod_1885() && arg_0.prop_9 != Class_508.EndObject)
            {
                string a;
                if ((a = arg_0.prop_10.ToString()) != null)
                {
                    if (a == "@name")
                    {
                        arg_0.vmethod_1885();
                        str_ = arg_0.prop_10.ToString();
                        continue;
                    }
                    if (a == "@public")
                    {
                        arg_0.vmethod_1885();
                        str_2 = arg_0.prop_10.ToString();
                        continue;
                    }
                    if (a == "@system")
                    {
                        arg_0.vmethod_1885();
                        str_3 = arg_0.prop_10.ToString();
                        continue;
                    }
                    if (a == "@internalSubset")
                    {
                        arg_0.vmethod_1885();
                        str_4 = arg_0.prop_10.ToString();
                        continue;
                    }
                }
                throw new Class_417("Unexpected property name encountered while deserializing XmlDeclaration: " + arg_0.prop_10);
            }
            Class_387 arg_3 = arg_1.kmethod_2837(str_, str_2, str_3, str_4);

            arg_2.kmethod_2817(arg_3);
        }
Esempio n. 6
0
 // Token: 0x06001032 RID: 4146 RVA: 0x000515C8 File Offset: 0x0004F7C8
 private void pmethod_2969(Class_285 arg_0, Class_389 arg_1, XmlNamespaceManager arg_2, string str_0, Class_387 arg_3)
 {
     if (str_0 != null)
     {
         if (str_0 == "#text")
         {
             arg_3.kmethod_2817(arg_1.tmethod_2832(arg_0.prop_10.ToString()));
             return;
         }
         if (str_0 == "#cdata-section")
         {
             arg_3.kmethod_2817(arg_1.gmethod_2833(arg_0.prop_10.ToString()));
             return;
         }
         if (str_0 == "#whitespace")
         {
             arg_3.kmethod_2817(arg_1.cmethod_2834(arg_0.prop_10.ToString()));
             return;
         }
         if (str_0 == "#significant-whitespace")
         {
             arg_3.kmethod_2817(arg_1.vmethod_2835(arg_0.prop_10.ToString()));
             return;
         }
     }
     if (!string.IsNullOrEmpty(str_0) && str_0[0] == '?')
     {
         this.vmethod_2975(arg_0, arg_1, arg_3, str_0);
         return;
     }
     if (string.Equals(str_0, "!DOCTYPE", StringComparison.OrdinalIgnoreCase))
     {
         this.dmethod_2976(arg_0, arg_1, arg_3);
         return;
     }
     if (arg_0.prop_9 == Class_508.StartArray)
     {
         this.tmethod_2972(arg_0, arg_1, str_0, arg_3, arg_2);
         return;
     }
     this.smethod_2970(arg_0, arg_1, arg_3, str_0, arg_2);
 }
Esempio n. 7
0
        // Token: 0x06001038 RID: 4152 RVA: 0x00051D80 File Offset: 0x0004FF80
        private void vmethod_2975(Class_285 arg_0, Class_389 arg_1, Class_387 arg_2, string str_0)
        {
            if (str_0 == "?xml")
            {
                string str_  = null;
                string str_2 = null;
                string str_3 = null;
                while (arg_0.vmethod_1885() && arg_0.prop_9 != Class_508.EndObject)
                {
                    string a;
                    if ((a = arg_0.prop_10.ToString()) != null)
                    {
                        if (a == "@version")
                        {
                            arg_0.vmethod_1885();
                            str_ = arg_0.prop_10.ToString();
                            continue;
                        }
                        if (a == "@encoding")
                        {
                            arg_0.vmethod_1885();
                            str_2 = arg_0.prop_10.ToString();
                            continue;
                        }
                        if (a == "@standalone")
                        {
                            arg_0.vmethod_1885();
                            str_3 = arg_0.prop_10.ToString();
                            continue;
                        }
                    }
                    throw new Class_417("Unexpected property name encountered while deserializing XmlDeclaration: " + arg_0.prop_10);
                }
                Class_387 arg_3 = arg_1.dmethod_2836(str_, str_2, str_3);
                arg_2.kmethod_2817(arg_3);
                return;
            }
            Class_387 arg_4 = arg_1.lmethod_2838(str_0.Substring(1), arg_0.prop_10.ToString());

            arg_2.kmethod_2817(arg_4);
        }
Esempio n. 8
0
        // Token: 0x0600103B RID: 4155 RVA: 0x0005200C File Offset: 0x0005020C
        private void lmethod_2978(Class_285 arg_0, Class_389 arg_1, XmlNamespaceManager arg_2, Class_387 arg_3)
        {
            Class_508 class_;

            for (;;)
            {
                Func <Class_391, bool> func    = null;
                Class_407.NClass_2     nclass_ = new Class_407.NClass_2();
                class_ = arg_0.prop_9;
                switch (class_)
                {
                case Class_508.StartConstructor:
                {
                    string str_ = arg_0.prop_10.ToString();
                    while (arg_0.vmethod_1885())
                    {
                        if (arg_0.prop_9 == Class_508.EndConstructor)
                        {
                            break;
                        }
                        this.pmethod_2969(arg_0, arg_1, arg_2, str_, arg_3);
                    }
                    goto IL_182;
                }

                case Class_508.PropertyName:
                {
                    if (arg_3.prop_0 == XmlNodeType.Document && arg_1.prop_0 != null)
                    {
                        goto Block_3;
                    }
                    nclass_.field_3 = arg_0.prop_10.ToString();
                    arg_0.vmethod_1885();
                    if (arg_0.prop_9 != Class_508.StartArray)
                    {
                        this.pmethod_2969(arg_0, arg_1, arg_2, nclass_.field_3, arg_3);
                        goto IL_182;
                    }
                    int num = 0;
                    while (arg_0.vmethod_1885() && arg_0.prop_9 != Class_508.EndArray)
                    {
                        this.pmethod_2969(arg_0, arg_1, arg_2, nclass_.field_3, arg_3);
                        num++;
                    }
                    if (num == 1 && this.prop_1)
                    {
                        IEnumerable <Class_391> source = arg_3.prop_2.OfType <Class_391>();
                        if (func == null)
                        {
                            func = new Func <Class_391, bool>(nclass_.nmethod_5);
                        }
                        Class_391 arg_4 = source.Single(func);
                        this.gmethod_2973(arg_4, arg_1);
                        goto IL_182;
                    }
                    goto IL_182;
                }

                case Class_508.Comment:
                    arg_3.kmethod_2817(arg_1.xmethod_2831((string)arg_0.prop_10));
                    goto IL_182;
                }
                break;
IL_182:
                if (arg_0.prop_9 != Class_508.PropertyName && !arg_0.vmethod_1885())
                {
                    return;
                }
            }
            switch (class_)
            {
            case Class_508.EndObject:
            case Class_508.EndArray:
                return;

            default:
                throw new Class_417("Unexpected JsonToken when deserializing node: " + arg_0.prop_9);
            }
Block_3:
            throw new Class_417("JSON root object has multiple properties. The root object must have a single property in order to create a valid XML document. Consider specifing a DeserializeRootElementName.");
        }
Esempio n. 9
0
        // Token: 0x0600103A RID: 4154 RVA: 0x00051FBC File Offset: 0x000501BC
        private Class_391 kmethod_2977(string str_0, Class_389 arg_0, string str_1, XmlNamespaceManager arg_1)
        {
            string text = string.IsNullOrEmpty(str_1) ? arg_1.DefaultNamespace : arg_1.LookupNamespace(str_1);

            return((!string.IsNullOrEmpty(text)) ? arg_0.smethod_2840(str_0, text) : arg_0.pmethod_2839(str_0));
        }