SettingsScope.cs 1.4 KB

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