Example #1
0
        private static void InitializeSettings()
        {
            var serializer = new JsonSerializer();
            var opt        = new InitialOptions();

            opt.SetDefaults();
            opt.MapToOptions();
            using (StreamWriter sw = new StreamWriter(configPath))
                using (JsonWriter writer = new JsonTextWriter(sw))
                {
                    serializer.Serialize(writer, opt);
                }
        }
Example #2
0
        private static void SetOptions()
        {
            var settings = new JsonSerializerSettings();

            settings.Converters.Add(new KeyGestureConverter());
            var serializer = JsonSerializer.Create(settings);
            var opt        = new InitialOptions();

            using (StreamReader sr = new StreamReader(configPath))
            {
                opt = (InitialOptions)serializer.Deserialize(sr, typeof(InitialOptions));
                opt.MapToOptions();
            }
        }