<commit_before>﻿using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Xml.Serialization;

namespace NBi.Xml.Settings
{
    public class SettingsXml
    {
        [XmlIgnore]
        public string BasePath { get; set; }

        [XmlElement("default")]
        public List<DefaultXml> Defaults { get; set; }
        [XmlElement("reference")]
        public List<ReferenceXml> References { get; set; }

        [XmlElement("parallelize-queries")]
        [DefaultValue(true)]
        public bool ParallelizeQueries { get; set; }

        [XmlElement("csv-profile")]
        public CsvProfileXml CsvProfile { get; set; }

        public bool ShouldSerializeCsvProfile()
        {
            var value = 
                CsvProfile.InternalFieldSeparator != GetDefaultValue<string>(x => x.InternalFieldSeparator)
                || CsvProfile.InternalRecordSeparator != GetDefaultValue<string>(x => x.InternalRecordSeparator)
                || CsvProfile.InternalTextQualifier != GetDefaultValue<string>(x => x.InternalTextQualifier);<commit_msg>Include checks for EmptyCell, MissingCell and FirstRowHeader in ShouldSerializeCsvProfile() (issue #612).<commit_after>﻿using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Xml.Serialization;

namespace NBi.Xml.Settings
{
    public class SettingsXml
    {
        [XmlIgnore]
        public string BasePath { get; set; }

        [XmlElement("default")]
        public List<DefaultXml> Defaults { get; set; }
        [XmlElement("reference")]
        public List<ReferenceXml> References { get; set; }

        [XmlElement("parallelize-queries")]
        [DefaultValue(true)]
        public bool ParallelizeQueries { get; set; }

        [XmlElement("csv-profile")]
        public CsvProfileXml CsvProfile { get; set; }

        public bool ShouldSerializeCsvProfile()
        {
            var value = 
                CsvProfile.InternalFieldSeparator != GetDefaultValue<string>(x => x.InternalFieldSeparator)
                || CsvProfile.InternalRecordSeparator != GetDefaultValue<string>(x => x.InternalRecordSeparator)
                || CsvProfile.InternalTextQualifier != GetDefaultValue<string>(x => x.InternalTextQualifier)
                || CsvProfile.InternalEmptyCell != GetDefaultValue<string>(x => x.InternalEmptyCell)
                || CsvProfile.InternalMissingCell != GetDefaultValue<string>(x => x.InternalMissingCell)
                || CsvProfile.InternalFirstRowHeader != GetDefaultValue<bool>(x => x.InternalFirstRowHeader);
{'fraction_non_alphanumeric': 0.10275689223057644, 'fraction_numerical': 0.0010741138560687433, 'mean_word_length': 3.2591463414634148, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 25, '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': '5085077', 'n_tokens_mistral': 734, 'n_tokens_neox': 727, 'n_words': 150}