Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        // Token: 0x06000E7C RID: 3708 RVA: 0x0004CCD0 File Offset: 0x0004AED0
        public virtual void cmethod_2604(Class_296 arg_0, params Class_299[] arg_1)
        {
            if (arg_1 != null && arg_1.Length > 0 && this.field_1 != null)
            {
                Class_299 class_ = Class_418.xmethod_3181(arg_1, this.field_1.GetType());
                if (class_ != null && class_.prop_1)
                {
                    class_.tmethod_2132(arg_0, this.field_1, Class_418.xmethod_3161());
                    return;
                }
            }
            switch (this.field_0)
            {
            case Class_428.Comment:
                arg_0.vmethod_2075((this.field_1 != null) ? this.field_1.ToString() : null);
                return;

            case Class_428.Integer:
                if (this.field_1 is BigInteger)
                {
                    arg_0.cmethod_2074((BigInteger)this.field_1);
                    return;
                }
                arg_0.smethod_2040(Convert.ToInt64(this.field_1, CultureInfo.InvariantCulture));
                return;

            case Class_428.Float:
                if (this.field_1 is decimal)
                {
                    arg_0.smethod_2050((decimal)this.field_1);
                    return;
                }
                if (this.field_1 is double)
                {
                    arg_0.gmethod_2043((double)this.field_1);
                    return;
                }
                if (this.field_1 is float)
                {
                    arg_0.tmethod_2042((float)this.field_1);
                    return;
                }
                arg_0.gmethod_2043(Convert.ToDouble(this.field_1, CultureInfo.InvariantCulture));
                return;

            case Class_428.String:
                arg_0.kmethod_2037((this.field_1 != null) ? this.field_1.ToString() : null);
                return;

            case Class_428.Boolean:
                arg_0.cmethod_2044(Convert.ToBoolean(this.field_1, CultureInfo.InvariantCulture));
                return;

            case Class_428.Null:
                arg_0.gmethod_2033();
                return;

            case Class_428.Undefined:
                arg_0.cmethod_2034();
                return;

            case Class_428.Date:
                if (this.field_1 is DateTimeOffset)
                {
                    arg_0.tmethod_2052((DateTimeOffset)this.field_1);
                    return;
                }
                arg_0.xmethod_2051(Convert.ToDateTime(this.field_1, CultureInfo.InvariantCulture));
                return;

            case Class_428.Raw:
                arg_0.dmethod_2036((this.field_1 != null) ? this.field_1.ToString() : null);
                return;

            case Class_428.Bytes:
                arg_0.tmethod_2072((byte[])this.field_1);
                return;

            case Class_428.Guid:
            case Class_428.Uri:
            case Class_428.TimeSpan:
                arg_0.kmethod_2037((this.field_1 != null) ? this.field_1.ToString() : null);
                return;

            default:
                throw Class_513.CreateArgumentOutOfRangeException("TokenType", this.field_0, "Unexpected token type.");
            }
        }