VersionInfo.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 source URL.
  40. /// </summary>
  41. /// <value>The source URL.</value>
  42. [JsonPropertyName("sourceUrl")]
  43. public string? SourceUrl { get; set; }
  44. /// <summary>
  45. /// Gets or sets a checksum for the binary.
  46. /// </summary>
  47. /// <value>The checksum.</value>
  48. [JsonPropertyName("checksum")]
  49. public string? Checksum { get; set; }
  50. /// <summary>
  51. /// Gets or sets a timestamp of when the binary was built.
  52. /// </summary>
  53. /// <value>The timestamp.</value>
  54. [JsonPropertyName("timestamp")]
  55. public string? Timestamp { get; set; }
  56. /// <summary>
  57. /// Gets or sets the repository name.
  58. /// </summary>
  59. [JsonPropertyName("repositoryName")]
  60. public string RepositoryName { get; set; } = string.Empty;
  61. /// <summary>
  62. /// Gets or sets the repository url.
  63. /// </summary>
  64. [JsonPropertyName("repositoryUrl")]
  65. public string RepositoryUrl { get; set; } = string.Empty;
  66. }
  67. }