Beispiel #1
0
        public void Setup(string ServerName, bool LoadConfig = false)
        {
            _servername          = ServerName;
            sRssCommand          = new RssCommand(ServerName);
            sLocalization.Locale = sLConsole.Locale;

            if (IRCConfig.List[ServerName].ServerId == 1 || LoadConfig)
            {
                _config = new AddonConfig(Name, ".yml");
            }

            InitIrcCommand();
            SchumixBase.DManager.Update("wordpressinfo", string.Format("ServerName = '{0}'", ServerName), string.Format("ServerId = '{0}'", IRCConfig.List[ServerName].ServerId));

            if (CleanConfig.Database)
            {
                SchumixBase.sCleanManager.CDatabase.CleanTable("wordpressinfo");
            }

            var db = SchumixBase.DManager.Query("SELECT Name, Link FROM wordpressinfo WHERE ServerName = '{0}'", ServerName);

            if (!db.IsNull())
            {
                foreach (DataRow row in db.Rows)
                {
                    string name = row["Name"].ToString();
                    string link = row["Link"].ToString();
                    var    rss  = new WordPressRss(ServerName, name, link);
                    sRssCommand.RssList.Add(rss);
                }

                int x = 0;

                foreach (var list in sRssCommand.RssList)
                {
                    list.Start();
                    x++;
                }

                Log.Notice("WordPressRssAddon", sLConsole.GetString("{0}: {1} rss loaded."), ServerName, x);
            }
            else
            {
                Log.Warning("WordPressRssAddon", sLConsole.GetString("{0}: Empty database!"), ServerName);
            }
        }
Beispiel #2
0
		public void Setup(string ServerName, bool LoadConfig = false)
		{
			_servername = ServerName;
			sRssCommand = new RssCommand(ServerName);
			sLocalization.Locale = sLConsole.Locale;

			if(IRCConfig.List[ServerName].ServerId == 1 || LoadConfig)
				_config = new AddonConfig(Name, ".yml");

			InitIrcCommand();
			SchumixBase.DManager.Update("wordpressinfo", string.Format("ServerName = '{0}'", ServerName), string.Format("ServerId = '{0}'", IRCConfig.List[ServerName].ServerId));

			if(CleanConfig.Database)
				SchumixBase.sCleanManager.CDatabase.CleanTable("wordpressinfo");

			var db = SchumixBase.DManager.Query("SELECT Name, Link FROM wordpressinfo WHERE ServerName = '{0}'", ServerName);
			if(!db.IsNull())
			{
				foreach(DataRow row in db.Rows)
				{
					string name = row["Name"].ToString();
					string link = row["Link"].ToString();
					var rss = new WordPressRss(ServerName, name, link);
					sRssCommand.RssList.Add(rss);
				}

				int x = 0;

				foreach(var list in sRssCommand.RssList)
				{
					list.Start();
					x++;
				}

				Log.Notice("WordPressRssAddon", sLConsole.GetString("{0}: {1} rss loaded."), ServerName, x);
			}
			else
				Log.Warning("WordPressRssAddon", sLConsole.GetString("{0}: Empty database!"), ServerName);
		}