diff options
author | Ben Harris <ben@tilde.team> | 2020-04-28 00:35:52 -0400 |
---|---|---|
committer | Ben Harris <ben@tilde.team> | 2020-04-28 00:35:52 -0400 |
commit | 80afa2c0aec37b7f98cc22615417c36672e695da (patch) | |
tree | 63ca3e309a5daa5093e54bdfdb493115c7a3d942 /IrcTokens/Hostmask.cs | |
parent | 933a4f85604e21445c9bac8272d64cf3e6f65e00 (diff) |
tidy up, work on stateful
Diffstat (limited to 'IrcTokens/Hostmask.cs')
-rw-r--r-- | IrcTokens/Hostmask.cs | 64 |
1 files changed, 29 insertions, 35 deletions
diff --git a/IrcTokens/Hostmask.cs b/IrcTokens/Hostmask.cs index 01fe7d5..3c0b7f2 100644 --- a/IrcTokens/Hostmask.cs +++ b/IrcTokens/Hostmask.cs @@ -3,47 +3,15 @@ namespace IrcTokens { /// <summary> - /// Represents the three parts of a hostmask. Parse with the constructor. + /// Represents the three parts of a hostmask. Parse with the constructor. /// </summary> public class Hostmask : IEquatable<Hostmask> { - public string NickName { get; set; } - public string UserName { get; set; } - public string HostName { get; set; } - - public override string ToString() - { - return _source; - } - - public override int GetHashCode() - { - return _source.GetHashCode(StringComparison.Ordinal); - } - - public bool Equals(Hostmask other) - { - if (other == null) - { - return false; - } - - 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; @@ -66,5 +34,31 @@ namespace IrcTokens UserName = userSplit[1]; } } + + public string NickName { get; set; } + public string UserName { get; set; } + public string HostName { get; set; } + + public bool Equals(Hostmask other) + { + if (other == null) return false; + + return _source == other._source; + } + + public override string ToString() + { + return _source; + } + + public override int GetHashCode() + { + return _source.GetHashCode(StringComparison.Ordinal); + } + + public override bool Equals(object obj) + { + return Equals(obj as Hostmask); + } } -} \ No newline at end of file +} |