public static string GetWidgetName(TypeInfo widgetType)
{
if (widgetType == null)
{
throw new ArgumentNullException(nameof(widgetType));
}
var attr = widgetType.GetCustomAttribute<WidgetAttribute>();
if (attr != null && !string.IsNullOrEmpty(attr.Name))
{
var idx = attr.Name.LastIndexOf('.');
if (idx >= 0)
{
return attr.Name.Substring(idx + 1);
}
return attr.Name;
}
return GetShortNameByConvention(widgetType);
}