Mono.Debugger.Frontend.Engine.RegisterCommand C# (CSharp) Method

RegisterCommand() public method

public RegisterCommand ( string s, Type t ) : void
s string
t System.Type
return void
        public void RegisterCommand(string s, Type t)
        {
            if (!t.IsSubclassOf (typeof (Command)))
                throw new Exception ("Need a type derived from CL.Command");
            else if (t.IsAbstract)
                throw new Exception (
                    "Some clown tried to register an abstract class");

            IDocumentableCommand c = Activator.CreateInstance (t) as IDocumentableCommand;
            if (c != null) {
                ArrayList cmds;

                cmds = CommandsByFamily[(int)c.Family] as ArrayList;
                if (cmds == null)
                    CommandsByFamily[(int)c.Family] = cmds = new ArrayList();

                cmds.Add (s);
            }

            Commands [s] = t;
        }