<commit_before>﻿using Json2Config.Net.Models;
using Newtonsoft.Json;
using System.IO;

namespace Json2Config.Net
{
    public class ConfigManager
    {
        private JsonSerializer serializer;

        public Config ConfigFile { get; set; }

        public ConfigManager(
            string applicationName, 
            string configFileName = "config.json", 
            Formatting jsonFormat = Formatting.Indented)
        {
            this.serializer = new JsonSerializer();
            this.ConfigFile = new Config(applicationName, configFileName);

            if (!ConfigFile.Exists())
            {
                ConfigFile.CreateDirectory();
                ConfigFile.CreateConfig();
            }
        }

        public void SaveConfig<T>(T obj)
        {
            using (StreamWriter file = File.CreateText(ConfigFile.FullName))
            {
                serializer.Serialize(file, obj);
            }
        }
        public T LoadConfig<T>()
        {
            return JsonConvert.DeserializeObject<T>(ConfigFile.RawJson());
        }
    }
}<commit_msg>ConfigManager now correctly uses format param<commit_after>﻿using Json2Config.Net.Models;
using Newtonsoft.Json;
using System.IO;

namespace Json2Config.Net
{
    public class ConfigManager
    {
        private JsonSerializer serializer;

        public Config ConfigFile { get; set; }

        public ConfigManager(
            string applicationName, 
            string configFileName = "config.json", 
            Formatting jsonFormat = Formatting.Indented)
        {
            this.serializer = new JsonSerializer();
            serializer.Formatting = jsonFormat;

            this.ConfigFile = new Config(applicationName, configFileName);

            if (!ConfigFile.Exists())
            {
                ConfigFile.CreateDirectory();
                ConfigFile.CreateConfig();
            }
        }

        public void SaveConfig<T>(T obj)
        {
            using (StreamWriter file = File.CreateText(ConfigFile.FullName))
            {
                serializer.Serialize(file, obj);
            }
        }
        public T LoadConfig<T>()
        {
            return JsonConvert.DeserializeObject<T>(ConfigFile.RawJson());
        }
    }
}
{'fraction_non_alphanumeric': 0.08566355969818021, 'fraction_numerical': 0.001775410563692854, 'mean_word_length': 1.8, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2467963', 'n_tokens_mistral': 561, 'n_tokens_neox': 542, 'n_words': 117}