ConsoleMethodAttribute.cs 860 B

123456789101112131415161718192021222324252627282930
  1. using System;
  2. namespace IngameDebugConsole
  3. {
  4. [AttributeUsage( AttributeTargets.Method, Inherited = false, AllowMultiple = true )]
  5. public class ConsoleMethodAttribute : ConsoleAttribute
  6. {
  7. private string m_command;
  8. private string m_description;
  9. private string[] m_parameterNames;
  10. public string Command { get { return m_command; } }
  11. public string Description { get { return m_description; } }
  12. public string[] ParameterNames { get { return m_parameterNames; } }
  13. public override int Order { get { return 1; } }
  14. public ConsoleMethodAttribute( string command, string description, params string[] parameterNames )
  15. {
  16. m_command = command;
  17. m_description = description;
  18. m_parameterNames = parameterNames;
  19. }
  20. public override void Load()
  21. {
  22. DebugLogConsole.AddCommand(Command, Description, Method, null, ParameterNames);
  23. }
  24. }
  25. }