Exemple #1
0
 static void Main(string[] args)
 {
     Console.OutputEncoding = Encoding.UTF8;
     Config config = new Config("config.ini");
     Console.Title = config.getNickname() + " @" + config.getHostname();
     ServerInfo rizonInfo = new ServerInfo(config.getHostname(), 6667, config.getNickname(), config.getUsername());
     ircBot rizon = new ircBot(rizonInfo, config.getNickServ(), config);
     Thread rizonTypper = new Thread(rizon.typper);
     Thread rizonBot = new Thread(rizon.ircWork);
     rizonBot.Start();
     rizonTypper.Start();
 }
Exemple #2
0
        public ircBot(ServerInfo sInfo, string password, Config config)
        {
            _sInfo = sInfo;
            _password = password;
            _nick = _sInfo.getNick();
            _config = config;
            try
            {
                ircClient = new TcpClient(_sInfo.getHostname(), _sInfo.getPort());
                ns = ircClient.GetStream();
                _reader = new StreamReader(ns);
                _writer = new StreamWriter(ns) { NewLine = "\r\n", AutoFlush = true };
                sendData("USER", _sInfo.getName() + " " + config.getRealname() + " " + config.getRealname() + " :" + config.getRealname());
                sendData("NICK", _sInfo.getNick());

            }
            catch
            {
                Console.WriteLine("Communication Error");
            }
            _parser = new Parser(this);
        }