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

Method ConvertTo

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

Source from the content-addressed store, hash-verified

284 return new RectangleF(numArray[0], numArray[1], numArray[2], numArray[3]);
285 }
286 public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
287 {
288 if (culture == null)
289 culture = CultureInfo.CurrentCulture;
290 if (destinationType == null)
291 throw new ArgumentNullException("destinationType");
292
293 if ((destinationType == typeof(string)) && (value is RectangleF))
294 {
295 RectangleF pointf = (RectangleF)value;
296
297 string separator = culture.TextInfo.ListSeparator + " ";
298 TypeConverter converter = TypeDescriptor.GetConverter(typeof(float));
299 string[] textArray = new string[4];
300 int num = 0;
301 textArray[num++] = converter.ConvertToString(context, culture, pointf.X);
302 textArray[num++] = converter.ConvertToString(context, culture, pointf.Y);
303 textArray[num++] = converter.ConvertToString(context, culture, pointf.Width);
304 textArray[num++] = converter.ConvertToString(context, culture, pointf.Height);
305 return string.Join(separator, textArray);
306 }
307
308 return base.ConvertTo(context, culture, value, destinationType);
309 }
310 public override object CreateInstance(ITypeDescriptorContext context, IDictionary propertyValues)
311 {
312 return new RectangleF((float)propertyValues["X"], (float)propertyValues["Y"], (float)propertyValues["Width"], (float)propertyValues["Height"]);

Callers

nothing calls this directly

Calls 1

ConvertToMethod · 0.45

Tested by

no test coverage detected