Exemplo n.º 1
0
        // --- Methods made available to both Meido and plugins ---

        public ILog CreateLogger(IMeidoHook plugin)
        {
            if (plugin == null)
            {
                throw new ArgumentNullException(nameof(plugin));
            }

            return(logFac.CreateLogger(plugin));
        }
Exemplo n.º 2
0
        public MeidoPlugin(IMeidoHook plugin)
        {
            Name = plugin.Name();

            var withTriggers = plugin as IPluginTriggers;
            var withHandlers = plugin as IPluginIrcHandlers;
            var withHelp     = plugin as IPluginHelp;

            Triggers = withTriggers != null?
                       withTriggers.Triggers.NoNull() : Enumerable.Empty <Trigger>();

            Handlers = withHandlers != null?
                       withHandlers.IrcHandlers.NoNull() : Enumerable.Empty <IIrcHandler>();

            Help = withHelp != null?
                   withHelp.Help.NoNull() : Enumerable.Empty <TopicHelp>();
        }
Exemplo n.º 3
0
        public static string Name(this IMeidoHook plugin)
        {
            string name = plugin.Name.Trim();

            switch (name)
            {
            case "":
            case null:
                name = "Unknown";
                break;

            // Reserved names.
            case "Main":
            case "Meido":
            case "Triggers":
            case "Auth":
                name = "_" + name;
                break;
            }

            return(name);
        }
Exemplo n.º 4
0
 public Logger CreateLogger(IMeidoHook plugin)
 {
     return(CreateLogger(plugin.Name()));
 }