VersionInfo.cs 2.3 KB

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