File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Plugins/Flow.Launcher.Plugin.WindowsSettings/Helper Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -39,13 +39,10 @@ internal static IEnumerable<WindowsSetting> ReadAllPossibleSettings()
3939 throw new Exception ( "stream is null" ) ;
4040 }
4141
42- var options = new JsonSerializerOptions ( ) ;
43- options . Converters . Add ( new JsonStringEnumConverter ( ) ) ;
44-
4542 using var reader = new StreamReader ( stream ) ;
4643 var text = reader . ReadToEnd ( ) ;
4744
48- settingsList = JsonSerializer . Deserialize < IEnumerable < WindowsSetting > > ( text , options ) ;
45+ settingsList = JsonSerializer . Deserialize ( text , MyJsonContext . Default . IEnumerableWindowsSetting ) ;
4946 }
5047 catch ( Exception exception )
5148 {
@@ -55,4 +52,13 @@ internal static IEnumerable<WindowsSetting> ReadAllPossibleSettings()
5552 return settingsList ?? Enumerable . Empty < WindowsSetting > ( ) ;
5653 }
5754 }
55+
56+ [ JsonSourceGenerationOptions (
57+ Converters = new [ ] { typeof ( JsonStringEnumConverter ) } ,
58+ PropertyNamingPolicy = JsonKnownNamingPolicy . CamelCase
59+ ) ]
60+ [ JsonSerializable ( typeof ( IEnumerable < WindowsSetting > ) ) ]
61+ internal partial class MyJsonContext : JsonSerializerContext
62+ {
63+ }
5864}
You can’t perform that action at this time.
0 commit comments