BaseApplicationConfiguration.cs 2.2 KB

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