You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
1.9 KiB

  1. // BEGIN: section ignore
  2. using IPA.Logging;
  3. using IPA.Utilities;
  4. // END: section ignore
  5. using Newtonsoft.Json;
  6. namespace IPA.Config
  7. {
  8. internal class SelfConfig
  9. {
  10. // This is to allow the doc generation to parse this file and use Newtonsoft to generate a JSON schema
  11. // BEGIN: section ignore
  12. private static IConfigProvider _loaderConfig;
  13. public static IConfigProvider LoaderConfig
  14. {
  15. get => _loaderConfig;
  16. set
  17. {
  18. _loaderConfig?.RemoveLinks();
  19. value.Load();
  20. SelfConfigRef = value.MakeLink<SelfConfig>((c, v) =>
  21. {
  22. if (v.Value.Regenerate)
  23. c.Store(v.Value = new SelfConfig { Regenerate = false });
  24. StandardLogger.Configure(v.Value);
  25. });
  26. _loaderConfig = value;
  27. }
  28. }
  29. public static Ref<SelfConfig> SelfConfigRef;
  30. public static void Load()
  31. {
  32. LoaderConfig = Config.GetProviderFor(IPAName, "json");
  33. }
  34. internal const string IPAName = "Beat Saber IPA";
  35. internal const string IPAVersion = "3.12.24";
  36. // END: section ignore
  37. public bool Regenerate = true;
  38. public class UpdateObject
  39. {
  40. public bool AutoUpdate = true;
  41. public bool AutoCheckUpdates = true;
  42. }
  43. public UpdateObject Updates = new UpdateObject();
  44. public class DebugObject
  45. {
  46. public bool ShowCallSource = false;
  47. public bool ShowDebug = false;
  48. public bool ShowHandledErrorStackTraces = false;
  49. public bool HideMessagesForPerformance = true;
  50. public int HideLogThreshold = 512;
  51. }
  52. public DebugObject Debug = new DebugObject();
  53. [JsonProperty(Required = Required.Default)]
  54. public string LastGameVersion = null;
  55. }
  56. }