예제 #1
0
        // -------- Functions --------

        /// <summary>
        /// Initializes the plugin.
        /// </summary>
        /// <param name="pluginPath">The absolute path to the plugin dll.</param>
        /// <param name="ircConfig">The IRC config we are using.</param>
        public void Init(string pluginPath, IIrcConfig ircConfig)
        {
            string pluginDir = Path.GetDirectoryName(pluginPath);

            IrcLoggerConfig config = XmlLoader.LoadIrcLoggerConfig(
                Path.Combine(pluginDir, "IrcLoggerConfig.xml")
                );

            if (string.IsNullOrEmpty(config.LogFileLocation))
            {
                config.LogFileLocation = Path.Combine(pluginDir, "Logs");
            }
            if (string.IsNullOrEmpty(config.LogName))
            {
                config.LogName = "irclog";
            }

            this.logManager = new LogManager(config);

            AllHandler handler = new AllHandler(
                this.HandleLogEvent
                );

            this.handlers.Add(handler);
        }
예제 #2
0
        // -------- Functions --------

        /// <summary>
        /// Initializes the plugin.
        /// </summary>
        /// <param name="pluginInit">The class that has information required for initing the plugin.</param>
        public void Init(PluginInitor initor)
        {
            string pluginDir = Path.Combine(
                initor.ChaskisConfigPluginRoot,
                "IrcLogger"
                );

            string configPath = Path.Combine(
                pluginDir,
                "IrcLoggerConfig.xml"
                );

            this.config = XmlLoader.LoadIrcLoggerConfig(
                configPath
                );

            if (string.IsNullOrEmpty(config.LogFileLocation))
            {
                config.LogFileLocation = Path.Combine(pluginDir, "Logs");
            }
            if (string.IsNullOrEmpty(config.LogName))
            {
                config.LogName = "irclog";
            }

            this.logManager = new LogManager(config, initor.Log);

            AllHandlerConfig allHandlerConfig = new AllHandlerConfig
            {
                AllAction = this.HandleLogEvent
            };

            AllHandler handler = new AllHandler(
                allHandlerConfig
                );

            this.handlers.Add(handler);
        }