Example #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("hginfo", string.Format("ServerName = '{0}'", ServerName), string.Format("ServerId = '{0}'", IRCConfig.List[ServerName].ServerId));

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

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

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

                int x = 0;

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

                Log.Notice("HgRssAddon", sLConsole.GetString("{0}: {1} rss loaded."), ServerName, x);
            }
            else
            {
                Log.Warning("HgRssAddon", sLConsole.GetString("{0}: Empty database!"), ServerName);
            }
        }
Example #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("hginfo", string.Format("ServerName = '{0}'", ServerName), string.Format("ServerId = '{0}'", IRCConfig.List[ServerName].ServerId));

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

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

				int x = 0;

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

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