AmiiboApi.cs
1 using System; 2 using System.Collections.Generic; 3 using System.Text.Json.Serialization; 4 5 namespace Ryujinx.UI.Common.Models.Amiibo 6 { 7 public struct AmiiboApi : IEquatable<AmiiboApi> 8 { 9 [JsonPropertyName("name")] 10 public string Name { get; set; } 11 [JsonPropertyName("head")] 12 public string Head { get; set; } 13 [JsonPropertyName("tail")] 14 public string Tail { get; set; } 15 [JsonPropertyName("image")] 16 public string Image { get; set; } 17 [JsonPropertyName("amiiboSeries")] 18 public string AmiiboSeries { get; set; } 19 [JsonPropertyName("character")] 20 public string Character { get; set; } 21 [JsonPropertyName("gameSeries")] 22 public string GameSeries { get; set; } 23 [JsonPropertyName("type")] 24 public string Type { get; set; } 25 26 [JsonPropertyName("release")] 27 public Dictionary<string, string> Release { get; set; } 28 29 [JsonPropertyName("gamesSwitch")] 30 public List<AmiiboApiGamesSwitch> GamesSwitch { get; set; } 31 32 public readonly override string ToString() 33 { 34 return Name; 35 } 36 37 public readonly string GetId() 38 { 39 return Head + Tail; 40 } 41 42 public readonly bool Equals(AmiiboApi other) 43 { 44 return Head + Tail == other.Head + other.Tail; 45 } 46 47 public readonly override bool Equals(object obj) 48 { 49 return obj is AmiiboApi other && Equals(other); 50 } 51 52 public readonly override int GetHashCode() 53 { 54 return HashCode.Combine(Head, Tail); 55 } 56 57 public static bool operator ==(AmiiboApi left, AmiiboApi right) 58 { 59 return left.Equals(right); 60 } 61 62 public static bool operator !=(AmiiboApi left, AmiiboApi right) 63 { 64 return !(left == right); 65 } 66 } 67 }