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.

82 lines
3.0 KiB

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