Пример #1
0
        /// <summary>
        /// Returns a Channel-array about the channels we want the bot to connect to
        /// in this network.
        /// </summary>
        /// <param name="networkID">Irc-network's id</param>
        /// <returns>ArrayList of channel-names and passwords</returns>
        public List<Channel> GetChannels(int networkID)
        {
            var channels = new List<Channel>();
            System.Data.DataSet ds = this.dataSourceConnection.GetChannels(networkID);
            foreach (System.Data.DataRow dr in ds.Tables[0].Rows)
            {
                string name = dr["name"].ToString();
                string password = dr["password"].ToString();
                int id = int.Parse(dr["channel_id"].ToString());

                Channel channel = new Channel(id, name, password);
                channels.Add(channel);
            }

            return channels;
        }
        public Channel GetChannelByID(int inChannelID)
        {
            System.Data.DataSet dataSet = new System.Data.DataSet();
            dataSet.ReadXml(this.configDirectory + settingsReader.GetValue("ChannelsConfigXml", typeof(string)).ToString());

            foreach (System.Data.DataRow dr in dataSet.Tables[0].Rows)
            {
                int id = int.Parse(dr["channel_id"].ToString());
                if (id == inChannelID)
                {
                    string name = dr["name"].ToString();
                    string password = dr["password"].ToString();
                    Channel channel = new Channel(id, name, password);
                    return channel;
                }
            }
            return null;
        }