public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(string) && value.GetType() == typeof(byte)) { SSBB.Fighter fighter = SSBB.Fighter.Fighters.Where(s => s.ID == (byte)value).FirstOrDefault(); return("0x" + ((byte)value).ToString("X2") + (fighter == null ? "" : " - " + fighter.Name)); } return(base.ConvertTo(context, culture, value, destinationType)); }
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(string) && value.GetType() == typeof(uint)) { SSBB.Fighter fighter = FighterNameGenerators.fighterIDLongList .Where(s => s.ID == (uint)value).FirstOrDefault(); return("0x" + ((uint)value).ToString("X8") + (fighter == null ? "" : " - " + fighter.Name)); } if ((destinationType == typeof(int) || destinationType == typeof(uint)) && value != null && value.GetType() == typeof(string)) { return(0); } return(base.ConvertTo(context, culture, value, destinationType)); }