Ejemplo n.º 1
0
        private static void Main()
        {
            bot = new BotDetails("Aus Bot CSharp v0", "Aus_Bot_CSharp", "AusBotHosting", "AusBotCSharp", "irc.quakenet.org", "#ausbot_test");
            try
            {
                OpenConnection();

                SendData("NICK", bot.NickName);
                string userDetails = bot.UserName + " " + bot.Host + " " + bot.Server + " :" + bot.RealName;
                SendData("USER", userDetails);
                while (true)
                {
                    string line;
                    int    count = 0;
                    while ((line = reader.ReadLine()) != null)
                    {
                        if (count == 4)
                        {
                            SendData("JOIN", bot.Channel);
                        }
                        switch (CheckServerMessages(line))
                        {
                        case NextExecutionStep.Return: return;

                        case NextExecutionStep.Continue: continue;

                        case NextExecutionStep.DoNothing: break;
                        }
                        switch (CheckUserMessages(line))
                        {
                        case NextExecutionStep.Return: return;

                        case NextExecutionStep.Continue: continue;

                        case NextExecutionStep.DoNothing: break;
                        }
                        ++count;
                    }
                }
            }
            catch (Exception e)
            {
                CloseConnection();
                Console.WriteLine("An exception occurred!\n\n" + e);
                Thread.Sleep(10000);
                Main();
            }
            finally { CloseConnection(); }
        }
Ejemplo n.º 2
0
		private static void Main()
		{
			bot = new BotDetails("Aus Bot CSharp v0", "Aus_Bot_CSharp", "AusBotHosting", "AusBotCSharp", "irc.quakenet.org", "#ausbot_test");
			try
			{
				OpenConnection();

				SendData("NICK", bot.NickName);
				string userDetails = bot.UserName + " " + bot.Host + " " + bot.Server + " :" + bot.RealName;
				SendData("USER", userDetails);
				while(true)
				{
					string line;
					int count = 0;
					while((line = reader.ReadLine()) != null)
					{
						if(count == 4) SendData("JOIN", bot.Channel);
						switch(CheckServerMessages(line))
						{
							case NextExecutionStep.Return: return;
							case NextExecutionStep.Continue: continue;
							case NextExecutionStep.DoNothing: break;
						}
						switch(CheckUserMessages(line))
						{
							case NextExecutionStep.Return: return;
							case NextExecutionStep.Continue: continue;
							case NextExecutionStep.DoNothing: break;
						}
						++count;
					}
				}
			}
			catch(Exception e)
			{
				CloseConnection();
				Console.WriteLine("An exception occurred!\n\n" + e);
				Thread.Sleep(10000);
				Main();
			}
			finally { CloseConnection(); }
		}