about summary refs log tree commit diff
path: root/IrcTokens/Hostmask.cs
diff options
context:
space:
mode:
authorBen Harris <ben@tilde.team>2020-04-22 16:28:51 -0400
committerBen Harris <ben@tilde.team>2020-04-22 16:28:51 -0400
commit933a4f85604e21445c9bac8272d64cf3e6f65e00 (patch)
tree5b300ca37beff5cf11ed67a8b6e3550d24cf18a3 /IrcTokens/Hostmask.cs
parent338763fde71ba2dc0de8ea5e2437d24ee365874b (diff)
rename to IrcSharp
also tidy up formatting with vs tools
Diffstat (limited to 'IrcTokens/Hostmask.cs')
-rw-r--r--IrcTokens/Hostmask.cs30
1 files changed, 23 insertions, 7 deletions
diff --git a/IrcTokens/Hostmask.cs b/IrcTokens/Hostmask.cs
index 0b07f80..01fe7d5 100644
--- a/IrcTokens/Hostmask.cs
+++ b/IrcTokens/Hostmask.cs
@@ -5,29 +5,45 @@ namespace IrcTokens
     /// <summary>
     /// Represents the three parts of a hostmask. Parse with the constructor.
     /// </summary>
-    public class Hostmask
+    public class Hostmask : IEquatable<Hostmask>
     {
         public string NickName { get; set; }
         public string UserName { get; set; }
         public string HostName { get; set; }
 
-        public override string ToString() => _source;
+        public override string ToString()
+        {
+            return _source;
+        }
 
-        public override int GetHashCode() => _source.GetHashCode(StringComparison.Ordinal);
+        public override int GetHashCode()
+        {
+            return _source.GetHashCode(StringComparison.Ordinal);
+        }
 
-        public override bool Equals(object obj)
+        public bool Equals(Hostmask other)
         {
-            if (obj == null || GetType() != obj.GetType())
+            if (other == null)
+            {
                 return false;
+            }
 
-            return _source == ((Hostmask) obj)._source;
+            return _source == other._source;
+        }
+
+        public override bool Equals(object obj)
+        {
+            return Equals(obj as Hostmask);
         }
 
         private readonly string _source;
 
         public Hostmask(string source)
         {
-            if (source == null) return;
+            if (source == null)
+            {
+                return;
+            }
 
             _source = source;