AppScope.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Diagnostics;
  5. using System.Linq;
  6. using System.Reflection;
  7. using System.Text.Json.Serialization;
  8. using static Terminal.Gui.ConfigurationManager;
  9. #nullable enable
  10. namespace Terminal.Gui;
  11. /// <summary>
  12. /// The <see cref="Scope{T}"/> class for application-defined configuration settings.
  13. /// </summary>
  14. /// <remarks>
  15. /// </remarks>
  16. /// <example>
  17. /// <para>
  18. /// Use the <see cref="SerializableConfigurationProperty"/> attribute to mark properties that should be serialized as part
  19. /// of application-defined configuration settings.
  20. /// </para>
  21. /// <code>
  22. /// public class MyAppSettings {
  23. /// [SerializableConfigurationProperty (Scope = typeof (AppScope))]
  24. /// public static bool? MyProperty { get; set; } = true;
  25. /// }
  26. /// </code>
  27. /// <para>
  28. /// THe resultant Json will look like this:
  29. /// </para>
  30. /// <code>
  31. /// "AppSettings": {
  32. /// "MyAppSettings.MyProperty": true,
  33. /// "UICatalog.ShowStatusBar": true
  34. /// },
  35. /// </code>
  36. /// </example>
  37. [JsonConverter (typeof (ScopeJsonConverter<AppScope>))]
  38. public class AppScope : Scope<AppScope> {
  39. }