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: 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. 4
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. 5
0
        // Token: 0x06001030 RID: 4144 RVA: 0x00050F3C File Offset: 0x0004F13C
        private void kmethod_2967(Class_296 arg_0, Class_387 arg_1, XmlNamespaceManager arg_2, bool bool_0)
        {
            Func <Class_387, bool> func = null;

            Class_407.NClass_0 nclass_ = new Class_407.NClass_0();
            nclass_.field_1 = arg_1;
            switch (nclass_.field_1.prop_0)
            {
            case XmlNodeType.Element:
                if (this.vmethod_2965(nclass_.field_1))
                {
                    IEnumerable <Class_387> source = nclass_.field_1.prop_2;
                    if (func == null)
                    {
                        func = new Func <Class_387, bool>(nclass_.nmethod_1);
                    }
                    if (source.All(func) && nclass_.field_1.prop_2.Count > 0)
                    {
                        this.dmethod_2966(arg_0, nclass_.field_1, arg_2, false);
                        return;
                    }
                }
                arg_2.PushScope();
                foreach (Class_387 class_ in nclass_.field_1.prop_3)
                {
                    if (class_.prop_6 == "http://www.w3.org/2000/xmlns/")
                    {
                        string prefix = (class_.prop_1 != "xmlns") ? class_.prop_1 : string.Empty;
                        string uri    = class_.prop_5;
                        arg_2.AddNamespace(prefix, uri);
                    }
                }
                if (bool_0)
                {
                    arg_0.gmethod_2013(this.cmethod_2964(nclass_.field_1, arg_2));
                }
                if (!this.smethod_2980(nclass_.field_1.prop_3).Any <Class_387>() && nclass_.field_1.prop_2.Count == 1 && nclass_.field_1.prop_2[0].prop_0 == XmlNodeType.Text)
                {
                    arg_0.kmethod_2037(nclass_.field_1.prop_2[0].prop_5);
                }
                else if (nclass_.field_1.prop_2.Count == 0 && Class_510.IsNullOrEmpty <Class_387>(nclass_.field_1.prop_3))
                {
                    Class_391 class_2 = (Class_391)nclass_.field_1;
                    if (class_2.prop_0)
                    {
                        arg_0.gmethod_2033();
                    }
                    else
                    {
                        arg_0.kmethod_2037(string.Empty);
                    }
                }
                else
                {
                    arg_0.kmethod_2007();
                    for (int i = 0; i < nclass_.field_1.prop_3.Count; i++)
                    {
                        this.kmethod_2967(arg_0, nclass_.field_1.prop_3[i], arg_2, true);
                    }
                    this.dmethod_2966(arg_0, nclass_.field_1, arg_2, true);
                    arg_0.lmethod_2008();
                }
                arg_2.PopScope();
                return;

            case XmlNodeType.Attribute:
            case XmlNodeType.Text:
            case XmlNodeType.CDATA:
            case XmlNodeType.ProcessingInstruction:
            case XmlNodeType.Whitespace:
            case XmlNodeType.SignificantWhitespace:
                if (nclass_.field_1.prop_6 == "http://www.w3.org/2000/xmlns/" && nclass_.field_1.prop_5 == "http://james.newtonking.com/projects/json")
                {
                    return;
                }
                if (nclass_.field_1.prop_6 == "http://james.newtonking.com/projects/json" && nclass_.field_1.prop_1 == "Array")
                {
                    return;
                }
                if (bool_0)
                {
                    arg_0.gmethod_2013(this.cmethod_2964(nclass_.field_1, arg_2));
                }
                arg_0.kmethod_2037(nclass_.field_1.prop_5);
                return;

            case XmlNodeType.Comment:
                if (bool_0)
                {
                    arg_0.vmethod_2075(nclass_.field_1.prop_5);
                    return;
                }
                return;

            case XmlNodeType.Document:
            case XmlNodeType.DocumentFragment:
                this.dmethod_2966(arg_0, nclass_.field_1, arg_2, bool_0);
                return;

            case XmlNodeType.DocumentType:
            {
                Class_395 class_3 = (Class_395)nclass_.field_1;
                arg_0.gmethod_2013(this.cmethod_2964(nclass_.field_1, arg_2));
                arg_0.kmethod_2007();
                if (!string.IsNullOrEmpty(class_3.prop_0))
                {
                    arg_0.gmethod_2013("@name");
                    arg_0.kmethod_2037(class_3.prop_0);
                }
                if (!string.IsNullOrEmpty(class_3.prop_2))
                {
                    arg_0.gmethod_2013("@public");
                    arg_0.kmethod_2037(class_3.prop_2);
                }
                if (!string.IsNullOrEmpty(class_3.prop_1))
                {
                    arg_0.gmethod_2013("@system");
                    arg_0.kmethod_2037(class_3.prop_1);
                }
                if (!string.IsNullOrEmpty(class_3.prop_3))
                {
                    arg_0.gmethod_2013("@internalSubset");
                    arg_0.kmethod_2037(class_3.prop_3);
                }
                arg_0.lmethod_2008();
                return;
            }

            case XmlNodeType.XmlDeclaration:
            {
                Class_393 class_4 = (Class_393)nclass_.field_1;
                arg_0.gmethod_2013(this.cmethod_2964(nclass_.field_1, arg_2));
                arg_0.kmethod_2007();
                if (!string.IsNullOrEmpty(class_4.prop_0))
                {
                    arg_0.gmethod_2013("@version");
                    arg_0.kmethod_2037(class_4.prop_0);
                }
                if (!string.IsNullOrEmpty(class_4.prop_1))
                {
                    arg_0.gmethod_2013("@encoding");
                    arg_0.kmethod_2037(class_4.prop_1);
                }
                if (!string.IsNullOrEmpty(class_4.prop_2))
                {
                    arg_0.gmethod_2013("@standalone");
                    arg_0.kmethod_2037(class_4.prop_2);
                }
                arg_0.lmethod_2008();
                return;
            }
            }
            throw new Class_417("Unexpected XmlNodeType when serializing nodes: " + nclass_.field_1.prop_0);
        }
Esempio n. 6
0
 // Token: 0x06001047 RID: 4167 RVA: 0x000522CB File Offset: 0x000504CB
 public bool nmethod_5(Class_391 arg_0)
 {
     return(arg_0.prop_1 == this.field_3);
 }