MCPcopy Create free account
hub / github.com/9chu/LuaSTGPlus / ConvertTo

Method ConvertTo

TexturedFontEditor/Helper.cs:208–229  ·  view source on GitHub ↗
(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)

Source from the content-addressed store, hash-verified

206 return new PointF(numArray[0], numArray[1]);
207 }
208 public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
209 {
210 if (culture == null)
211 culture = CultureInfo.CurrentCulture;
212 if (destinationType == null)
213 throw new ArgumentNullException("destinationType");
214
215 if ((destinationType == typeof(string)) && (value is PointF))
216 {
217 PointF pointf = (PointF)value;
218
219 string separator = culture.TextInfo.ListSeparator + " ";
220 TypeConverter converter = TypeDescriptor.GetConverter(typeof(float));
221 string[] textArray = new string[2];
222 int num = 0;
223 textArray[num++] = converter.ConvertToString(context, culture, pointf.X);
224 textArray[num++] = converter.ConvertToString(context, culture, pointf.Y);
225 return string.Join(separator, textArray);
226 }
227
228 return base.ConvertTo(context, culture, value, destinationType);
229 }
230 public override object CreateInstance(ITypeDescriptorContext context, IDictionary propertyValues)
231 {
232 return new PointF((float)propertyValues["X"], (float)propertyValues["Y"]);

Callers

nothing calls this directly

Calls 1

ConvertToMethod · 0.45

Tested by

no test coverage detected