VersionInfo.cs 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #nullable enable
  2. using System.Text.Json.Serialization;
  3. using SysVersion = System.Version;
  4. namespace MediaBrowser.Model.Updates
  5. {
  6. /// <summary>
  7. /// Defines the <see cref="VersionInfo"/> class.
  8. /// </summary>
  9. public class VersionInfo
  10. {
  11. private SysVersion? _version;
  12. /// <summary>
  13. /// Gets or sets the version.
  14. /// </summary>
  15. /// <value>The version.</value>
  16. [JsonPropertyName("version")]
  17. public string Version
  18. {
  19. get => _version == null ? string.Empty : _version.ToString();
  20. set => _version = SysVersion.Parse(value);
  21. }
  22. /// <summary>
  23. /// Gets the version as a <see cref="SysVersion"/>.
  24. /// </summary>
  25. public SysVersion VersionNumber => _version ?? new SysVersion(0, 0, 0);
  26. /// <summary>
  27. /// Gets or sets the changelog for this version.
  28. /// </summary>
  29. /// <value>The changelog.</value>
  30. [JsonPropertyName("changelog")]
  31. public string? Changelog { get; set; }
  32. /// <summary>
  33. /// Gets or sets the ABI that this version was built against.
  34. /// </summary>
  35. /// <value>The target ABI version.</value>
  36. [JsonPropertyName("targetAbi")]
  37. public string? TargetAbi { get; set; }
  38. /// <summary>
  39. /// Gets or sets the maximum ABI that this version will work with.
  40. /// </summary>
  41. /// <value>The target ABI version.</value>
  42. [JsonPropertyName("maxAbi")]
  43. public string? MaxAbi { get; set; }
  44. /// <summary>
  45. /// Gets or sets the source URL.
  46. /// </summary>
  47. /// <value>The source URL.</value>
  48. [JsonPropertyName("sourceUrl")]
  49. public string? SourceUrl { get; set; }
  50. /// <summary>
  51. /// Gets or sets a checksum for the binary.
  52. /// </summary>
  53. /// <value>The checksum.</value>
  54. [JsonPropertyName("checksum")]
  55. public string? Checksum { get; set; }
  56. /// <summary>
  57. /// Gets or sets a timestamp of when the binary was built.
  58. /// </summary>
  59. /// <value>The timestamp.</value>
  60. [JsonPropertyName("timestamp")]
  61. public string? Timestamp { get; set; }
  62. /// <summary>
  63. /// Gets or sets the repository name.
  64. /// </summary>
  65. [JsonPropertyName("repositoryName")]
  66. public string RepositoryName { get; set; } = string.Empty;
  67. /// <summary>
  68. /// Gets or sets the repository url.
  69. /// </summary>
  70. [JsonPropertyName("repositoryUrl")]
  71. public string RepositoryUrl { get; set; } = string.Empty;
  72. }
  73. }