Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ConvertTo() [1/2]

override? object System.Drawing.PointConverter.ConvertTo ( ITypeDescriptorContext? context,
CultureInfo? culture,
object? value,
Type destinationType )
inlinevirtual

Reimplemented from System.ComponentModel.TypeConverter.

Definition at line 62 of file PointConverter.cs.

63 {
64 if (destinationType == null)
65 {
66 throw new ArgumentNullException("destinationType");
67 }
68 if (value is Point point)
69 {
70 if (destinationType == typeof(string))
71 {
72 if (culture == null)
73 {
75 }
76 string separator = culture.TextInfo.ListSeparator + " ";
77 TypeConverter converterTrimUnsafe = TypeDescriptor.GetConverterTrimUnsafe(typeof(int));
78 string[] value2 = new string[2]
79 {
80 converterTrimUnsafe.ConvertToString(context, culture, point.X),
81 converterTrimUnsafe.ConvertToString(context, culture, point.Y)
82 };
83 return string.Join(separator, value2);
84 }
85 if (destinationType == typeof(InstanceDescriptor))
86 {
87 ConstructorInfo constructor = typeof(Point).GetConstructor(new Type[2]
88 {
89 typeof(int),
90 typeof(int)
91 });
92 if (constructor != null)
93 {
94 return new InstanceDescriptor(constructor, new object[2] { point.X, point.Y });
95 }
96 }
97 }
98 return base.ConvertTo(context, culture, value, destinationType);
99 }
string? ConvertToString(object? value)
static TypeConverter GetConverterTrimUnsafe([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type)
static CultureInfo CurrentCulture

References System.ComponentModel.TypeConverter.ConvertToString(), System.culture, System.Globalization.CultureInfo.CurrentCulture, System.ComponentModel.TypeDescriptor.GetConverterTrimUnsafe(), and System.value.