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.

57 lines
1.5 KiB

5 years ago
  1. using IPA.Logging;
  2. using IPA.Utilities;
  3. namespace IPA.Config
  4. {
  5. internal class SelfConfig
  6. {
  7. private static IConfigProvider _loaderConfig;
  8. public static IConfigProvider LoaderConfig
  9. {
  10. get => _loaderConfig;
  11. set
  12. {
  13. _loaderConfig?.RemoveLinks();
  14. value.Load();
  15. SelfConfigRef = value.MakeLink<SelfConfig>((c, v) =>
  16. {
  17. if (v.Value.Regenerate)
  18. c.Store(v.Value = new SelfConfig { Regenerate = false });
  19. StandardLogger.Configure(v.Value);
  20. });
  21. _loaderConfig = value;
  22. }
  23. }
  24. public static Ref<SelfConfig> SelfConfigRef;
  25. public static void Set()
  26. {
  27. LoaderConfig = Config.GetProviderFor(IPAName, "json");
  28. }
  29. internal const string IPAName = "Beat Saber IPA";
  30. internal const string IPAVersion = "3.12.15";
  31. public bool Regenerate = true;
  32. public bool ApplyAntiYeet = false;
  33. public class UpdateObject
  34. {
  35. public bool AutoUpdate = true;
  36. public bool AutoCheckUpdates = true;
  37. }
  38. public UpdateObject Updates = new UpdateObject();
  39. public class DebugObject
  40. {
  41. public bool ShowCallSource = false;
  42. public bool ShowDebug = false;
  43. }
  44. public DebugObject Debug = new DebugObject();
  45. }
  46. }