Attributes.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace TodoList
  5. {
  6. [System.AttributeUsage(System.AttributeTargets.Field, Inherited = false, AllowMultiple = true)]
  7. sealed class DefaultSwitchAttribute : System.Attribute
  8. {
  9. public int Order = 0;
  10. public DefaultSwitchAttribute(int Order = 0)
  11. {
  12. this.Order = Order;
  13. }
  14. }
  15. [System.AttributeUsage(System.AttributeTargets.Field, Inherited = false, AllowMultiple = true)]
  16. sealed class UnknownSwitchAttribute : System.Attribute
  17. {
  18. }
  19. [System.AttributeUsage(System.AttributeTargets.Field, Inherited = false, AllowMultiple = true)]
  20. sealed class GreedyArgumentAttribute : System.Attribute
  21. {
  22. }
  23. [System.AttributeUsage(AttributeTargets.Field, Inherited = false, AllowMultiple = false)]
  24. sealed class SwitchDocumentationAttribute: System.Attribute
  25. {
  26. public String Documentation = "";
  27. public SwitchDocumentationAttribute(String Documentation)
  28. {
  29. this.Documentation = Documentation;
  30. }
  31. }
  32. [System.AttributeUsage(System.AttributeTargets.Class, Inherited = false, AllowMultiple = true)]
  33. sealed class CommandAttribute : System.Attribute
  34. {
  35. public string Name;
  36. public string ShortDescription = "";
  37. public string LongHelpText = "Long help not specified for this command.";
  38. public string ErrorText = "";
  39. public List<String> Synonyms = new List<string>();
  40. public CommandAttribute(String Name, String ShortDescription = "", String LongHelpText = "Long help not specified for this command.", String ErrorText = "", String Synonyms = "")
  41. {
  42. this.Name = Name;
  43. this.ShortDescription = ShortDescription;
  44. this.LongHelpText = LongHelpText;
  45. this.ErrorText = ErrorText;
  46. this.Synonyms.AddRange(Synonyms.Split(' '));
  47. }
  48. }
  49. }