Beispiel #1
0
        /// <summary>
        ///     Initialises a new instance of the <see cref="LegacyConfig" /> class.
        /// </summary>
        protected LegacyConfig()
        {
            // FIXME: ServiceLocator - Legacy database
            this.legacyDatabase = ServiceLocator.Current.GetInstance<ILegacyDatabase>();

            this.configurationCache = new Dictionary<string, ConfigurationSetting>();
        }
Beispiel #2
0
        /// <summary>
        /// Initialises a new instance of the <see cref="GenericCommand"/> class.
        /// </summary>
        /// <param name="commandServiceHelper">
        /// The command Service Helper.
        /// </param>
        protected GenericCommand(ICommandServiceHelper commandServiceHelper)
        {
            // FIXME: ServiceLocator - genericlogger & legacydatabase
            this.Log = ServiceLocator.Current.GetInstance<ILogger>();
            this.legacyDatabase = ServiceLocator.Current.GetInstance<ILegacyDatabase>();

            this.CommandServiceHelper = commandServiceHelper;
        }
Beispiel #3
0
 /// <summary>
 ///     Initialises a new instance of the <see cref="LegacyUser" /> class.
 /// </summary>
 public LegacyUser()
 {
     // FIXME: ServiceLocator - legacydatabase
     this.db = ServiceLocator.Current.GetInstance<ILegacyDatabase>();
 }
Beispiel #4
0
 /// <summary>
 /// Initialises a new instance of the <see cref="Access"/> class.
 /// </summary>
 /// <param name="source">
 /// The source.
 /// </param>
 /// <param name="channel">
 /// The channel.
 /// </param>
 /// <param name="args">
 /// The args.
 /// </param>
 /// <param name="commandServiceHelper">
 /// The message Service.
 /// </param>
 public Access(LegacyUser source, string channel, string[] args, ICommandServiceHelper commandServiceHelper)
     : base(source, channel, args, commandServiceHelper)
 {
     // FIXME: ServiceLocator - legacydatabase
     this.legacyDatabase = ServiceLocator.Current.GetInstance<ILegacyDatabase>();
 }
Beispiel #5
0
        /// <summary>
        /// The initialise bot.
        /// </summary>
        private static void InitialiseBot()
        {
            dbal = container.Resolve<ILegacyDatabase>();

            if (!dbal.Connect())
            {
                // can't Connect to database, DIE
                return;
            }

            LegacyConfig.Singleton();

            var configurationHelper = container.Resolve<IConfigurationHelper>();

            INetworkClient networkClient;
            if (configurationHelper.IrcConfiguration.Ssl)
            {
                networkClient = new SslNetworkClient(
                    configurationHelper.IrcConfiguration.Hostname,
                    configurationHelper.IrcConfiguration.Port,
                    container.Resolve<ILogger>().CreateChildLogger("NetworkClient"));
            }
            else
            {
                networkClient = new NetworkClient(
                    configurationHelper.IrcConfiguration.Hostname,
                    configurationHelper.IrcConfiguration.Port,
                    container.Resolve<ILogger>().CreateChildLogger("NetworkClient"));
            }
            
            newIrc =
                new IrcClient(
                    networkClient,
                    container.Resolve<ILogger>().CreateChildLogger("IrcClient"),
                    configurationHelper.IrcConfiguration,
                    configurationHelper.PrivateConfiguration.IrcPassword);

            JoinChannels();
            
            // TODO: remove me!
            container.Register(Component.For<IIrcClient>().Instance(newIrc));

            joinMessageService = container.Resolve<IJoinMessageService>();

            SetupEvents();

            // initialise the deferred installers.
            container.Install(FromAssembly.This(new DeferredWindsorBootstrap()));
        }
        /// <summary>
        /// Initialises a new instance of the <see cref="WatcherController"/> class.
        /// </summary>
        /// <param name="messageService">
        /// The message Service.
        /// </param>
        /// <param name="urlShorteningService">
        /// The url Shortening Service.
        /// </param>
        /// <param name="watchedCategoryRepository">
        /// The watched Category Repository.
        /// </param>
        /// <param name="mediaWikiSiteRepository">
        /// The media Wiki Site Repository.
        /// </param>
        /// <param name="ignoredPagesRepository">
        /// The ignored Pages Repository.
        /// </param>
        /// <param name="logger">
        /// The logger.
        /// </param>
        /// <param name="ircClient">
        /// The IRC Client.
        /// </param>
        /// <param name="legacyDatabase">
        /// The legacy Database.
        /// </param>
        protected WatcherController(
            IMessageService messageService, 
            IUrlShorteningService urlShorteningService, 
            IWatchedCategoryRepository watchedCategoryRepository, 
            IMediaWikiSiteRepository mediaWikiSiteRepository,
            IIgnoredPagesRepository ignoredPagesRepository,
            ILogger logger,
            IIrcClient ircClient,
            ILegacyDatabase legacyDatabase)
        {
            this.messageService = messageService;
            this.urlShorteningService = urlShorteningService;
            this.watchers = new Dictionary<string, CategoryWatcher>();
            this.logger = logger;
            this.ircClient = ircClient;

            foreach (WatchedCategory item in watchedCategoryRepository.Get())
            {
                var categoryWatcher = new CategoryWatcher(
                    item,
                    mediaWikiSiteRepository,
                    ignoredPagesRepository,
                    logger.CreateChildLogger("CategoryWatcher[" + item.Keyword + "]"));
                this.watchers.Add(item.Keyword, categoryWatcher);
                categoryWatcher.CategoryHasItemsEvent += this.CategoryHasItemsEvent;
            }

            this.legacyDatabase = legacyDatabase;
        }
Beispiel #7
0
 /// <summary>
 /// Initialises a new instance of the <see cref="AccessLog"/> class.
 /// </summary>
 protected AccessLog()
 {
     // FIXME: ServiceLocator - legacydatabase
     this.legacyDatabase = ServiceLocator.Current.GetInstance<ILegacyDatabase>();
 }