SettingsScope.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #nullable enable
  2. using System.Text.Json.Serialization;
  3. namespace Terminal.Gui.Configuration;
  4. // TODO: Change to internal to prevent app usage
  5. /// <summary>
  6. /// INTERNAL: The root object of Terminal.Gui configuration settings / JSON schema. Contains only properties attributed
  7. /// with
  8. /// <see cref="SettingsScope"/>.
  9. /// </summary>
  10. /// <example>
  11. /// <code>
  12. /// {
  13. /// "$schema" : "https://gui-cs.github.io/Terminal.Gui/schemas/tui-config-schema.json",
  14. /// "Application.UseSystemConsole" : true,
  15. /// "Theme" : "Default",
  16. /// "Themes": {
  17. /// },
  18. /// },
  19. /// </code>
  20. /// </example>
  21. /// <remarks></remarks>
  22. [JsonConverter (typeof (ScopeJsonConverter<SettingsScope>))]
  23. public class SettingsScope : Scope<SettingsScope>
  24. {
  25. /// <summary>
  26. /// Initializes a new instance. The dictionary will be populated with uninitialized (
  27. /// <see cref="ConfigProperty.HasValue"/>
  28. /// </summary>
  29. public SettingsScope ()
  30. {
  31. ConfigProperty? configProperty = GetUninitializedProperty ("Theme");
  32. TryAdd ("Theme", configProperty);
  33. configProperty = GetUninitializedProperty ("Themes");
  34. TryAdd ("Themes", configProperty);
  35. }
  36. /// <summary>Points to our JSON schema.</summary>
  37. [JsonInclude]
  38. [JsonPropertyName ("$schema")]
  39. public string Schema { get; set; } = "https://gui-cs.github.io/Terminal.Gui/schemas/tui-config-schema.json";
  40. }