BaseApplicationConfiguration.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #nullable disable
  2. using System;
  3. using System.Xml.Serialization;
  4. namespace MediaBrowser.Model.Configuration
  5. {
  6. /// <summary>
  7. /// Serves as a common base class for the Server and UI application Configurations
  8. /// ProtoInclude tells Protobuf about subclasses,
  9. /// The number 50 can be any number, so long as it doesn't clash with any of the ProtoMember numbers either here or in subclasses.
  10. /// </summary>
  11. public class BaseApplicationConfiguration
  12. {
  13. /// <summary>
  14. /// Initializes a new instance of the <see cref="BaseApplicationConfiguration" /> class.
  15. /// </summary>
  16. public BaseApplicationConfiguration()
  17. {
  18. LogFileRetentionDays = 3;
  19. }
  20. /// <summary>
  21. /// Gets or sets the number of days we should retain log files.
  22. /// </summary>
  23. /// <value>The log file retention days.</value>
  24. public int LogFileRetentionDays { get; set; }
  25. /// <summary>
  26. /// Gets or sets a value indicating whether this instance is first run.
  27. /// </summary>
  28. /// <value><c>true</c> if this instance is first run; otherwise, <c>false</c>.</value>
  29. public bool IsStartupWizardCompleted { get; set; }
  30. /// <summary>
  31. /// Gets or sets the cache path.
  32. /// </summary>
  33. /// <value>The cache path.</value>
  34. public string CachePath { get; set; }
  35. /// <summary>
  36. /// Gets or sets the last known version that was ran using the configuration.
  37. /// </summary>
  38. /// <value>The version from previous run.</value>
  39. [XmlIgnore]
  40. public Version PreviousVersion { get; set; }
  41. /// <summary>
  42. /// Gets or sets the stringified PreviousVersion to be stored/loaded,
  43. /// because System.Version itself isn't xml-serializable.
  44. /// </summary>
  45. /// <value>String value of PreviousVersion.</value>
  46. public string PreviousVersionStr
  47. {
  48. get => PreviousVersion?.ToString();
  49. set
  50. {
  51. if (Version.TryParse(value, out var version))
  52. {
  53. PreviousVersion = version;
  54. }
  55. }
  56. }
  57. }
  58. }