ConfigAttribute.cs 508 B

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