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

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

            var db = SchumixBase.DManager.Query("SELECT Name, Link, Website FROM svninfo 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 SvnRss(ServerName, name, link, website);
                    sRssCommand.RssList.Add(rss);
                }

                int x = 0;

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

                Log.Notice("SvnRssAddon", sLConsole.GetString("{0}: {1} rss loaded."), ServerName, x);
            }
            else
            {
                Log.Warning("SvnRssAddon", sLConsole.GetString("{0}: Empty database!"), ServerName);
            }
        }
コード例 #2
0
ファイル: SvnRssAddon.cs プロジェクト: Schumix/Schumix2
		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("svninfo", string.Format("ServerName = '{0}'", ServerName), string.Format("ServerId = '{0}'", IRCConfig.List[ServerName].ServerId));

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

			var db = SchumixBase.DManager.Query("SELECT Name, Link, Website FROM svninfo 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 SvnRss(ServerName, name, link, website);
					sRssCommand.RssList.Add(rss);
				}

				int x = 0;

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

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