FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlSerializationWriter.cs (705)
1529Writer.Write(Access);
1530Writer.Write(" class ");
1531Writer.Write(ClassName);
1532Writer.Write(" : ");
1533Writer.Write(typeof(XmlSerializationWriter).FullName);
1534Writer.WriteLine(" {");
1535Writer.Indent++;
1584Writer.Indent--;
1585Writer.WriteLine("}");
1604Writer.WriteLine();
1605Writer.WriteLine("protected override void InitCallbacks() {");
1606Writer.Indent++;
1617Writer.Write("AddWriteCallback(");
1618Writer.Write(RaCodeGen.GetStringForTypeof(typeMapping.TypeDesc.CSharpName, typeMapping.TypeDesc.UseReflection));
1619Writer.Write(", ");
1621Writer.Write(", ");
1623Writer.Write(", new ");
1624Writer.Write(typeof(XmlSerializationWriteCallback).FullName);
1625Writer.Write("(this.");
1626Writer.Write(methodName);
1627Writer.WriteLine("));");
1631Writer.Indent--;
1632Writer.WriteLine("}");
1641Writer.WriteLine(" {");
1642Writer.Indent++;
1645Writer.Write(nullable ? ("WriteNullableQualifiedName" + suffix) : "WriteElementQualifiedName");
1646Writer.Write("(");
1650Writer.Write(", ");
1653Writer.Write(", ");
1654Writer.Write(source);
1658Writer.Write(", new Microsoft.Xml.XmlQualifiedName(");
1660Writer.Write(", ");
1662Writer.Write(")");
1665Writer.WriteLine(");");
1669Writer.Indent--;
1670Writer.WriteLine("}");
1683Writer.Write(methodName);
1684Writer.Write("(");
1685Writer.Write(source);
1686Writer.Write(")");
1693Writer.Write(source);
1699Writer.Write(typeof(XmlConvert).FullName);
1700Writer.Write(".ToString((");
1701Writer.Write(typeDesc.CSharpName);
1702Writer.Write(")");
1703Writer.Write(source);
1704Writer.Write(")");
1708Writer.Write("From");
1709Writer.Write(typeDesc.FormatterName);
1710Writer.Write("(");
1711Writer.Write(source);
1712Writer.Write(")");
1730Writer.Write("if (");
1732Writer.Write(RaCodeGen.GetStringForEnumLongValue(source, mapping.TypeDesc.UseReflection));
1734Writer.Write(source);
1735Writer.Write(" != ");
1738Writer.Write("(");
1745Writer.WriteLine(" | ");
1746Writer.Write(RaCodeGen.GetStringForEnumCompare((EnumMapping)mapping, values[i], mapping.TypeDesc.UseReflection));
1748Writer.Write(")");
1752Writer.Write(RaCodeGen.GetStringForEnumCompare((EnumMapping)mapping, (string)defaultValue, mapping.TypeDesc.UseReflection));
1754Writer.Write(")");
1760Writer.WriteLine(" {");
1761Writer.Indent++;
1763Writer.Write(method);
1764Writer.Write("(");
1768Writer.Write(", ");
1771Writer.Write(", ");
1784Writer.Write(", new Microsoft.Xml.XmlQualifiedName(");
1786Writer.Write(", ");
1788Writer.Write(")");
1791Writer.WriteLine(");");
1795Writer.Indent--;
1796Writer.WriteLine("}");
1802Writer.Write(methodName);
1803Writer.Write("(");
1805Writer.Write(", ");
1808Writer.Write("null");
1814Writer.WriteLine(");");
1819Writer.Write(methodName);
1820Writer.Write("(");
1822Writer.Write(", ");
1825Writer.Write("null");
1831Writer.Write(", null, ");
1833Writer.Write("true");
1835Writer.Write("false");
1836Writer.WriteLine(");");
1846Writer.WriteLine("WriteEndElement();");
1850Writer.Write("WriteEndElement(");
1851Writer.Write(source);
1852Writer.WriteLine(");");
1878Writer.WriteLine();
1879Writer.Write("public void ");
1880Writer.Write(methodName);
1881Writer.WriteLine("(object[] p) {");
1882Writer.Indent++;
1884Writer.WriteLine("WriteStartDocument();");
1888Writer.WriteLine("TopLevelElement();");
1894Writer.WriteLine("int pLength = p.Length;");
1906Writer.Write("if (pLength > ");
1907Writer.Write(xmlnsMember.ToString());
1908Writer.WriteLine(") {");
1909Writer.Indent++;
1911Writer.Indent--;
1912Writer.WriteLine("}");
1939Writer.Write("if (pLength > ");
1940Writer.Write(i.ToString());
1941Writer.WriteLine(") {");
1942Writer.Indent++;
1946Writer.Write("if (pLength <= ");
1947Writer.Write(specifiedPosition.ToString());
1948Writer.Write(" || ");
1949Writer.Write(specifiedSource);
1950Writer.WriteLine(") {");
1951Writer.Indent++;
1958Writer.Indent--;
1959Writer.WriteLine("}");
1962Writer.Indent--;
1963Writer.WriteLine("}");
1993Writer.Write("if (pLength > ");
1994Writer.Write(i.ToString());
1995Writer.WriteLine(") {");
1996Writer.Indent++;
2000Writer.Write("if (pLength <= ");
2001Writer.Write(specifiedPosition.ToString());
2002Writer.Write(" || ");
2003Writer.Write(specifiedSource);
2004Writer.WriteLine(") {");
2005Writer.Indent++;
2033Writer.Write("WriteRpcResult(");
2035Writer.Write(", ");
2037Writer.WriteLine(");");
2045Writer.Indent--;
2046Writer.WriteLine("}");
2049Writer.Indent--;
2050Writer.WriteLine("}");
2062Writer.Write("if (pLength > ");
2063Writer.Write(mapping.Members.Length.ToString());
2064Writer.WriteLine(") {");
2065Writer.Indent++;
2069Writer.Indent--;
2070Writer.WriteLine("}");
2072Writer.WriteLine("WriteReferencedElements();");
2074Writer.Indent--;
2075Writer.WriteLine("}");
2084Writer.WriteLine();
2085Writer.Write("public void ");
2086Writer.Write(methodName);
2087Writer.WriteLine("(object o) {");
2088Writer.Indent++;
2090Writer.WriteLine("WriteStartDocument();");
2092Writer.WriteLine("if (o == null) {");
2093Writer.Indent++;
2103Writer.WriteLine("return;");
2104Writer.Indent--;
2105Writer.WriteLine("}");
2109Writer.WriteLine("TopLevelElement();");
2116Writer.WriteLine("WriteReferencedElements();");
2118Writer.Indent--;
2119Writer.WriteLine("}");
2131Writer.WriteLine();
2135Writer.Write("void ");
2136Writer.Write(methodName);
2137Writer.WriteLine("(object e) {");
2142Writer.Write("string ");
2143Writer.Write(methodName);
2144Writer.Write("(");
2145Writer.Write(mapping.TypeDesc.UseReflection ? "object" : fullTypeName);
2146Writer.WriteLine(" v) {");
2148Writer.Indent++;
2149Writer.WriteLine("string s = null;");
2156Writer.WriteLine("switch (" + RaCodeGen.GetStringForEnumLongValue("v", mapping.TypeDesc.UseReflection) + " ){");
2158Writer.WriteLine("switch (v) {");
2159Writer.Indent++;
2166Writer.Write("s = ");
2168Writer.WriteLine("; break;");
2176Writer.Write("default: s = FromEnum(");
2177Writer.Write(RaCodeGen.GetStringForEnumLongValue("v", mapping.TypeDesc.UseReflection));
2178Writer.Write(", new string[] {");
2179Writer.Indent++;
2184Writer.WriteLine(", ");
2187Writer.Write("}, new ");
2188Writer.Write(typeof(long).FullName);
2189Writer.Write("[] {");
2195Writer.WriteLine(", ");
2196Writer.Write("(long)");
2198Writer.Write(c.Value.ToString());
2201Writer.Write(fullTypeName);
2202Writer.Write(".@");
2204Writer.Write(c.Name);
2207Writer.Indent--;
2208Writer.Write("}, ");
2210Writer.WriteLine("); break;");
2214Writer.Write("default: throw CreateInvalidEnumValueException(");
2215Writer.Write(RaCodeGen.GetStringForEnumLongValue("v", mapping.TypeDesc.UseReflection));
2216Writer.Write(".ToString(System.Globalization.CultureInfo.InvariantCulture), ");
2218Writer.WriteLine(");");
2220Writer.Indent--;
2221Writer.WriteLine("}");
2225Writer.Write("WriteXsiType(");
2227Writer.Write(", ");
2229Writer.WriteLine(");");
2230Writer.WriteLine("Writer.WriteString(s);");
2234Writer.WriteLine("return s;");
2236Writer.Indent--;
2237Writer.WriteLine("}");
2245Writer.Write("else if (");
2247Writer.WriteLine(") {");
2248Writer.Indent++;
2257Writer.Write(methodName);
2258Writer.Write("(n, ns,");
2259if (!derived.TypeDesc.UseReflection) Writer.Write("(" + fullTypeName + ")");
2260Writer.Write("o");
2262Writer.Write(", isNullable");
2263Writer.Write(", true");
2264Writer.WriteLine(");");
2265Writer.WriteLine("return;");
2266Writer.Indent--;
2267Writer.WriteLine("}");
2283Writer.Write("else if (");
2285Writer.WriteLine(") {");
2286Writer.Indent++;
2294Writer.WriteLine("Writer.WriteStartElement(n, ns);");
2295Writer.Write("WriteXsiType(");
2297Writer.Write(", ");
2299Writer.WriteLine(");");
2300Writer.Write("Writer.WriteString(");
2301Writer.Write(methodName);
2302Writer.Write("(");
2303if (!mapping.TypeDesc.UseReflection) Writer.Write("(" + fullTypeName + ")");
2304Writer.WriteLine("o));");
2305Writer.WriteLine("Writer.WriteEndElement();");
2306Writer.WriteLine("return;");
2307Writer.Indent--;
2308Writer.WriteLine("}");
2315Writer.Write("else if (");
2320Writer.WriteLine(") {");
2321Writer.Indent++;
2323Writer.WriteLine("Writer.WriteStartElement(n, ns);");
2324Writer.Write("WriteXsiType(");
2326Writer.Write(", ");
2328Writer.WriteLine(");");
2332Writer.WriteLine("Writer.WriteEndElement();");
2333Writer.WriteLine("return;");
2334Writer.Indent--;
2335Writer.WriteLine("}");
2346Writer.WriteLine();
2347Writer.Write("void ");
2348Writer.Write(methodName);
2354Writer.WriteLine("(object s) {");
2355Writer.Indent++;
2360Writer.Write("(string n, string ns, ");
2361Writer.Write(mapping.TypeDesc.UseReflection ? "object" : fullTypeName);
2362Writer.Write(" o");
2364Writer.Write(", bool isNullable");
2365Writer.WriteLine(", bool needType) {");
2366Writer.Indent++;
2369Writer.WriteLine("if ((object)o == null) {");
2370Writer.Indent++;
2371Writer.WriteLine("if (isNullable) WriteNullTagLiteral(n, ns);");
2372Writer.WriteLine("return;");
2373Writer.Indent--;
2374Writer.WriteLine("}");
2376Writer.WriteLine("if (!needType) {");
2377Writer.Indent++;
2379Writer.Write(typeof(Type).FullName);
2380Writer.WriteLine(" t = o.GetType();");
2381Writer.Write("if (");
2383Writer.WriteLine(") {");
2384Writer.WriteLine("}");
2388Writer.WriteLine("else {");
2390Writer.Indent++;
2393Writer.WriteLine("WriteTypedPrimitive(n, ns, o, true);");
2394Writer.WriteLine("return;");
2398Writer.WriteLine("throw CreateUnknownTypeException(o);");
2400Writer.Indent--;
2401Writer.WriteLine("}");
2402Writer.Indent--;
2403Writer.WriteLine("}");
2410Writer.WriteLine("EscapeName = false;");
2429Writer.Write("WriteStartElement(n, ns, o, false, ");
2431Writer.Write("null");
2433Writer.Write(xmlnsSource);
2435Writer.WriteLine(");");
2438Writer.Write("if (needType) WriteXsiType(");
2440Writer.Write(", ");
2442Writer.WriteLine(");");
2457Writer.Write("if (");
2460Writer.Write(methodInvoke);
2461Writer.WriteLine(") {");
2462Writer.Indent++;
2466Writer.Write("if (");
2469Writer.Write(memberGet);
2470Writer.WriteLine(") {");
2471Writer.Indent++;
2477Writer.Indent--;
2478Writer.WriteLine("}");
2482Writer.Indent--;
2483Writer.WriteLine("}");
2498Writer.Write("if (");
2501Writer.Write(methodInvoke);
2502Writer.WriteLine(") {");
2503Writer.Indent++;
2507Writer.Write("if (");
2510Writer.Write(memberGet);
2511Writer.WriteLine(") {");
2512Writer.Indent++;
2525Writer.Indent--;
2526Writer.WriteLine("}");
2530Writer.Indent--;
2531Writer.WriteLine("}");
2539Writer.Indent--;
2540Writer.WriteLine("}");
2557Writer.WriteLine("{");
2558Writer.Indent++;
2563Writer.WriteLine("if (a != null) {");
2564Writer.Indent++;
2570Writer.Write("Writer.WriteStartAttribute(null, ");
2572Writer.Write(", ");
2580Writer.Write("null");
2582Writer.WriteLine(");");
2586Writer.Write(typeof(StringBuilder).FullName);
2587Writer.Write(" sb = new ");
2588Writer.Write(typeof(StringBuilder).FullName);
2589Writer.WriteLine("();");
2596Writer.Write(" e = ");
2597Writer.Write(typeof(IEnumerator).FullName);
2600Writer.Write("((");
2601Writer.Write(typeof(IEnumerable).FullName);
2602Writer.WriteLine(").GetEnumerator();");
2609Writer.Write("(");
2610Writer.Write(typeof(IEnumerator).FullName);
2611Writer.Write(")");
2612Writer.Write(RaCodeGen.GetReflectionVariable(memberTypeDesc.CSharpName, "System.Collections.Generic.IEnumerable*"));
2613Writer.WriteLine(".Invoke(a, new object[0]);");
2617Writer.Write("((System.Collections.Generic.IEnumerable<");
2618Writer.Write(arrayElementTypeDesc.CSharpName);
2619Writer.WriteLine(">)a).GetEnumerator();");
2626Writer.Write("(");
2627Writer.Write(typeof(IEnumerator).FullName);
2628Writer.Write(")");
2630Writer.Write(RaCodeGen.GetStringForMethodInvoke("a", memberTypeDesc.CSharpName, "GetEnumerator", memberTypeDesc.UseReflection));
2631Writer.WriteLine(";");
2633Writer.WriteLine("if (e != null)");
2634Writer.WriteLine("while (e.MoveNext()) {");
2635Writer.Indent++;
2642Writer.Write("for (int i = 0; i < ");
2645Writer.WriteLine("a.Length; i++) {");
2649Writer.Write("((");
2650Writer.Write(typeof(ICollection).FullName);
2651Writer.WriteLine(")a).Count; i++) {");
2653Writer.Indent++;
2662Writer.WriteLine("if (i != 0) Writer.WriteString(\" \");");
2663Writer.Write("WriteValue(");
2667Writer.WriteLine("if (i != 0) sb.Append(\" \");");
2668Writer.Write("sb.Append(");
2674Writer.WriteLine(");");
2680Writer.Indent--;
2681Writer.WriteLine("}");
2687Writer.WriteLine("Writer.WriteEndAttribute();");
2691Writer.WriteLine("if (sb.Length != 0) {");
2692Writer.Indent++;
2694Writer.Write("WriteAttribute(");
2696Writer.Write(", ");
2701Writer.Write(", ");
2703Writer.WriteLine("sb.ToString());");
2704Writer.Indent--;
2705Writer.WriteLine("}");
2711Writer.Indent--;
2712Writer.WriteLine("}");
2714Writer.Indent--;
2715Writer.WriteLine("}");
2730Writer.Write("WriteXmlAttribute(");
2731Writer.Write(source);
2732Writer.Write(", ");
2733Writer.Write(parent);
2734Writer.WriteLine(");");
2760Writer.WriteLine("{");
2761Writer.Indent++;
2766Writer.WriteLine("if (a != null) {");
2767Writer.Indent++;
2776Writer.WriteLine("if (c == null || c.Length < a.Length) {");
2777Writer.Indent++;
2778Writer.Write("throw CreateInvalidChoiceIdentifierValueException(");
2780Writer.Write(", ");
2782Writer.Write(");");
2783Writer.Indent--;
2784Writer.WriteLine("}");
2790Writer.Indent--;
2791Writer.WriteLine("}");
2793Writer.Indent--;
2794Writer.WriteLine("}");
2803Writer.Write(typeof(IEnumerator).FullName);
2804Writer.Write(" e = ");
2807Writer.Write("((");
2808Writer.Write(typeof(IEnumerable).FullName);
2809Writer.Write(")");
2810Writer.Write(arrayName);
2811Writer.WriteLine(").GetEnumerator();");
2818Writer.Write("(");
2819Writer.Write(typeof(IEnumerator).FullName);
2820Writer.Write(")");
2821Writer.Write(RaCodeGen.GetReflectionVariable(arrayTypeDesc.CSharpName, "System.Collections.Generic.IEnumerable*"));
2822Writer.Write(".Invoke(");
2823Writer.Write(arrayName);
2824Writer.WriteLine(", new object[0]);");
2828Writer.Write("((System.Collections.Generic.IEnumerable<");
2829Writer.Write(arrayElementTypeDesc.CSharpName);
2830Writer.Write(">)");
2831Writer.Write(arrayName);
2832Writer.WriteLine(").GetEnumerator();");
2839Writer.Write("(");
2840Writer.Write(typeof(IEnumerator).FullName);
2841Writer.Write(")");
2843Writer.Write(RaCodeGen.GetStringForMethodInvoke(arrayName, arrayTypeDesc.CSharpName, "GetEnumerator", arrayTypeDesc.UseReflection));
2844Writer.WriteLine(";");
2846Writer.WriteLine("if (e != null)");
2847Writer.WriteLine("while (e.MoveNext()) {");
2848Writer.Indent++;
2855Writer.Write("for (int i");
2856Writer.Write(arrayName);
2857Writer.Write(" = 0; i");
2858Writer.Write(arrayName);
2859Writer.Write(" < ");
2862Writer.Write(arrayName);
2863Writer.Write(".Length");
2867Writer.Write("((");
2868Writer.Write(typeof(ICollection).FullName);
2869Writer.Write(")");
2870Writer.Write(arrayName);
2871Writer.Write(").Count");
2873Writer.Write("; i");
2874Writer.Write(arrayName);
2875Writer.WriteLine("++) {");
2876Writer.Indent++;
2894Writer.Indent--;
2895Writer.WriteLine("}");
2917Writer.Write("if ((object)(");
2918Writer.Write(source);
2919Writer.Write(") != null)");
2921Writer.WriteLine("{");
2922Writer.Indent++;
2948if (wroteFirstIf) Writer.Write("else ");
2950Writer.Write("if (");
2951Writer.Write(enumUseReflection ? RaCodeGen.GetStringForEnumLongValue(enumSource, enumUseReflection) : enumSource);
2952Writer.Write(" == ");
2953Writer.Write(enumFullName);
2956Writer.Write(" && ((object)(");
2957Writer.Write(source);
2958Writer.Write(") != null)");
2960Writer.WriteLine(") {");
2961Writer.Indent++;
2969Writer.Indent--;
2970Writer.WriteLine("}");
2977if (wroteFirstIf) Writer.Write("else ");
2979Writer.Write("if (");
2981Writer.WriteLine(") {");
2982Writer.Indent++;
2987Writer.Indent--;
2988Writer.WriteLine("}");
2993if (elements.Length - anyCount > 0) Writer.Write("else ");
2997Writer.Write("if (");
2998Writer.Write(source);
2999Writer.Write(" is ");
3000Writer.Write(fullTypeName);
3001Writer.WriteLine(") {");
3002Writer.Indent++;
3004Writer.Write(fullTypeName);
3005Writer.Write(" elem = (");
3006Writer.Write(fullTypeName);
3007Writer.Write(")");
3008Writer.Write(source);
3009Writer.WriteLine(";");
3015if (c++ > 0) Writer.Write("else ");
3024Writer.Write("if (");
3025Writer.Write(enumUseReflection ? RaCodeGen.GetStringForEnumLongValue(enumSource, enumUseReflection) : enumSource);
3026Writer.Write(" == ");
3027Writer.Write(enumFullName);
3030Writer.Write(" && ((object)(");
3031Writer.Write(source);
3032Writer.Write(") != null)");
3034Writer.WriteLine(") {");
3035Writer.Indent++;
3037Writer.Write("if (elem.Name == ");
3039Writer.Write(" && elem.NamespaceURI == ");
3041Writer.WriteLine(") {");
3042Writer.Indent++;
3047Writer.Indent--;
3048Writer.WriteLine("}");
3049Writer.WriteLine("else {");
3050Writer.Indent++;
3052Writer.WriteLine("// throw Value '{0}' of the choice identifier '{1}' does not match element '{2}' from namespace '{3}'.");
3054Writer.Write("throw CreateChoiceIdentifierValueException(");
3056Writer.Write(", ");
3058Writer.WriteLine(", elem.Name, elem.NamespaceURI);");
3059Writer.Indent--;
3060Writer.WriteLine("}");
3062Writer.Indent--;
3063Writer.WriteLine("}");
3067Writer.WriteLine("else {");
3068Writer.Indent++;
3076Writer.WriteLine("throw CreateUnknownAnyElementException(elem.Name, elem.NamespaceURI);");
3080Writer.Indent--;
3081Writer.WriteLine("}");
3083Writer.Indent--;
3084Writer.WriteLine("}");
3092Writer.Write("else ");
3093Writer.Write("if (");
3095Writer.WriteLine(") {");
3096Writer.Indent++;
3101Writer.Indent--;
3102Writer.WriteLine("}");
3114Writer.Write("else ");
3118Writer.Write(" if ((object)(");
3119Writer.Write(source);
3120Writer.Write(") != null)");
3123Writer.WriteLine("{");
3124Writer.Indent++;
3126Writer.Write("throw CreateUnknownTypeException(");
3127Writer.Write(source);
3128Writer.WriteLine(");");
3130Writer.Indent--;
3131Writer.WriteLine("}");
3133Writer.Indent--;
3134Writer.WriteLine("}");
3143Writer.Write("WriteValue(");
3152Writer.WriteLine(");");
3160Writer.Write(source);
3161Writer.WriteLine(".WriteTo(Writer);");
3175Writer.Write("if (");
3176Writer.Write(source);
3177Writer.WriteLine(" != null) {");
3178Writer.Indent++;
3186Writer.Indent--;
3187Writer.WriteLine("}");
3190Writer.WriteLine("else {");
3191Writer.Indent++;
3193Writer.Indent--;
3194Writer.WriteLine("}");
3202Writer.Write("WritePotentiallyReferencingElement(");
3204Writer.Write(", ");
3206Writer.Write(", ");
3207Writer.Write(source);
3210Writer.Write(", ");
3211Writer.Write(RaCodeGen.GetStringForTypeof(mapping.TypeDesc.CSharpName, mapping.TypeDesc.UseReflection));
3212Writer.Write(", true, ");
3216Writer.Write(", null, false, ");
3219Writer.WriteLine(");");
3227Writer.WriteLine("{");
3228Writer.Indent++;
3238Writer.Write("if (");
3239Writer.Write(elementArrayName);
3240Writer.Write(" != null)");
3242Writer.WriteLine("{");
3243Writer.Indent++;
3246Writer.Write("for (int ");
3247Writer.Write(arrayIndex);
3248Writer.Write(" = 0; ");
3249Writer.Write(arrayIndex);
3250Writer.Write(" < ");
3254Writer.Write(elementArrayName);
3255Writer.Write(".Length");
3259Writer.Write("((");
3260Writer.Write(typeof(ICollection).FullName);
3261Writer.Write(")");
3262Writer.Write(elementArrayName);
3263Writer.Write(").Count");
3265Writer.Write("; ");
3266Writer.Write(arrayIndex);
3267Writer.WriteLine("++) {");
3268Writer.Indent++;
3274Writer.Indent--;
3275Writer.WriteLine("}");
3277Writer.Indent--;
3278Writer.WriteLine("}");
3279Writer.Indent--;
3280Writer.WriteLine("}");
3285Writer.WriteLine("{");
3286Writer.Indent++;
3296Writer.Write("if (");
3297Writer.Write(arrayName);
3298Writer.Write(" != null)");
3300Writer.WriteLine("{");
3301Writer.Indent++;
3306Writer.Indent--;
3307Writer.WriteLine("}");
3308Writer.Indent--;
3309Writer.WriteLine("}");
3317Writer.Write("Writer.WriteStartElement(");
3319Writer.Write(", ");
3321Writer.WriteLine(");");
3322Writer.Write(methodName);
3323Writer.Write("(");
3324Writer.Write(source);
3325Writer.WriteLine(");");
3352Writer.Write("WritePotentiallyReferencingElement(");
3354Writer.Write(", ");
3356Writer.Write(", ");
3357Writer.Write(source);
3360Writer.Write(", ");
3361Writer.Write(RaCodeGen.GetStringForTypeof(mapping.TypeDesc.CSharpName, mapping.TypeDesc.UseReflection));
3362Writer.Write(", true, ");
3366Writer.Write(", null, false, ");
3378Writer.Write(methodName);
3379Writer.Write("(");
3381Writer.Write(", ");
3383Writer.Write("null");
3388Writer.Write(", ");
3389Writer.Write(source);
3392Writer.Write(", ");
3395Writer.Write(", false");
3397Writer.WriteLine(");");
3414Writer.Write("if ((");
3415Writer.Write(source);
3416Writer.Write(") is ");
3417Writer.Write(typeof(XmlNode).FullName);
3418Writer.Write(" || ");
3419Writer.Write(source);
3420Writer.Write(" == null");
3421Writer.WriteLine(") {");
3422Writer.Indent++;
3426Writer.Indent--;
3427Writer.WriteLine("}");
3428Writer.WriteLine("else {");
3429Writer.Indent++;
3431Writer.Write("throw CreateInvalidAnyTypeException(");
3432Writer.Write(source);
3433Writer.WriteLine(");");
3435Writer.Indent--;
3436Writer.WriteLine("}");
3447Writer.Write(func);
3448Writer.Write("((");
3449Writer.Write(cast.FullName);
3450Writer.Write(")");
3451Writer.Write(source);
3452Writer.Write(", ");
3454Writer.Write(", ");
3456Writer.Write(", ");
3458Writer.Write(", ");
3460Writer.WriteLine(");");
3465Writer.Write("if (");
3470Writer.Write("(");
3471Writer.Write(source);
3473Writer.Write(" == null) || (");
3475Writer.Write(" != null) && (");
3476Writer.Write(source);
3477Writer.Write(".Length != 0)");
3481Writer.Write(source);
3482Writer.Write(" != ");
3485Writer.Write(")");
3490Writer.Write("if (((object)");
3491Writer.Write(source);
3492Writer.Write(") != null && !(");
3494Writer.Write(")) throw CreateMismatchChoiceException(");
3496Writer.Write(", ");
3498Writer.Write(", ");
3500Writer.WriteLine(");");
3505Writer.Write("if ((object)(");
3506Writer.Write(source);
3507Writer.WriteLine(") == null) {");
3508Writer.Indent++;
3510Writer.Indent--;
3511Writer.WriteLine("}");
3512Writer.WriteLine("else {");
3513Writer.Indent++;
3520Writer.Write("null");
3536Writer.Write('\'');
3539Writer.Write("\'");
3541Writer.Write(ch);
3542Writer.Write('\'');
3546Writer.Write(((Int32)value).ToString(null, NumberFormatInfo.InvariantInfo));
3549Writer.Write(((Double)value).ToString("R", NumberFormatInfo.InvariantInfo));
3552Writer.Write((bool)value ? "true" : "false");
3561Writer.Write("(");
3562Writer.Write(type.FullName);
3563Writer.Write(")");
3564Writer.Write("(");
3565Writer.Write(Convert.ToString(value, NumberFormatInfo.InvariantInfo));
3566Writer.Write(")");
3569Writer.Write(((Single)value).ToString("R", NumberFormatInfo.InvariantInfo));
3570Writer.Write("f");
3573Writer.Write(((Decimal)value).ToString(null, NumberFormatInfo.InvariantInfo));
3574Writer.Write("m");
3577Writer.Write(" new ");
3578Writer.Write(type.FullName);
3579Writer.Write("(");
3580Writer.Write(((DateTime)value).Ticks.ToString());
3581Writer.Write(")");
3586Writer.Write(((int)value).ToString(null, NumberFormatInfo.InvariantInfo));
3599Writer.Write("WriteNamespaceDeclarations(");
3600Writer.Write(source);
3601Writer.WriteLine(");");
3617Writer.Write("for (int i = ");
3618Writer.Write(loopStartSource);
3619Writer.Write("; i < ");
3620Writer.Write(loopEndSource);
3621Writer.WriteLine("; i++) {");
3622Writer.Indent++;
3623Writer.WriteLine("if (p[i] != null) {");
3624Writer.Indent++;
3625Writer.WriteLine("WritePotentiallyReferencingElement(null, null, p[i], p[i].GetType(), true, false);");
3626Writer.Indent--;
3627Writer.WriteLine("}");
3628Writer.Indent--;
3629Writer.WriteLine("}");