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.

67 lines
1.8 KiB

  1. using IPA.JsonConverters;
  2. using IPA.Logging;
  3. using IPA.Utilities;
  4. using Newtonsoft.Json;
  5. using SemVer;
  6. using System;
  7. namespace IPA.Config
  8. {
  9. internal class SelfConfig
  10. {
  11. private static IConfigProvider _loaderConfig;
  12. public static IConfigProvider LoaderConfig
  13. {
  14. get => _loaderConfig;
  15. set
  16. {
  17. _loaderConfig?.RemoveLinks();
  18. value.Load();
  19. SelfConfigRef = value.MakeLink<SelfConfig>((c, v) =>
  20. {
  21. if (v.Value.Regenerate)
  22. c.Store(v.Value = new SelfConfig { Regenerate = false });
  23. StandardLogger.Configure(v.Value);
  24. });
  25. _loaderConfig = value;
  26. }
  27. }
  28. public static Ref<SelfConfig> SelfConfigRef;
  29. public static void Set()
  30. {
  31. LoaderConfig = Config.GetProviderFor(IPAName, "json");
  32. }
  33. internal const string IPAName = "Beat Saber IPA";
  34. internal const string IPAVersion = "3.12.18";
  35. public bool Regenerate = true;
  36. [Obsolete("No longer does anything, built-in mod yeeter always disabled")]
  37. public bool ApplyAntiYeet = false;
  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. public string LastGameVersion = null;
  54. }
  55. }