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

Method ConvertTo

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

Source from the content-addressed store, hash-verified

364 return Color.FromArgb(numArray[0], numArray[1], numArray[2], numArray[3]);
365 }
366 public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
367 {
368 if (culture == null)
369 culture = CultureInfo.CurrentCulture;
370 if (destinationType == null)
371 throw new ArgumentNullException("destinationType");
372
373 if ((destinationType == typeof(string)) && (value is Color))
374 {
375 Color pointf = (Color)value;
376
377 string separator = culture.TextInfo.ListSeparator + " ";
378 TypeConverter converter = TypeDescriptor.GetConverter(typeof(int));
379 string[] textArray = new string[4];
380 int num = 0;
381 textArray[num++] = converter.ConvertToString(context, culture, pointf.A);
382 textArray[num++] = converter.ConvertToString(context, culture, pointf.R);
383 textArray[num++] = converter.ConvertToString(context, culture, pointf.G);
384 textArray[num++] = converter.ConvertToString(context, culture, pointf.B);
385 return string.Join(separator, textArray);
386 }
387
388 return base.ConvertTo(context, culture, value, destinationType);
389 }
390 public override object CreateInstance(ITypeDescriptorContext context, IDictionary propertyValues)
391 {
392 return Color.FromArgb((byte)propertyValues["A"], (byte)propertyValues["R"], (byte)propertyValues["G"], (byte)propertyValues["B"]);

Callers 2

ConvertToMethod · 0.45
ConvertToMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected