You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.4 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace IPA
  7. {
  8. internal enum EdgeLifecycleType
  9. {
  10. Enable, Disable
  11. }
  12. internal interface IEdgeLifecycleAttribute
  13. {
  14. EdgeLifecycleType Type { get; }
  15. }
  16. // TODO: is there a better way to manage this mess?
  17. [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
  18. public sealed class OnEnableAttribute : Attribute, IEdgeLifecycleAttribute
  19. {
  20. EdgeLifecycleType IEdgeLifecycleAttribute.Type => EdgeLifecycleType.Enable;
  21. }
  22. [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
  23. public sealed class OnStartAttribute : Attribute, IEdgeLifecycleAttribute
  24. {
  25. EdgeLifecycleType IEdgeLifecycleAttribute.Type => EdgeLifecycleType.Enable;
  26. }
  27. [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
  28. public sealed class OnDisableAttribute : Attribute, IEdgeLifecycleAttribute
  29. {
  30. EdgeLifecycleType IEdgeLifecycleAttribute.Type => EdgeLifecycleType.Disable;
  31. }
  32. [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
  33. public sealed class OnExitAttribute : Attribute, IEdgeLifecycleAttribute
  34. {
  35. EdgeLifecycleType IEdgeLifecycleAttribute.Type => EdgeLifecycleType.Disable;
  36. }
  37. }