private static void CheckAttribute(object sender, CheckAttributeEventArgs e)
{
if (e.Attribute is DescriptionAttribute
&& !(e.Attribute is JanusDescriptionAttribute)
|| e.Attribute is CategoryAttribute
&& !(e.Attribute is JanusCategoryAttribute)
|| e.Attribute is DisplayNameAttribute
&& !(e.Attribute is JanusDisplayNameAttribute))
{
e.Checked = false;
#if DEBUG
string insteadAttr = e.Attribute.GetType().Name;
if (insteadAttr.StartsWith("Loc"))
insteadAttr = insteadAttr.Substring(3);
//VladD2: Мля, нет слов! Что поиздеватьс над людми захотелось?
// Диалог выдается со скоростью пулемета. Если ошибка критична,
// то кидайте исключение, а не диалоги.
Console.WriteLine(string.Format(
"Attribute '{0}' is not allowed on '{1}.{2}'. Use Janus{3} instead.",
e.Attribute.GetType().FullName,
e.PropertyDescriptor.ComponentType.FullName,
e.PropertyDescriptor.Name, insteadAttr));
#endif
}
}
}