public static void RenderProperty(PropertyDef property, Graphics g, Rectangle bounds) { Image icon, visibility; icon = Resources.GetResource <Image>("Icons.ObjModel.property.png"); if (property.SetMethod == null) { icon = Resources.GetResource <Image>("Icons.ObjModel.readonly.png"); } else if (property.GetMethod == null) { icon = Resources.GetResource <Image>("Icons.ObjModel.writeonly.png"); } switch (property.GetVisibility()) { case MethodAttributes.CompilerControlled: case MethodAttributes.Private: visibility = Resources.GetResource <Image>("Icons.ObjModel.private.png"); break; case MethodAttributes.FamANDAssem: case MethodAttributes.Assembly: visibility = Resources.GetResource <Image>("Icons.ObjModel.internal.png"); break; case MethodAttributes.Family: visibility = Resources.GetResource <Image>("Icons.ObjModel.protected.png"); break; case MethodAttributes.FamORAssem: visibility = Resources.GetResource <Image>("Icons.ObjModel.famasm.png"); break; case MethodAttributes.Public: default: visibility = null; break; } g.DrawImageUnscaledAndClipped(icon, bounds); if (visibility != null) { g.DrawImageUnscaledAndClipped(visibility, bounds); } if (property.GetAccessors().Any(m => m.IsStatic)) { g.DrawImageUnscaledAndClipped(Resources.GetResource <Image>("Icons.ObjModel.static.png"), bounds); } }
public static MethodAttributes GetVisibility(this PropertyDef property) { var ret = MethodAttributes.CompilerControlled; foreach (var other in property.GetAccessors()) { if (other.Access > ret) { ret = other.Access; } } return(ret); }