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.

83 lines
3.1 KiB

  1. using IPA.JsonConverters;
  2. using IPA.Utilities;
  3. using Newtonsoft.Json;
  4. using Newtonsoft.Json.Linq;
  5. using SemVer;
  6. using System;
  7. using System.Collections.Generic;
  8. using AlmostVersionConverter = IPA.JsonConverters.AlmostVersionConverter;
  9. using Version = SemVer.Version;
  10. #if NET3
  11. using Net3_Proxy;
  12. using Array = Net3_Proxy.Array;
  13. #endif
  14. namespace IPA.Loader
  15. {
  16. internal class PluginManifest
  17. {
  18. [JsonProperty("name", Required = Required.Always)]
  19. public string Name;
  20. [JsonProperty("id", Required = Required.AllowNull)]
  21. public string Id;
  22. [JsonProperty("description", Required = Required.Always), JsonConverter(typeof(MultilineStringConverter))]
  23. public string Description;
  24. [JsonProperty("version", Required = Required.Always), JsonConverter(typeof(SemverVersionConverter))]
  25. public Version Version;
  26. [JsonProperty("gameVersion", Required = Required.Always), JsonConverter(typeof(AlmostVersionConverter))]
  27. public AlmostVersion GameVersion;
  28. [JsonProperty("author", Required = Required.Always)]
  29. public string Author;
  30. [JsonProperty("dependsOn", Required = Required.DisallowNull, ItemConverterType = typeof(SemverRangeConverter))]
  31. public Dictionary<string, Range> Dependencies = new Dictionary<string, Range>();
  32. [JsonProperty("conflictsWith", Required = Required.DisallowNull, ItemConverterType = typeof(SemverRangeConverter))]
  33. public Dictionary<string, Range> Conflicts = new Dictionary<string, Range>();
  34. [JsonProperty("features", Required = Required.DisallowNull), JsonConverter(typeof(FeaturesFieldConverter))]
  35. public Dictionary<string, JObject> Features = new Dictionary<string, JObject>();
  36. [JsonProperty("loadBefore", Required = Required.DisallowNull)]
  37. public string[] LoadBefore = Array.Empty<string>();
  38. [JsonProperty("loadAfter", Required = Required.DisallowNull)]
  39. public string[] LoadAfter = Array.Empty<string>();
  40. [JsonProperty("icon", Required = Required.DisallowNull)]
  41. public string IconPath = null;
  42. [JsonProperty("files", Required = Required.DisallowNull)]
  43. public string[] Files = Array.Empty<string>();
  44. [Serializable]
  45. public class LinksObject
  46. {
  47. [JsonProperty("project-home", Required = Required.DisallowNull)]
  48. public Uri ProjectHome = null;
  49. [JsonProperty("project-source", Required = Required.DisallowNull)]
  50. public Uri ProjectSource = null;
  51. [JsonProperty("donate", Required = Required.DisallowNull)]
  52. public Uri Donate = null;
  53. }
  54. [JsonProperty("links", Required = Required.DisallowNull)]
  55. public LinksObject Links = null;
  56. [Serializable]
  57. public class MiscObject
  58. {
  59. [JsonProperty("plugin-hint", Required = Required.DisallowNull)]
  60. public string PluginMainHint = null;
  61. }
  62. [JsonProperty("misc", Required = Required.DisallowNull)]
  63. public MiscObject Misc = null;
  64. }
  65. }