2 writes to _w
dotnet-svcutil-lib (2)
FrameworkFork\Microsoft.Xml\Xml\schema\GenerateConverter.cs (2)
381
_w
= autoGenWriter.OpenIndented();
444
_w
= autoGenWriter.OpenIndented();
90 references to _w
dotnet-svcutil-lib (90)
FrameworkFork\Microsoft.Xml\Xml\schema\GenerateConverter.cs (90)
394
_w
.WriteLine("protected static readonly Type " + ClrTypeName(t) + "Type = typeof(" + ClrTypeToCSharpName(t) + ");");
396
_w
.WriteLine();
407
_w
.Write("return (" + ClrTypeToCSharpName(tDst) + ") ChangeType((object) value, ");
410
_w
.Write("destinationType");
412
_w
.Write(ClrTypeName(tDst) + "Type");
414
_w
.WriteLine(", " + (MethodHasResolver(tSrc, tDst) ? "nsResolver" : "null") + "); }");
419
_w
.WriteLine("public override string ToString(string value) {return this.ToString(value, null); }");
420
_w
.WriteLine("public override string ToString(object value) {return this.ToString(value, null); }");
425
_w
.WriteLine("public override object ChangeType(string value, Type destinationType) {return this.ChangeType(value, destinationType, null); }");
426
_w
.WriteLine("public override object ChangeType(object value, Type destinationType) {return this.ChangeType(value, destinationType, null); }");
429
_w
.WriteLine();
452
_w
.WriteLine();
453
_w
.WriteLine("//-----------------------------------------------");
454
_w
.WriteLine("// To" + ClrTypeName(tDst));
455
_w
.WriteLine("//-----------------------------------------------");
456
_w
.WriteLine();
486
_w
.WriteLine("Type sourceType = value.GetType();");
487
_w
.WriteLine();
493
_w
.WriteLine();
494
_w
.Write("return (" + ClrTypeToCSharpName(tDst) + ") ");
495
_w
.Write(group.FindUniqueSourceTypes(typeof(object)).Count > 0 ? "ChangeTypeWildcardDestination" : "ChangeListType");
496
_w
.WriteLine("(value, " + ClrTypeName(tDst) + "Type, " + (MethodHasResolver(typeof(object), tDst) ? "nsResolver);" : "null);"));
502
_w
.WriteLine("// This converter does not support conversions to " + ClrTypeName(tDst) + ".");
505
_w
.WriteLine();
508
_w
.WriteLine();
509
_w
.WriteLine("//-----------------------------------------------");
510
_w
.WriteLine("// ChangeType");
511
_w
.WriteLine("//-----------------------------------------------");
512
_w
.WriteLine();
527
_w
.WriteLine("if (destinationType == ObjectType) destinationType = DefaultClrType;");
533
_w
.WriteLine();
535
_w
.Write("return ChangeTypeWildcardSource(value, destinationType, ");
537
_w
.Write("return ChangeListType(value, destinationType, ");
539
_w
.WriteLine(MethodHasResolver(typeof(object), tSrc) ? "nsResolver);" : "null);");
543
_w
.WriteLine();
550
_w
.WriteLine("Type sourceType = value.GetType();");
551
_w
.WriteLine();
554
_w
.WriteLine("if (destinationType == ObjectType) destinationType = DefaultClrType;");
580
_w
.Write("if (destinationType == " + ClrTypeName(tDst) + "Type) ");
581
_w
.WriteLine("return this.To" + ClrTypeName(tDst) + "(value" + (MethodHasResolver(tDst, tDst) ? ", nsResolver);" : ");"));
585
_w
.WriteLine("if (destinationType == " + ClrTypeName(tDst) + "Type) {");
586
_w
.Indent++;
593
_w
.Indent--;
594
_w
.WriteLine("}");
607
_w
.WriteLine();
608
_w
.WriteLine("return ChangeListType(value, destinationType, nsResolver);");
617
_w
.WriteLine();
618
_w
.WriteLine();
619
_w
.WriteLine("//-----------------------------------------------");
620
_w
.WriteLine("// Helpers");
621
_w
.WriteLine("//-----------------------------------------------");
622
_w
.WriteLine();
627
_w
.WriteLine("private object ChangeTypeWildcardDestination(object value, Type destinationType, IXmlNamespaceResolver nsResolver) {");
628
_w
.Indent++;
630
_w
.WriteLine("Type sourceType = value.GetType();");
631
_w
.WriteLine();
636
_w
.WriteLine();
637
_w
.WriteLine("return ChangeListType(value, destinationType, nsResolver);");
639
_w
.Indent--;
640
_w
.WriteLine("}");
646
_w
.WriteLine("private object ChangeTypeWildcardSource(object value, Type destinationType, IXmlNamespaceResolver nsResolver) {");
647
_w
.Indent++;
652
_w
.WriteLine();
653
_w
.WriteLine("return ChangeListType(value, destinationType, nsResolver);");
655
_w
.Indent--;
656
_w
.WriteLine("}");
668
_w
.WriteLine();
669
_w
.Indent++;
673
_w
.WriteLine("if (value == null) throw new ArgumentNullException(\"value\");");
676
_w
.WriteLine();
681
_w
.WriteLine("if (destinationType == null) throw new ArgumentNullException(\"destinationType\");");
682
_w
.WriteLine();
705
_w
.Write("public override " + ClrTypeToCSharpName(typeDst) + " " + methName + "(" + methSig + ") {");
710
_w
.Indent--;
711
_w
.WriteLine("}");
746
_w
.WriteLine("switch (TypeCode) {");
755
_w
.Indent++;
756
_w
.WriteLine("case XmlTypeCode." + ruleSwitch.XmlType + ": return " + ruleSwitch.ConversionExpression + ";");
757
_w
.Indent--;
761
_w
.WriteLine("if (TypeCode == XmlTypeCode." + ruleSwitch.XmlType + ") return " + ruleSwitch.ConversionExpression + ";");
768
_w
.WriteLine("}");
773
_w
.WriteLine("return " + defaultRule.ConversionExpression + ";");
799
_w
.Write("if (destinationType == " + ClrTypeName(tDst) + "Type) ");
801
_w
.Write("if (" + GenerateSourceTypeMatch(tSrc) + ") ");
806
_w
.Write("return this.To" + ClrTypeName(tDst) + "((" + ClrTypeToCSharpName(tSrc) + ") value");
807
_w
.WriteLine(MethodHasResolver(tSrc, tDst) ? ", nsResolver);" : ");");
818
_w
.WriteLine("{");
819
_w
.Indent++;
823
_w
.Indent--;
824
_w
.WriteLine("}");