Amiibo.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text.Json.Serialization;
  4. namespace Ryujinx.Ava.UI.Models
  5. {
  6. public class Amiibo
  7. {
  8. public struct AmiiboJson
  9. {
  10. [JsonPropertyName("amiibo")] public List<AmiiboApi> Amiibo { get; set; }
  11. [JsonPropertyName("lastUpdated")] public DateTime LastUpdated { get; set; }
  12. }
  13. public struct AmiiboApi
  14. {
  15. [JsonPropertyName("name")] public string Name { get; set; }
  16. [JsonPropertyName("head")] public string Head { get; set; }
  17. [JsonPropertyName("tail")] public string Tail { get; set; }
  18. [JsonPropertyName("image")] public string Image { get; set; }
  19. [JsonPropertyName("amiiboSeries")] public string AmiiboSeries { get; set; }
  20. [JsonPropertyName("character")] public string Character { get; set; }
  21. [JsonPropertyName("gameSeries")] public string GameSeries { get; set; }
  22. [JsonPropertyName("type")] public string Type { get; set; }
  23. [JsonPropertyName("release")] public Dictionary<string, string> Release { get; set; }
  24. [JsonPropertyName("gamesSwitch")] public List<AmiiboApiGamesSwitch> GamesSwitch { get; set; }
  25. public override string ToString()
  26. {
  27. return Name;
  28. }
  29. public string GetId()
  30. {
  31. return Head + Tail;
  32. }
  33. public override bool Equals(object obj)
  34. {
  35. if (obj is AmiiboApi amiibo)
  36. {
  37. return amiibo.Head + amiibo.Tail == Head + Tail;
  38. }
  39. return false;
  40. }
  41. public override int GetHashCode()
  42. {
  43. return base.GetHashCode();
  44. }
  45. }
  46. public class AmiiboApiGamesSwitch
  47. {
  48. [JsonPropertyName("amiiboUsage")] public List<AmiiboApiUsage> AmiiboUsage { get; set; }
  49. [JsonPropertyName("gameID")] public List<string> GameId { get; set; }
  50. [JsonPropertyName("gameName")] public string GameName { get; set; }
  51. }
  52. public class AmiiboApiUsage
  53. {
  54. [JsonPropertyName("Usage")] public string Usage { get; set; }
  55. [JsonPropertyName("write")] public bool Write { get; set; }
  56. }
  57. }
  58. }