diff --git a/PluralKit.Core/Models/PKMember.cs b/PluralKit.Core/Models/PKMember.cs index 656fcaee..969b48b0 100644 --- a/PluralKit.Core/Models/PKMember.cs +++ b/PluralKit.Core/Models/PKMember.cs @@ -46,34 +46,4 @@ namespace PluralKit.Core { return $"{guildDisplayName ?? DisplayName ?? Name} {systemTag}"; } } - - public struct ProxyTag - { - public ProxyTag(string prefix, string suffix) - { - // Normalize empty strings to null for DB - Prefix = prefix?.Length == 0 ? null : prefix; - Suffix = suffix?.Length == 0 ? null : suffix; - } - - [JsonProperty("prefix")] public string Prefix { get; set; } - [JsonProperty("suffix")] public string Suffix { get; set; } - - [JsonIgnore] public string ProxyString => $"{Prefix ?? ""}text{Suffix ?? ""}"; - - public bool IsEmpty => Prefix == null && Suffix == null; - - public bool Equals(ProxyTag other) => Prefix == other.Prefix && Suffix == other.Suffix; - - public override bool Equals(object obj) => obj is ProxyTag other && Equals(other); - - public override int GetHashCode() - { - unchecked - { - return ((Prefix != null ? Prefix.GetHashCode() : 0) * 397) ^ - (Suffix != null ? Suffix.GetHashCode() : 0); - } - } - } } \ No newline at end of file diff --git a/PluralKit.Core/Models/ProxyTag.cs b/PluralKit.Core/Models/ProxyTag.cs new file mode 100644 index 00000000..c00a5e50 --- /dev/null +++ b/PluralKit.Core/Models/ProxyTag.cs @@ -0,0 +1,34 @@ +using Newtonsoft.Json; + +namespace PluralKit.Core +{ + public struct ProxyTag + { + public ProxyTag(string prefix, string suffix) + { + // Normalize empty strings to null for DB + Prefix = prefix?.Length == 0 ? null : prefix; + Suffix = suffix?.Length == 0 ? null : suffix; + } + + [JsonProperty("prefix")] public string Prefix { get; set; } + [JsonProperty("suffix")] public string Suffix { get; set; } + + [JsonIgnore] public string ProxyString => $"{Prefix ?? ""}text{Suffix ?? ""}"; + + public bool IsEmpty => Prefix == null && Suffix == null; + + public bool Equals(ProxyTag other) => Prefix == other.Prefix && Suffix == other.Suffix; + + public override bool Equals(object obj) => obj is ProxyTag other && Equals(other); + + public override int GetHashCode() + { + unchecked + { + return ((Prefix != null ? Prefix.GetHashCode() : 0) * 397) ^ + (Suffix != null ? Suffix.GetHashCode() : 0); + } + } + } +} \ No newline at end of file