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.

Nick.cs 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace Combot.IRCServices
  7. {
  8. public class Nick
  9. {
  10. public string Username { get; set; }
  11. public string Realname { get; set; }
  12. public string Host { get; set; }
  13. public string Nickname { get; set; }
  14. public string Password { get; set; }
  15. public List<UserMode> Modes { get; set; }
  16. public List<PrivilegeMode> Privileges { get; set; }
  17. public Nick()
  18. {
  19. Username = string.Empty;
  20. Realname = string.Empty;
  21. Host = string.Empty;
  22. Nickname = string.Empty;
  23. Password = string.Empty;
  24. Modes = new List<UserMode>();
  25. Privileges = new List<PrivilegeMode>();
  26. }
  27. public void Copy(Nick nick)
  28. {
  29. Username = nick.Username;
  30. Realname = nick.Realname;
  31. Host = nick.Host;
  32. Nickname = nick.Nickname;
  33. Password = nick.Password;
  34. Modes = new List<UserMode>();
  35. Modes.AddRange(nick.Modes);
  36. Privileges = new List<PrivilegeMode>();
  37. Privileges.AddRange(nick.Privileges);
  38. }
  39. public void AddMode(UserMode mode)
  40. {
  41. if (!Modes.Contains(mode))
  42. {
  43. Modes.Add(mode);
  44. }
  45. }
  46. public void AddModes(List<UserMode> modes)
  47. {
  48. foreach (UserMode mode in modes)
  49. {
  50. AddMode(mode);
  51. }
  52. }
  53. public void RemoveMode(UserMode mode)
  54. {
  55. if (Modes.Contains(mode))
  56. {
  57. Modes.Remove(mode);
  58. }
  59. }
  60. public void RemoveModes(List<UserMode> modes)
  61. {
  62. foreach (UserMode mode in modes)
  63. {
  64. RemoveMode(mode);
  65. }
  66. }
  67. public void AddPrivilege(PrivilegeMode Privilege)
  68. {
  69. if (!Privileges.Contains(Privilege))
  70. {
  71. Privileges.Add(Privilege);
  72. }
  73. }
  74. public void AddPrivileges(List<PrivilegeMode> Privileges)
  75. {
  76. foreach (PrivilegeMode Privilege in Privileges)
  77. {
  78. AddPrivilege(Privilege);
  79. }
  80. }
  81. public void RemovePrivilege(PrivilegeMode Privilege)
  82. {
  83. if (Privileges.Contains(Privilege))
  84. {
  85. Privileges.Remove(Privilege);
  86. }
  87. }
  88. public void RemovePrivileges(List<PrivilegeMode> Privileges)
  89. {
  90. foreach (PrivilegeMode Privilege in Privileges)
  91. {
  92. RemovePrivilege(Privilege);
  93. }
  94. }
  95. }
  96. }