You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
3.5 KiB

  1. #nullable enable
  2. using Hive.Versioning;
  3. using IPA.JsonConverters;
  4. using IPA.Utilities;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Text.Json.Nodes;
  8. using System.Text.Json.Serialization;
  9. using AlmostVersionConverter = IPA.JsonConverters.AlmostVersionConverter;
  10. using Version = Hive.Versioning.Version;
  11. #if NET3
  12. using Net3_Proxy;
  13. using Array = Net3_Proxy.Array;
  14. #endif
  15. namespace IPA.Loader
  16. {
  17. internal class PluginManifest
  18. {
  19. [JsonPropertyName("name")]
  20. [JsonRequired]
  21. public string Name { get; init; } = null!;
  22. [JsonPropertyName("id")]
  23. [JsonRequired] // TODO: Originally AllowNull
  24. public string? Id { get; set; }
  25. [JsonPropertyName("description")]
  26. [JsonRequired]
  27. [JsonConverter(typeof(MultilineStringConverter))]
  28. public string Description { get; set; } = null!;
  29. [JsonPropertyName("version")]
  30. [JsonRequired]
  31. [JsonConverter(typeof(SemverVersionConverter))]
  32. public Version Version { get; init; } = null!;
  33. [JsonPropertyName("gameVersion")]
  34. [JsonRequired] // TODO: Originally DisallowNull
  35. [JsonConverter(typeof(AlmostVersionConverter))]
  36. public AlmostVersion? GameVersion { get; init; }
  37. [JsonPropertyName("author")]
  38. [JsonRequired]
  39. public string Author { get; init; } = null!;
  40. [JsonPropertyName("dependsOn")]
  41. [JsonRequired] // TODO: Originally DisallowNull
  42. public Dictionary<string, VersionRange> Dependencies { get; init; } = new();
  43. [JsonPropertyName("conflictsWith")]
  44. // TODO: Originally DisallowNull
  45. public Dictionary<string, VersionRange> Conflicts { get; init; } = new();
  46. [JsonPropertyName("features")]
  47. // TODO: Originally DisallowNull
  48. public Dictionary<string, List<JsonObject>> Features { get; init; } = new();
  49. [JsonPropertyName("loadBefore")]
  50. // TODO: Originally DisallowNull
  51. public string[] LoadBefore { get; init; } = Array.Empty<string>();
  52. [JsonPropertyName("loadAfter")]
  53. // TODO: Originally DisallowNull
  54. public string[] LoadAfter { get; init; } = Array.Empty<string>();
  55. [JsonPropertyName("icon")]
  56. // TODO: Originally DisallowNull
  57. public string? IconPath { get; init; }
  58. [JsonPropertyName("files")]
  59. // TODO: Originally DisallowNull
  60. public string[] Files { get; init; } = Array.Empty<string>();
  61. [Serializable]
  62. public class LinksObject
  63. {
  64. [JsonPropertyName("project-home")]
  65. // TODO: Originally DisallowNull
  66. public Uri? ProjectHome { get; init; }
  67. [JsonPropertyName("project-source")]
  68. // TODO: Originally DisallowNull
  69. public Uri? ProjectSource { get; init; }
  70. [JsonPropertyName("donate")]
  71. // TODO: Originally DisallowNull
  72. public Uri? Donate { get; init; }
  73. }
  74. [JsonPropertyName("links")]
  75. // TODO: Originally DisallowNull
  76. public LinksObject? Links { get; init; }
  77. [Serializable]
  78. public class MiscObject
  79. {
  80. [JsonPropertyName("plugin-hint")]
  81. // TODO: Originally DisallowNull
  82. public string? PluginMainHint { get; init; }
  83. }
  84. [JsonPropertyName("misc")]
  85. // TODO: Originally DisallowNull
  86. public MiscObject? Misc { get; init; }
  87. }
  88. }