csharpdeeb25a2 | 1 | using System.Text.Json; |
| 2 | using Tomlyn; |
| 3 | |
| 4 | namespace CascadeIDE.Services; |
| 5 | |
| 6 | /// <summary>Паритет с Tomlyn 1.x <c>Toml.ToModel</c>: ключи в TOML в snake_case, свойства моделей в PascalCase.</summary> |
| 7 | internal static class CascadeTomlSerializer |
| 8 | { |
| 9 | public static readonly TomlSerializerOptions Options = new() |
| 10 | { |
| 11 | PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower, |
| 12 | }; |
| 13 | |
| 14 | public static T? Deserialize<T>(string text) => TomlSerializer.Deserialize<T>(text, Options); |
| 15 | |
| 16 | public static string Serialize<T>(T value) => TomlSerializer.Serialize(value, Options); |
| 17 | } |
| 18 | |
View only · write via MCP/CIDE