The easy to use and full featured Irc Bot everyone is talking about!
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

IRCService.cs 988B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Net;
  7. namespace Combot
  8. {
  9. internal class IRCService
  10. {
  11. public Action<BotError> ErrorEvent;
  12. private TCPInterface _tcp;
  13. private Messages _messages;
  14. internal IRCService()
  15. {
  16. _tcp = new TCPInterface();
  17. _messages = new Messages(_tcp);
  18. }
  19. internal bool Connect(IPAddress IP, int port, int readTimeout, int allowedFailedCount = 0)
  20. {
  21. bool result = false;
  22. if (!_tcp.Connected)
  23. {
  24. result = _tcp.Connect(IP, port, readTimeout, allowedFailedCount);
  25. }
  26. return result;
  27. }
  28. internal bool Disconnect()
  29. {
  30. bool result = false;
  31. if (_tcp.Connected)
  32. {
  33. _tcp.Disconnect();
  34. }
  35. return result;
  36. }
  37. }
  38. }