using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; namespace VDash.Overlay.Actions { public interface IOverlayAction { void PreformAction(IOverlay overlay); bool Enabled { get; set; } } [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] public class OverlayActionInfo : System.Attribute { public string Description { get; private set; } public Type EditorType { get; private set; } public OverlayActionInfo(string description, Type editorType) { Description = description; EditorType = editorType; } public OverlayActionInfo(string description) { Description = description; EditorType = null; } public static IEnumerable GetTypesWithAttribute() { var assembly = Assembly.GetExecutingAssembly(); foreach (Type type in assembly.GetTypes()) { if (type.GetCustomAttributes(typeof(OverlayActionInfo), true).Length > 0) { yield return type; } } } } }