Exemplo n.º 1
0
        private IEnumerable <IInlineCommand> LoadAllInlineCommandsFromAssembly(Assembly assembly)
        {
            IDictionary <string, IList <IInlineCommand> > icommands = new Dictionary <string, IList <IInlineCommand> >();

            foreach (Type t in GetAllTypesThatImplement(assembly, typeof(IInlineCommand)))
            {
                IInlineCommand icommand = (IInlineCommand)kernel.Get(t);
                string         ns       = icommand.GetNameSpace();
                if (String.IsNullOrWhiteSpace(ns))
                {
                    throw new ApplicationException("Could not load inline command from type[" + t.FullName + "].  No namespace specified.");
                }
                if (ns.IndexOf('.') > 0)
                {
                    throw new ApplicationException("Nested namespaces (namespaces with '.' in them) are not supported.");
                }
                if (!icommands.ContainsKey(ns))
                {
                    icommands.Add(ns, new List <IInlineCommand>());
                }
                if (icommand.GetType().Assembly.FullName.IndexOf("js.net.test.module") < 0)
                {
                    helpManager.AddHelpForInlineCommand(icommand);
                }
                icommands[ns].Add(icommand);
            }
            return(icommands.Values.SelectMany(c => c));
        }
Exemplo n.º 2
0
        private string GetCommandName(ICommandBase command)
        {
            Trace.Assert(command != null);

            if (command is IConsoleCommand)
            {
                return('.' + command.GetName());
            }

            IInlineCommand icommand = (IInlineCommand)command;

            return(icommand.GetNameSpace() + '.' + icommand.GetName());
        }
Exemplo n.º 3
0
        public void AddHelpForInlineCommand(IInlineCommand command)
        {
            Trace.Assert(command != null);

              AddHelpImpl(inlineCommandHelps, command);
        }
Exemplo n.º 4
0
        public void AddHelpForInlineCommand(IInlineCommand command)
        {
            Trace.Assert(command != null);

            AddHelpImpl(inlineCommandHelps, command);
        }