diff --git a/DisCatSharp/Entities/Channel/DiscordGuildDirectoryChannel.cs b/DisCatSharp/Entities/Channel/DiscordGuildDirectoryChannel.cs new file mode 100644 index 000000000..54a2e959f --- /dev/null +++ b/DisCatSharp/Entities/Channel/DiscordGuildDirectoryChannel.cs @@ -0,0 +1,94 @@ +// This file is part of the DisCatSharp project. +// +// Copyright (c) 2021 AITSYS +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using DisCatSharp.Exceptions; +using DisCatSharp.Net.Abstractions; +using DisCatSharp.Net.Models; +using Newtonsoft.Json; + +namespace DisCatSharp.Entities +{ + /// + /// Represents a discord guild directory channel. + /// + public class DiscordGuildDirectoryChannel : SnowflakeObject, IEquatable + { + /// + /// Initializes a new instance of the class. + /// + internal GuildDirectoryChannel() { } + + #region Methods + + #endregion + + /// + /// Checks whether this is equal to another object. + /// + /// Object to compare to. + /// Whether the object is equal to this . + public override bool Equals(object obj) => this.Equals(obj as DiscordGuildDirectoryChannel); + + /// + /// Checks whether this is equal to another . + /// + /// to compare to. + /// Whether the is equal to this . + public bool Equals(DiscordChannel e) => e is not null && (ReferenceEquals(this, e) || this.Id == e.Id); + + /// + /// Gets the hash code for this . + /// + /// The hash code for this . + public override int GetHashCode() => this.Id.GetHashCode(); + + /// + /// Gets whether the two objects are equal. + /// + /// First channel to compare. + /// Second channel to compare. + /// Whether the two channels are equal. + public static bool operator ==(DiscordGuildDirectoryChannel e1, DiscordGuildDirectoryChannel e2) + { + var o1 = e1 as object; + var o2 = e2 as object; + + return (o1 != null || o2 == null) && (o1 == null || o2 != null) && ((o1 == null && o2 == null) || e1.Id == e2.Id); + } + + /// + /// Gets whether the two objects are not equal. + /// + /// First channel to compare. + /// Second channel to compare. + /// Whether the two channels are not equal. + public static bool operator !=(DiscordGuildDirectoryChannel e1, DiscordGuildDirectoryChannel e2) + => !(e1 == e2); + } +}