VersionInfo.cs 2.4 KB

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