2 using System.Reflection;
3 using System.Collections.Generic;
6 namespace TechBot.Library
8 public class CommandBuilder
10 private Type m_CommandType;
11 private string m_CommandName;
12 private string m_CommandHelp;
13 private string m_CommandDesc;
15 public CommandBuilder(Type commandType)
17 m_CommandType = commandType;
19 CommandAttribute commandAttribute = (CommandAttribute)
20 Attribute.GetCustomAttribute(commandType, typeof(CommandAttribute));
22 m_CommandName = commandAttribute.Name;
23 m_CommandHelp = commandAttribute.Help;
24 m_CommandDesc = commandAttribute.Description;
29 get { return m_CommandName; }
34 get { return m_CommandHelp; }
37 public string Description
39 get { return m_CommandDesc; }
44 get { return m_CommandType; }
47 public Command CreateCommand()
49 return (Command)Type.Assembly.CreateInstance(Type.FullName, true);