System\Xml\Serialization\XmlSerializationWriter.cs (710)
1310Writer.Write(Access);
1311Writer.Write(" class ");
1312Writer.Write(ClassName);
1313Writer.Write(" : ");
1314Writer.Write(typeof(XmlSerializationWriter).FullName);
1315Writer.WriteLine(" {");
1316Writer.Indent++;
1356Writer.Indent--;
1357Writer.WriteLine("}");
1374Writer.WriteLine();
1375Writer.WriteLine("protected override void InitCallbacks() {");
1376Writer.Indent++;
1385Writer.Write("AddWriteCallback(");
1386Writer.Write(RaCodeGen.GetStringForTypeof(typeMapping.TypeDesc.CSharpName, typeMapping.TypeDesc.UseReflection));
1387Writer.Write(", ");
1389Writer.Write(", ");
1391Writer.Write(", new ");
1392Writer.Write(typeof(XmlSerializationWriteCallback).FullName);
1393Writer.Write("(this.");
1394Writer.Write(methodName);
1395Writer.WriteLine("));");
1399Writer.Indent--;
1400Writer.WriteLine("}");
1407Writer.WriteLine(" {");
1408Writer.Indent++;
1411Writer.Write(nullable ? ("WriteNullableQualifiedName" + suffix): "WriteElementQualifiedName");
1412Writer.Write("(");
1415Writer.Write(", ");
1418Writer.Write(", ");
1419Writer.Write(source);
1422Writer.Write(", new System.Xml.XmlQualifiedName(");
1424Writer.Write(", ");
1426Writer.Write(")");
1429Writer.WriteLine(");");
1432Writer.Indent--;
1433Writer.WriteLine("}");
1445Writer.Write(methodName);
1446Writer.Write("(");
1447Writer.Write(source);
1448Writer.Write(")");
1453Writer.Write(source);
1457Writer.Write(typeof(XmlConvert).FullName);
1458Writer.Write(".ToString((");
1459Writer.Write(typeDesc.CSharpName);
1460Writer.Write(")");
1461Writer.Write(source);
1462Writer.Write(")");
1465Writer.Write("From");
1466Writer.Write(typeDesc.FormatterName);
1467Writer.Write("(");
1468Writer.Write(source);
1469Writer.Write(")");
1484Writer.Write("if (");
1486Writer.Write(RaCodeGen.GetStringForEnumLongValue(source, mapping.TypeDesc.UseReflection));
1488Writer.Write(source);
1489Writer.Write(" != ");
1491Writer.Write("(");
1497Writer.WriteLine(" | ");
1498Writer.Write(RaCodeGen.GetStringForEnumCompare((EnumMapping)mapping, values[i], mapping.TypeDesc.UseReflection));
1500Writer.Write(")");
1503Writer.Write(RaCodeGen.GetStringForEnumCompare((EnumMapping)mapping, (string)defaultValue, mapping.TypeDesc.UseReflection));
1505Writer.Write(")");
1510Writer.WriteLine(" {");
1511Writer.Indent++;
1513Writer.Write(method);
1514Writer.Write("(");
1517Writer.Write(", ");
1520Writer.Write(", ");
1530Writer.Write(", new System.Xml.XmlQualifiedName(");
1532Writer.Write(", ");
1534Writer.Write(")");
1537Writer.WriteLine(");");
1540Writer.Indent--;
1541Writer.WriteLine("}");
1546Writer.Write(methodName);
1547Writer.Write("(");
1549Writer.Write(", ");
1551Writer.Write("null");
1556Writer.WriteLine(");");
1560Writer.Write(methodName);
1561Writer.Write("(");
1563Writer.Write(", ");
1565Writer.Write("null");
1570Writer.Write(", null, ");
1572Writer.Write("true");
1574Writer.Write("false");
1575Writer.WriteLine(");");
1583Writer.WriteLine("WriteEndElement();");
1586Writer.Write("WriteEndElement(");
1587Writer.Write(source);
1588Writer.WriteLine(");");
1610Writer.WriteLine();
1611Writer.Write("public void ");
1612Writer.Write(methodName);
1613Writer.WriteLine("(object[] p) {");
1614Writer.Indent++;
1616Writer.WriteLine("WriteStartDocument();");
1619Writer.WriteLine("TopLevelElement();");
1625Writer.WriteLine("int pLength = p.Length;");
1635Writer.Write("if (pLength > ");
1636Writer.Write(xmlnsMember.ToString(CultureInfo.InvariantCulture));
1637Writer.WriteLine(") {");
1638Writer.Indent++;
1640Writer.Indent--;
1641Writer.WriteLine("}");
1663Writer.Write("if (pLength > ");
1664Writer.Write(i.ToString(CultureInfo.InvariantCulture));
1665Writer.WriteLine(") {");
1666Writer.Indent++;
1669Writer.Write("if (pLength <= ");
1670Writer.Write(specifiedPosition.ToString(CultureInfo.InvariantCulture));
1671Writer.Write(" || ");
1672Writer.Write(specifiedSource);
1673Writer.WriteLine(") {");
1674Writer.Indent++;
1680Writer.Indent--;
1681Writer.WriteLine("}");
1684Writer.Indent--;
1685Writer.WriteLine("}");
1711Writer.Write("if (pLength > ");
1712Writer.Write(i.ToString(CultureInfo.InvariantCulture));
1713Writer.WriteLine(") {");
1714Writer.Indent++;
1717Writer.Write("if (pLength <= ");
1718Writer.Write(specifiedPosition.ToString(CultureInfo.InvariantCulture));
1719Writer.Write(" || ");
1720Writer.Write(specifiedSource);
1721Writer.WriteLine(") {");
1722Writer.Indent++;
1746Writer.Write("WriteRpcResult(");
1748Writer.Write(", ");
1750Writer.WriteLine(");");
1757Writer.Indent--;
1758Writer.WriteLine("}");
1761Writer.Indent--;
1762Writer.WriteLine("}");
1771Writer.Write("if (pLength > ");
1772Writer.Write(mapping.Members.Length.ToString(CultureInfo.InvariantCulture));
1773Writer.WriteLine(") {");
1774Writer.Indent++;
1778Writer.Indent--;
1779Writer.WriteLine("}");
1781Writer.WriteLine("WriteReferencedElements();");
1783Writer.Indent--;
1784Writer.WriteLine("}");
1792Writer.WriteLine();
1793Writer.Write("public void ");
1794Writer.Write(methodName);
1795Writer.WriteLine("(object o) {");
1796Writer.Indent++;
1798Writer.WriteLine("WriteStartDocument();");
1800Writer.WriteLine("if (o == null) {");
1801Writer.Indent++;
1810Writer.WriteLine("return;");
1811Writer.Indent--;
1812Writer.WriteLine("}");
1815Writer.WriteLine("TopLevelElement();");
1821Writer.WriteLine("WriteReferencedElements();");
1823Writer.Indent--;
1824Writer.WriteLine("}");
1834Writer.WriteLine();
1837Writer.Write("void ");
1838Writer.Write(methodName);
1839Writer.WriteLine("(object e) {");
1843Writer.Write("string ");
1844Writer.Write(methodName);
1845Writer.Write("(");
1846Writer.Write(mapping.TypeDesc.UseReflection? "object" : fullTypeName );
1847Writer.WriteLine(" v) {");
1849Writer.Indent++;
1850Writer.WriteLine("string s = null;");
1856Writer.WriteLine("switch ("+RaCodeGen.GetStringForEnumLongValue("v", mapping.TypeDesc.UseReflection)+" ){");
1858Writer.WriteLine("switch (v) {");
1859Writer.Indent++;
1864Writer.Write("s = ");
1866Writer.WriteLine("; break;");
1873Writer.Write("default: s = FromEnum(");
1874Writer.Write(RaCodeGen.GetStringForEnumLongValue("v", mapping.TypeDesc.UseReflection));
1875Writer.Write(", new string[] {");
1876Writer.Indent++;
1880Writer.WriteLine(", ");
1883Writer.Write("}, new ");
1884Writer.Write(typeof(long).FullName);
1885Writer.Write("[] {");
1890Writer.WriteLine(", ");
1891Writer.Write("(long)");
1893Writer.Write(c.Value.ToString(CultureInfo.InvariantCulture));
1895Writer.Write(fullTypeName);
1896Writer.Write(".@");
1898Writer.Write(c.Name);
1901Writer.Indent--;
1902Writer.Write("}, ");
1904Writer.WriteLine("); break;");
1907Writer.Write("default: throw CreateInvalidEnumValueException(");
1908Writer.Write(RaCodeGen.GetStringForEnumLongValue("v", mapping.TypeDesc.UseReflection));
1909Writer.Write(".ToString(System.Globalization.CultureInfo.InvariantCulture), ");
1911Writer.WriteLine(");");
1913Writer.Indent--;
1914Writer.WriteLine("}");
1917Writer.Write("WriteXsiType(");
1919Writer.Write(", ");
1921Writer.WriteLine(");");
1922Writer.WriteLine("Writer.WriteString(s);");
1925Writer.WriteLine("return s;");
1927Writer.Indent--;
1928Writer.WriteLine("}");
1934Writer.Write("else if (");
1936Writer.WriteLine(") {");
1937Writer.Indent++;
1946Writer.Write(methodName);
1947Writer.Write("(n, ns,");
1948if(!derived.TypeDesc.UseReflection) Writer.Write("("+fullTypeName+")");
1949Writer.Write("o");
1951Writer.Write(", isNullable");
1952Writer.Write(", true");
1953Writer.WriteLine(");");
1954Writer.WriteLine("return;");
1955Writer.Indent--;
1956Writer.WriteLine("}");
1968Writer.Write("else if (");
1970Writer.WriteLine(") {");
1971Writer.Indent++;
1979Writer.WriteLine("Writer.WriteStartElement(n, ns);");
1980Writer.Write("WriteXsiType(");
1982Writer.Write(", ");
1984Writer.WriteLine(");");
1985Writer.Write("Writer.WriteString(");
1986Writer.Write(methodName);
1987Writer.Write("(");
1988if (!mapping.TypeDesc.UseReflection) Writer.Write("("+fullTypeName+")");
1989Writer.WriteLine("o));");
1990Writer.WriteLine("Writer.WriteEndElement();");
1991Writer.WriteLine("return;");
1992Writer.Indent--;
1993Writer.WriteLine("}");
1999Writer.Write("else if (");
2004Writer.WriteLine(") {");
2005Writer.Indent++;
2007Writer.WriteLine("Writer.WriteStartElement(n, ns);");
2008Writer.Write("WriteXsiType(");
2010Writer.Write(", ");
2012Writer.WriteLine(");");
2016Writer.WriteLine("Writer.WriteEndElement();");
2017Writer.WriteLine("return;");
2018Writer.Indent--;
2019Writer.WriteLine("}");
2029Writer.WriteLine();
2030Writer.Write("void ");
2031Writer.Write(methodName);
2036Writer.WriteLine("(object s) {");
2037Writer.Indent++;
2041Writer.Write("(string n, string ns, ");
2042Writer.Write(mapping.TypeDesc.UseReflection ? "object" : fullTypeName);
2043Writer.Write(" o");
2045Writer.Write(", bool isNullable");
2046Writer.WriteLine(", bool needType) {");
2047Writer.Indent++;
2049Writer.WriteLine("if ((object)o == null) {");
2050Writer.Indent++;
2051Writer.WriteLine("if (isNullable) WriteNullTagLiteral(n, ns);");
2052Writer.WriteLine("return;");
2053Writer.Indent--;
2054Writer.WriteLine("}");
2056Writer.WriteLine("if (!needType) {");
2057Writer.Indent++;
2059Writer.Write(typeof(Type).FullName);
2060Writer.WriteLine(" t = o.GetType();");
2061Writer.Write("if (");
2063Writer.WriteLine(") {");
2064Writer.WriteLine("}");
2068Writer.WriteLine("else {");
2070Writer.Indent++;
2072Writer.WriteLine("WriteTypedPrimitive(n, ns, o, true);");
2073Writer.WriteLine("return;");
2076Writer.WriteLine("throw CreateUnknownTypeException(o);");
2078Writer.Indent--;
2079Writer.WriteLine("}");
2080Writer.Indent--;
2081Writer.WriteLine("}");
2086Writer.WriteLine("EscapeName = false;");
2102Writer.Write("WriteStartElement(n, ns, o, false, ");
2104Writer.Write("null");
2106Writer.Write(xmlnsSource);
2108Writer.WriteLine(");");
2110Writer.Write("if (needType) WriteXsiType(");
2112Writer.Write(", ");
2114Writer.WriteLine(");");
2125Writer.Write("if (");
2128Writer.Write(methodInvoke);
2129Writer.WriteLine(") {");
2130Writer.Indent++;
2133Writer.Write("if (");
2136Writer.Write(memberGet);
2137Writer.WriteLine(") {");
2138Writer.Indent++;
2143Writer.Indent--;
2144Writer.WriteLine("}");
2147Writer.Indent--;
2148Writer.WriteLine("}");
2161Writer.Write("if (");
2164Writer.Write(methodInvoke);
2165Writer.WriteLine(") {");
2166Writer.Indent++;
2169Writer.Write("if (");
2172Writer.Write(memberGet);
2173Writer.WriteLine(") {");
2174Writer.Indent++;
2185Writer.Indent--;
2186Writer.WriteLine("}");
2189Writer.Indent--;
2190Writer.WriteLine("}");
2197Writer.Indent--;
2198Writer.WriteLine("}");
2213Writer.WriteLine("{");
2214Writer.Indent++;
2218Writer.WriteLine("if (a != null) {");
2219Writer.Indent++;
2223Writer.Write("Writer.WriteStartAttribute(null, ");
2225Writer.Write(", ");
2231Writer.Write("null");
2233Writer.WriteLine(");");
2236Writer.Write(typeof(StringBuilder).FullName);
2237Writer.Write(" sb = new ");
2238Writer.Write(typeof(StringBuilder).FullName);
2239Writer.WriteLine("();");
2245Writer.Write(" e = ");
2246Writer.Write(typeof(IEnumerator).FullName);
2248Writer.Write("((");
2249Writer.Write(typeof(IEnumerable).FullName);
2250Writer.WriteLine(").GetEnumerator();");
2255Writer.Write("(");
2256Writer.Write(typeof(IEnumerator).FullName);
2257Writer.Write(")");
2258Writer.Write(RaCodeGen.GetReflectionVariable(memberTypeDesc.CSharpName, "System.Collections.Generic.IEnumerable*"));
2259Writer.WriteLine(".Invoke(a, new object[0]);");
2262Writer.Write("((System.Collections.Generic.IEnumerable<");
2263Writer.Write(arrayElementTypeDesc.CSharpName);
2264Writer.WriteLine(">)a).GetEnumerator();");
2269Writer.Write("(");
2270Writer.Write(typeof(IEnumerator).FullName);
2271Writer.Write(")");
2273Writer.Write(RaCodeGen.GetStringForMethodInvoke("a", memberTypeDesc.CSharpName, "GetEnumerator", memberTypeDesc.UseReflection));
2274Writer.WriteLine(";");
2276Writer.WriteLine("if (e != null)");
2277Writer.WriteLine("while (e.MoveNext()) {");
2278Writer.Indent++;
2284Writer.Write("for (int i = 0; i < ");
2286Writer.WriteLine("a.Length; i++) {");
2289Writer.Write("((");
2290Writer.Write(typeof(ICollection).FullName);
2291Writer.WriteLine(")a).Count; i++) {");
2293Writer.Indent++;
2300Writer.WriteLine("if (i != 0) Writer.WriteString(\" \");");
2301Writer.Write("WriteValue(");
2304Writer.WriteLine("if (i != 0) sb.Append(\" \");");
2305Writer.Write("sb.Append(");
2311Writer.WriteLine(");");
2316Writer.Indent--;
2317Writer.WriteLine("}");
2321Writer.WriteLine("Writer.WriteEndAttribute();");
2324Writer.WriteLine("if (sb.Length != 0) {");
2325Writer.Indent++;
2327Writer.Write("WriteAttribute(");
2329Writer.Write(", ");
2333Writer.Write(", ");
2335Writer.WriteLine("sb.ToString());");
2336Writer.Indent--;
2337Writer.WriteLine("}");
2342Writer.Indent--;
2343Writer.WriteLine("}");
2345Writer.Indent--;
2346Writer.WriteLine("}");
2357Writer.Write("WriteXmlAttribute(");
2358Writer.Write(source);
2359Writer.Write(", ");
2360Writer.Write(parent);
2361Writer.WriteLine(");");
2384Writer.WriteLine("{");
2385Writer.Indent++;
2389Writer.WriteLine("if (a != null) {");
2390Writer.Indent++;
2398Writer.WriteLine("if (c == null || c.Length < a.Length) {");
2399Writer.Indent++;
2400Writer.Write("throw CreateInvalidChoiceIdentifierValueException(");
2402Writer.Write(", ");
2404Writer.Write(");");
2405Writer.Indent--;
2406Writer.WriteLine("}");
2411Writer.Indent--;
2412Writer.WriteLine("}");
2414Writer.Indent--;
2415Writer.WriteLine("}");
2422Writer.Write(typeof(IEnumerator).FullName);
2423Writer.Write(" e = ");
2425Writer.Write("((");
2426Writer.Write(typeof(IEnumerable).FullName);
2427Writer.Write(")");
2428Writer.Write(arrayName);
2429Writer.WriteLine(").GetEnumerator();");
2434Writer.Write("(");
2435Writer.Write(typeof(IEnumerator).FullName);
2436Writer.Write(")");
2437Writer.Write(RaCodeGen.GetReflectionVariable(arrayTypeDesc.CSharpName, "System.Collections.Generic.IEnumerable*"));
2438Writer.Write(".Invoke(");
2439Writer.Write(arrayName);
2440Writer.WriteLine(", new object[0]);");
2443Writer.Write("((System.Collections.Generic.IEnumerable<");
2444Writer.Write(arrayElementTypeDesc.CSharpName);
2445Writer.Write(">)");
2446Writer.Write(arrayName);
2447Writer.WriteLine(").GetEnumerator();");
2452Writer.Write("(");
2453Writer.Write(typeof(IEnumerator).FullName);
2454Writer.Write(")");
2456Writer.Write(RaCodeGen.GetStringForMethodInvoke(arrayName, arrayTypeDesc.CSharpName, "GetEnumerator", arrayTypeDesc.UseReflection));
2457Writer.WriteLine(";");
2459Writer.WriteLine("if (e != null)");
2460Writer.WriteLine("while (e.MoveNext()) {");
2461Writer.Indent++;
2467Writer.Write("for (int i");
2468Writer.Write(arrayName);
2469Writer.Write(" = 0; i");
2470Writer.Write(arrayName);
2471Writer.Write(" < ");
2473Writer.Write(arrayName);
2474Writer.Write(".Length");
2477Writer.Write("((");
2478Writer.Write(typeof(ICollection).FullName);
2479Writer.Write(")");
2480Writer.Write(arrayName);
2481Writer.Write(").Count");
2483Writer.Write("; i");
2484Writer.Write(arrayName);
2485Writer.WriteLine("++) {");
2486Writer.Indent++;
2501Writer.Indent--;
2502Writer.WriteLine("}");
2519Writer.Write("if ((object)(");
2520Writer.Write(source);
2521Writer.Write(") != null)");
2523Writer.WriteLine("{");
2524Writer.Indent++;
2547if (wroteFirstIf) Writer.Write("else ");
2549Writer.Write("if (");
2550Writer.Write(enumUseReflection?RaCodeGen.GetStringForEnumLongValue(enumSource, enumUseReflection):enumSource);
2551Writer.Write(" == ");
2552Writer.Write(enumFullName);
2554Writer.Write(" && ((object)(");
2555Writer.Write(source);
2556Writer.Write(") != null)");
2558Writer.WriteLine(") {");
2559Writer.Indent++;
2567Writer.Indent--;
2568Writer.WriteLine("}");
2574if (wroteFirstIf) Writer.Write("else ");
2576Writer.Write("if (");
2578Writer.WriteLine(") {");
2579Writer.Indent++;
2584Writer.Indent--;
2585Writer.WriteLine("}");
2589if (elements.Length - anyCount > 0) Writer.Write("else ");
2593Writer.Write("if (");
2594Writer.Write(source);
2595Writer.Write(" is ");
2596Writer.Write(fullTypeName);
2597Writer.WriteLine(") {");
2598Writer.Indent++;
2600Writer.Write(fullTypeName);
2601Writer.Write(" elem = (");
2602Writer.Write(fullTypeName);
2603Writer.Write(")");
2604Writer.Write(source);
2605Writer.WriteLine(";");
2610if (c++ > 0) Writer.Write("else ");
2618Writer.Write("if (");
2619Writer.Write(enumUseReflection?RaCodeGen.GetStringForEnumLongValue(enumSource, enumUseReflection):enumSource);
2620Writer.Write(" == ");
2621Writer.Write(enumFullName);
2623Writer.Write(" && ((object)(");
2624Writer.Write(source);
2625Writer.Write(") != null)");
2627Writer.WriteLine(") {");
2628Writer.Indent++;
2630Writer.Write("if (elem.Name == ");
2632Writer.Write(" && elem.NamespaceURI == ");
2634Writer.WriteLine(") {");
2635Writer.Indent++;
2639Writer.Indent--;
2640Writer.WriteLine("}");
2641Writer.WriteLine("else {");
2642Writer.Indent++;
2644Writer.WriteLine("// throw Value '{0}' of the choice identifier '{1}' does not match element '{2}' from namespace '{3}'.");
2646Writer.Write("throw CreateChoiceIdentifierValueException(");
2648Writer.Write(", ");
2650Writer.WriteLine(", elem.Name, elem.NamespaceURI);");
2651Writer.Indent--;
2652Writer.WriteLine("}");
2654Writer.Indent--;
2655Writer.WriteLine("}");
2658Writer.WriteLine("else {");
2659Writer.Indent++;
2665Writer.WriteLine("throw CreateUnknownAnyElementException(elem.Name, elem.NamespaceURI);");
2668Writer.Indent--;
2669Writer.WriteLine("}");
2671Writer.Indent--;
2672Writer.WriteLine("}");
2678Writer.Write("else ");
2679Writer.Write("if (");
2681Writer.WriteLine(") {");
2682Writer.Indent++;
2687Writer.Indent--;
2688Writer.WriteLine("}");
2698Writer.Write("else ");
2701Writer.Write(" if ((object)(");
2702Writer.Write(source);
2703Writer.Write(") != null)");
2706Writer.WriteLine("{");
2707Writer.Indent++;
2709Writer.Write("throw CreateUnknownTypeException(");
2710Writer.Write(source);
2711Writer.WriteLine(");");
2713Writer.Indent--;
2714Writer.WriteLine("}");
2716Writer.Indent--;
2717Writer.WriteLine("}");
2724Writer.Write("WriteValue(");
2731Writer.WriteLine(");");
2737Writer.Write(source);
2738Writer.WriteLine(".WriteTo(Writer);");
2750Writer.Write("if (");
2751Writer.Write(source);
2752Writer.WriteLine(" != null) {");
2753Writer.Indent++;
2761Writer.Indent--;
2762Writer.WriteLine("}");
2764Writer.WriteLine("else {");
2765Writer.Indent++;
2767Writer.Indent--;
2768Writer.WriteLine("}");
2774Writer.Write("WritePotentiallyReferencingElement(");
2776Writer.Write(", ");
2778Writer.Write(", ");
2779Writer.Write(source);
2781Writer.Write(", ");
2782Writer.Write(RaCodeGen.GetStringForTypeof(mapping.TypeDesc.CSharpName, mapping.TypeDesc.UseReflection));
2783Writer.Write(", true, ");
2786Writer.Write(", null, false, ");
2789Writer.WriteLine(");");
2796Writer.WriteLine("{");
2797Writer.Indent++;
2804Writer.Write("if (");
2805Writer.Write(elementArrayName);
2806Writer.Write(" != null)");
2808Writer.WriteLine("{");
2809Writer.Indent++;
2812Writer.Write("for (int ");
2813Writer.Write(arrayIndex);
2814Writer.Write(" = 0; ");
2815Writer.Write(arrayIndex);
2816Writer.Write(" < ");
2819Writer.Write(elementArrayName);
2820Writer.Write(".Length");
2823Writer.Write("((");
2824Writer.Write(typeof(ICollection).FullName);
2825Writer.Write(")");
2826Writer.Write(elementArrayName);
2827Writer.Write(").Count");
2829Writer.Write("; ");
2830Writer.Write(arrayIndex);
2831Writer.WriteLine("++) {");
2832Writer.Indent++;
2838Writer.Indent--;
2839Writer.WriteLine("}");
2841Writer.Indent--;
2842Writer.WriteLine("}");
2843Writer.Indent--;
2844Writer.WriteLine("}");
2848Writer.WriteLine("{");
2849Writer.Indent++;
2856Writer.Write("if (");
2857Writer.Write(arrayName);
2858Writer.Write(" != null)");
2860Writer.WriteLine("{");
2861Writer.Indent++;
2866Writer.Indent--;
2867Writer.WriteLine("}");
2868Writer.Indent--;
2869Writer.WriteLine("}");
2875Writer.Write("Writer.WriteStartElement(");
2877Writer.Write(", ");
2879Writer.WriteLine(");");
2880Writer.Write(methodName);
2881Writer.Write("(");
2882Writer.Write(source);
2883Writer.WriteLine(");");
2905Writer.Write("WritePotentiallyReferencingElement(");
2907Writer.Write(", ");
2909Writer.Write(", ");
2910Writer.Write(source);
2912Writer.Write(", ");
2913Writer.Write(RaCodeGen.GetStringForTypeof(mapping.TypeDesc.CSharpName, mapping.TypeDesc.UseReflection));
2914Writer.Write(", true, ");
2917Writer.Write(", null, false, ");
2928Writer.Write(methodName);
2929Writer.Write("(");
2931Writer.Write(", ");
2933Writer.Write("null");
2937Writer.Write(", ");
2938Writer.Write(source);
2940Writer.Write(", ");
2943Writer.Write(", false");
2945Writer.WriteLine(");");
2959Writer.Write("if ((");
2960Writer.Write(source);
2961Writer.Write(") is ");
2962Writer.Write(typeof(XmlNode).FullName);
2963Writer.Write(" || ");
2964Writer.Write(source);
2965Writer.Write(" == null");
2966Writer.WriteLine(") {");
2967Writer.Indent++;
2971Writer.Indent--;
2972Writer.WriteLine("}");
2973Writer.WriteLine("else {");
2974Writer.Indent++;
2976Writer.Write("throw CreateInvalidAnyTypeException(");
2977Writer.Write(source);
2978Writer.WriteLine(");");
2980Writer.Indent--;
2981Writer.WriteLine("}");
2990Writer.Write(func);
2991Writer.Write("((");
2992Writer.Write(cast.FullName);
2993Writer.Write(")");
2994Writer.Write(source);
2995Writer.Write(", ");
2997Writer.Write(", ");
2999Writer.Write(", ");
3001Writer.Write(", ");
3003Writer.WriteLine(");");
3007Writer.Write("if (");
3011Writer.Write("(");
3012Writer.Write(source);
3014Writer.Write(" == null) || (");
3016Writer.Write(" != null) && (");
3017Writer.Write(source);
3018Writer.Write(".Length != 0)");
3021Writer.Write(source);
3022Writer.Write(" != ");
3025Writer.Write(")");
3030Writer.Write("if (((object)");
3031Writer.Write(source);
3032Writer.Write(") != null && !(");
3034Writer.Write(")) throw CreateMismatchChoiceException(");
3036Writer.Write(", ");
3038Writer.Write(", ");
3040Writer.WriteLine(");");
3044Writer.Write("if ((object)(");
3045Writer.Write(source);
3046Writer.WriteLine(") == null) {");
3047Writer.Indent++;
3049Writer.Indent--;
3050Writer.WriteLine("}");
3051Writer.WriteLine("else {");
3052Writer.Indent++;
3057Writer.Write("null");
3071Writer.Write('\'');
3074Writer.Write("\'");
3076Writer.Write(ch);
3077Writer.Write('\'');
3081Writer.Write(((Int32)value).ToString(null, NumberFormatInfo.InvariantInfo));
3084Writer.Write(((Double)value).ToString("R", NumberFormatInfo.InvariantInfo));
3087Writer.Write((bool)value ? "true" : "false");
3096Writer.Write("(");
3097Writer.Write(type.FullName);
3098Writer.Write(")");
3099Writer.Write("(");
3100Writer.Write(Convert.ToString(value, NumberFormatInfo.InvariantInfo));
3101Writer.Write(")");
3104Writer.Write(((Single)value).ToString("R", NumberFormatInfo.InvariantInfo));
3105Writer.Write("f");
3108Writer.Write(((Decimal)value).ToString(null, NumberFormatInfo.InvariantInfo));
3109Writer.Write("m");
3112Writer.Write(" new ");
3113Writer.Write(type.FullName);
3114Writer.Write("(");
3115Writer.Write(((DateTime)value).Ticks.ToString(CultureInfo.InvariantCulture));
3116Writer.Write(")");
3120Writer.Write(((int)value).ToString(null, NumberFormatInfo.InvariantInfo));
3123Writer.Write(" new ");
3124Writer.Write(type.FullName);
3125Writer.Write("(");
3126Writer.Write(((TimeSpan)value).Ticks.ToString(CultureInfo.InvariantCulture));
3127Writer.Write(")");
3138Writer.Write("WriteNamespaceDeclarations(");
3139Writer.Write(source);
3140Writer.WriteLine(");");
3153Writer.Write("for (int i = ");
3154Writer.Write(loopStartSource);
3155Writer.Write("; i < ");
3156Writer.Write(loopEndSource);
3157Writer.WriteLine("; i++) {");
3158Writer.Indent++;
3159Writer.WriteLine("if (p[i] != null) {");
3160Writer.Indent++;
3161Writer.WriteLine("WritePotentiallyReferencingElement(null, null, p[i], p[i].GetType(), true, false);");
3162Writer.Indent--;
3163Writer.WriteLine("}");
3164Writer.Indent--;
3165Writer.WriteLine("}");