예제 #1
0
파일: Program.cs 프로젝트: tabaha/picbot
 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();
 }
예제 #2
0
파일: ircBot.cs 프로젝트: tabaha/picbot
        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);
        }