AEventAttribute.cs 597 B

12345678910111213141516171819202122232425262728293031
  1. using System;
  2. namespace Model
  3. {
  4. [AttributeUsage(AttributeTargets.Class)]
  5. public abstract class AEventAttribute: Attribute
  6. {
  7. public int Type { get; private set; }
  8. private int ServerType { get; set; }
  9. protected AEventAttribute(int type, params ServerType[] serverTypes)
  10. {
  11. this.Type = type;
  12. foreach (ServerType serverType in serverTypes)
  13. {
  14. this.ServerType |= (int) serverType;
  15. }
  16. }
  17. public bool Contains(ServerType serverType)
  18. {
  19. if ((this.ServerType & (int) serverType) == 0)
  20. {
  21. return false;
  22. }
  23. return true;
  24. }
  25. }
  26. }