<commit_before>﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace SimpleSoft.IniParser.Impl
{
    /// <summary>
    /// The INI serializer
    /// </summary>
    public class IniSerializer : IIniSerializer
    {
        /// <summary>
        /// Creates a new instance.
        /// </summary>
        /// <param name="options">The serialization options</param>
        /// <param name="normalizer">The <see cref="IniContainer"/> normalizer to use</param>
        /// <exception cref="ArgumentNullException"></exception>
        public IniSerializer(IniSerializationOptions options, IIniNormalizer normalizer)
        {
            if (options == null)
                throw new ArgumentNullException(nameof(options));
            if (normalizer == null)
                throw new ArgumentNullException(nameof(normalizer));

            Options = options;
            Normalizer = normalizer;
        }

        /// <summary>
        /// Creates a new instance.
        /// </summary>
        public IniSerializer() : this(new IniSerializationOptions(), new IniNormalizer())
        {
            
        }

        /// <summary>
        /// Serialization options.
        /// </summary>
        public IniSerializationOptions Options { get; }

        /// <summary>
        /// The <see cref="IniContainer"/> normalizer.
        /// </summary>
        public IIniNormalizer Normalizer { get; }

        /// <summary>
        /// Serializes the <see cref="IniContainer"/> as a string in the INI format.
        /// </summary>
        /// <param name="container">The container to serialize</param>
        /// <returns>The container serialized as a string</returns>
        public string SerializeAsString(IniContainer container)
        {
            if (container == null)
                throw new ArgumentNullException(nameof(container));

            if (container.IsEmpty)
                return string.Empty;

            if (Options.NormalizeBeforeSerialization)
                Normalizer.Normalize(container);

            var builder = new StringBuilder();
<commit_msg>Normalized container wasn't being used<commit_after>﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace SimpleSoft.IniParser.Impl
{
    /// <summary>
    /// The INI serializer
    /// </summary>
    public class IniSerializer : IIniSerializer
    {
        /// <summary>
        /// Creates a new instance.
        /// </summary>
        /// <param name="options">The serialization options</param>
        /// <param name="normalizer">The <see cref="IniContainer"/> normalizer to use</param>
        /// <exception cref="ArgumentNullException"></exception>
        public IniSerializer(IniSerializationOptions options, IIniNormalizer normalizer)
        {
            if (options == null)
                throw new ArgumentNullException(nameof(options));
            if (normalizer == null)
                throw new ArgumentNullException(nameof(normalizer));

            Options = options;
            Normalizer = normalizer;
        }

        /// <summary>
        /// Creates a new instance.
        /// </summary>
        public IniSerializer() : this(new IniSerializationOptions(), new IniNormalizer())
        {
            
        }

        /// <summary>
        /// Serialization options.
        /// </summary>
        public IniSerializationOptions Options { get; }

        /// <summary>
        /// The <see cref="IniContainer"/> normalizer.
        /// </summary>
        public IIniNormalizer Normalizer { get; }

        /// <summary>
        /// Serializes the <see cref="IniContainer"/> as a string in the INI format.
        /// </summary>
        /// <param name="container">The container to serialize</param>
        /// <returns>The container serialized as a string</returns>
        public string SerializeAsString(IniContainer container)
        {
            if (container == null)
                throw new ArgumentNullException(nameof(container));

            if (container.IsEmpty)
                return string.Empty;

            if (Options.NormalizeBeforeSerialization)
                container = Normalizer.Normalize(container);

            var builder = new StringBuilder();

{'fraction_non_alphanumeric': 0.11609378556794901, 'fraction_numerical': 0.0, 'mean_word_length': 1.958922558922559, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 53, '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': '5208747', 'n_tokens_mistral': 1090, 'n_tokens_neox': 1074, 'n_words': 281}