PackageVersionInfo.cs 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. using System;
  2. using MediaBrowser.Model.Serialization;
  3. namespace MediaBrowser.Model.Updates
  4. {
  5. /// <summary>
  6. /// Class PackageVersionInfo
  7. /// </summary>
  8. public class PackageVersionInfo
  9. {
  10. /// <summary>
  11. /// Gets or sets the name.
  12. /// </summary>
  13. /// <value>The name.</value>
  14. public string name { get; set; }
  15. /// <summary>
  16. /// Gets or sets the guid.
  17. /// </summary>
  18. /// <value>The guid.</value>
  19. public string guid { get; set; }
  20. /// <summary>
  21. /// Gets or sets the version STR.
  22. /// </summary>
  23. /// <value>The version STR.</value>
  24. public string versionStr { get; set; }
  25. /// <summary>
  26. /// The _version
  27. /// </summary>
  28. private Version _version;
  29. /// <summary>
  30. /// Gets or sets the version.
  31. /// Had to make this an interpreted property since Protobuf can't handle Version
  32. /// </summary>
  33. /// <value>The version.</value>
  34. [IgnoreDataMember]
  35. public Version version => _version ?? (_version = new Version(ValueOrDefault(versionStr, "0.0.0.1")));
  36. /// <summary>
  37. /// Values the or default.
  38. /// </summary>
  39. /// <param name="str">The STR.</param>
  40. /// <param name="def">The def.</param>
  41. /// <returns>System.String.</returns>
  42. private static string ValueOrDefault(string str, string def)
  43. {
  44. return string.IsNullOrEmpty(str) ? def : str;
  45. }
  46. /// <summary>
  47. /// Gets or sets the classification.
  48. /// </summary>
  49. /// <value>The classification.</value>
  50. public PackageVersionClass classification { get; set; }
  51. /// <summary>
  52. /// Gets or sets the description.
  53. /// </summary>
  54. /// <value>The description.</value>
  55. public string description { get; set; }
  56. /// <summary>
  57. /// Gets or sets the required version STR.
  58. /// </summary>
  59. /// <value>The required version STR.</value>
  60. public string requiredVersionStr { get; set; }
  61. /// <summary>
  62. /// Gets or sets the source URL.
  63. /// </summary>
  64. /// <value>The source URL.</value>
  65. public string sourceUrl { get; set; }
  66. /// <summary>
  67. /// Gets or sets the source URL.
  68. /// </summary>
  69. /// <value>The source URL.</value>
  70. public string checksum { get; set; }
  71. /// <summary>
  72. /// Gets or sets the target filename.
  73. /// </summary>
  74. /// <value>The target filename.</value>
  75. public string targetFilename { get; set; }
  76. public string infoUrl { get; set; }
  77. public string runtimes { get; set; }
  78. }
  79. }