From 2a1cd4fda8a4a8e649910d16b4dfa1ce7ae63543 Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Fri, 12 May 2023 09:24:40 +0800 Subject: *misc --- .../Attributes/AllowCommentsAttribute.cs | 35 ++++++++++ .../Attributes/BooleanFalseValuesAttribute.cs | 52 +++++++++++++++ .../Attributes/BooleanTrueValuesAttribute.cs | 52 +++++++++++++++ .../Attributes/BufferSizeAttribute.cs | 36 ++++++++++ .../Attributes/CacheFieldsAttribute.cs | 36 ++++++++++ .../Configuration/Attributes/CommentAttribute.cs | 36 ++++++++++ .../Configuration/Attributes/ConstantAttribute.cs | 47 +++++++++++++ .../Attributes/CountBytesAttribute.cs | 45 +++++++++++++ .../Attributes/CultureInfoAttribute.cs | 46 +++++++++++++ .../Attributes/DateTimeStylesAttribute.cs | 44 +++++++++++++ .../Configuration/Attributes/DefaultAttribute.cs | 45 +++++++++++++ .../Configuration/Attributes/DelimiterAttribute.cs | 35 ++++++++++ .../DetectColumnCountChangesAttribute.cs | 40 +++++++++++ .../Attributes/DetectDelimiterAttribute.cs | 35 ++++++++++ .../Attributes/DetectDelimiterValuesAttribute.cs | 37 +++++++++++ .../Configuration/Attributes/EncodingAttribute.cs | 36 ++++++++++ .../Attributes/EnumIgnoreCaseAttribute.cs | 41 ++++++++++++ .../Configuration/Attributes/EscapeAttribute.cs | 35 ++++++++++ .../ExceptionMessagesContainRawDataAttribute.cs | 39 +++++++++++ .../Configuration/Attributes/FormatAttribute.cs | 50 ++++++++++++++ .../Attributes/HasHeaderRecordAttribute.cs | 35 ++++++++++ .../Attributes/HeaderPrefixAttribute.cs | 73 ++++++++++++++++++++ .../Configuration/Attributes/IClassMapper.cs | 19 ++++++ .../Configuration/Attributes/IMemberMapper.cs | 20 ++++++ .../Attributes/IMemberReferenceMapper.cs | 20 ++++++ .../Configuration/Attributes/IParameterMapper.cs | 24 +++++++ .../Attributes/IParameterReferenceMapper.cs | 24 +++++++ .../Configuration/Attributes/IgnoreAttribute.cs | 41 ++++++++++++ .../Attributes/IgnoreBaseAttribute.cs | 20 ++++++ .../Attributes/IgnoreBlankLinesAttribute.cs | 35 ++++++++++ .../Attributes/IgnoreReferencesAttribute.cs | 41 ++++++++++++ .../Attributes/IncludePrivateMembersAttribute.cs | 35 ++++++++++ .../Configuration/Attributes/IndexAttribute.cs | 57 ++++++++++++++++ .../Attributes/InjectionCharactersAttribute.cs | 37 +++++++++++ .../InjectionEscapeCharacterAttribute.cs | 35 ++++++++++ .../Attributes/InjectionOptionsAttribute.cs | 35 ++++++++++ .../LineBreakInQuotedFieldIsBadDataAttribute.cs | 39 +++++++++++ .../Attributes/MaxFieldSizeAttribute.cs | 40 +++++++++++ .../Attributes/MemberTypesAttribute.cs | 40 +++++++++++ .../Configuration/Attributes/ModeAttribute.cs | 38 +++++++++++ .../Configuration/Attributes/NameAttribute.cs | 77 ++++++++++++++++++++++ .../Configuration/Attributes/NameIndexAttribute.cs | 45 +++++++++++++ .../Configuration/Attributes/NewLineAttribute.cs | 39 +++++++++++ .../Attributes/NullValuesAttribute.cs | 52 +++++++++++++++ .../Attributes/NumberStylesAttribute.cs | 44 +++++++++++++ .../Configuration/Attributes/OptionalAttribute.cs | 27 ++++++++ .../Attributes/ProcessFieldBufferSizeAttribute.cs | 36 ++++++++++ .../Configuration/Attributes/QuoteAttribute.cs | 35 ++++++++++ .../Attributes/TrimOptionsAttribute.cs | 35 ++++++++++ .../Attributes/TypeConverterAttribute.cs | 57 ++++++++++++++++ ...UseNewObjectForNullReferenceMembersAttribute.cs | 47 +++++++++++++ .../Attributes/WhiteSpaceCharsAttribute.cs | 41 ++++++++++++ 52 files changed, 2065 insertions(+) create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/AllowCommentsAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/BooleanFalseValuesAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/BooleanTrueValuesAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/BufferSizeAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/CacheFieldsAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/CommentAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/ConstantAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/CountBytesAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/CultureInfoAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/DateTimeStylesAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/DefaultAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/DelimiterAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/DetectColumnCountChangesAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/DetectDelimiterAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/DetectDelimiterValuesAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/EncodingAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/EnumIgnoreCaseAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/EscapeAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/ExceptionMessagesContainRawDataAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/FormatAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/HasHeaderRecordAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/HeaderPrefixAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IClassMapper.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IMemberMapper.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IMemberReferenceMapper.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IParameterMapper.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IParameterReferenceMapper.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IgnoreAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IgnoreBaseAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IgnoreBlankLinesAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IgnoreReferencesAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IncludePrivateMembersAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IndexAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/InjectionCharactersAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/InjectionEscapeCharacterAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/InjectionOptionsAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/LineBreakInQuotedFieldIsBadDataAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/MaxFieldSizeAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/MemberTypesAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/ModeAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/NameAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/NameIndexAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/NewLineAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/NullValuesAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/NumberStylesAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/OptionalAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/ProcessFieldBufferSizeAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/QuoteAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/TrimOptionsAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/TypeConverterAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/UseNewObjectForNullReferenceMembersAttribute.cs create mode 100644 ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/WhiteSpaceCharsAttribute.cs (limited to 'ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes') diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/AllowCommentsAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/AllowCommentsAttribute.cs new file mode 100644 index 0000000..1490cc9 --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/AllowCommentsAttribute.cs @@ -0,0 +1,35 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// A value indicating if comments are allowed. + /// + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class AllowCommentsAttribute : Attribute, IClassMapper + { + /// + /// Gets a value indicating if comments are allowed. + /// + public bool AllowComments { get; private set; } + + /// + /// A value indicating if comments are allowed. + /// + /// The value indicating id comments are allowed. + public AllowCommentsAttribute(bool allowComments) + { + AllowComments = allowComments; + } + + /// + public void ApplyTo(CsvConfiguration configuration) + { + configuration.AllowComments = AllowComments; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/BooleanFalseValuesAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/BooleanFalseValuesAttribute.cs new file mode 100644 index 0000000..b26315b --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/BooleanFalseValuesAttribute.cs @@ -0,0 +1,52 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// The string values used to represent a boolean false when converting. + /// + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + public class BooleanFalseValuesAttribute : Attribute, IMemberMapper, IParameterMapper + { + /// + /// Gets the false values. + /// + public string[] FalseValues { get; private set; } + + /// + /// The string values used to represent a boolean false when converting. + /// + /// The false values. + public BooleanFalseValuesAttribute(string falseValue) + { + FalseValues = new string[] { falseValue }; + } + + /// + /// The string values used to represent a boolean false when converting. + /// + /// The false values. + public BooleanFalseValuesAttribute(params string[] falseValues) + { + FalseValues = falseValues; + } + + /// + public void ApplyTo(MemberMap memberMap) + { + memberMap.Data.TypeConverterOptions.BooleanFalseValues.Clear(); + memberMap.Data.TypeConverterOptions.BooleanFalseValues.AddRange(FalseValues); + } + + /// + public void ApplyTo(ParameterMap parameterMap) + { + parameterMap.Data.TypeConverterOptions.BooleanFalseValues.Clear(); + parameterMap.Data.TypeConverterOptions.BooleanFalseValues.AddRange(FalseValues); + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/BooleanTrueValuesAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/BooleanTrueValuesAttribute.cs new file mode 100644 index 0000000..3a9b591 --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/BooleanTrueValuesAttribute.cs @@ -0,0 +1,52 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// The string values used to represent a boolean true when converting. + /// + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + public class BooleanTrueValuesAttribute : Attribute, IMemberMapper, IParameterMapper + { + /// + /// Gets the true values. + /// + public string[] TrueValues { get; private set; } + + /// + /// The string values used to represent a boolean true when converting. + /// + /// + public BooleanTrueValuesAttribute(string trueValue) + { + TrueValues = new string[] { trueValue }; + } + + /// + /// The string values used to represent a boolean true when converting. + /// + /// + public BooleanTrueValuesAttribute(params string[] trueValues) + { + TrueValues = trueValues; + } + + /// + public void ApplyTo(MemberMap memberMap) + { + memberMap.Data.TypeConverterOptions.BooleanTrueValues.Clear(); + memberMap.Data.TypeConverterOptions.BooleanTrueValues.AddRange(TrueValues); + } + + /// + public void ApplyTo(ParameterMap parameterMap) + { + parameterMap.Data.TypeConverterOptions.BooleanTrueValues.Clear(); + parameterMap.Data.TypeConverterOptions.BooleanTrueValues.AddRange(TrueValues); + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/BufferSizeAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/BufferSizeAttribute.cs new file mode 100644 index 0000000..f74e98e --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/BufferSizeAttribute.cs @@ -0,0 +1,36 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// The size of the buffer used for parsing and writing CSV files. + /// Default is 0x1000. + /// + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class BufferSizeAttribute : Attribute, IClassMapper + { + /// + /// The buffer size. + /// + public int BufferSize { get; private set; } + + /// + /// The size of the buffer used for parsing and writing CSV files. + /// + /// + public BufferSizeAttribute(int bufferSize) + { + BufferSize = bufferSize; + } + + /// + public void ApplyTo(CsvConfiguration configuration) + { + configuration.BufferSize = BufferSize; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/CacheFieldsAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/CacheFieldsAttribute.cs new file mode 100644 index 0000000..1f6b859 --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/CacheFieldsAttribute.cs @@ -0,0 +1,36 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// Cache fields that are created when parsing. + /// Default is false. + /// + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class CacheFieldsAttribute : Attribute, IClassMapper + { + /// + /// Cache fields that are created when parsing. + /// + public bool CacheFields { get; private set; } + + /// + /// Cache fields that are created when parsing. + /// + /// + public CacheFieldsAttribute(bool cacheFields) + { + CacheFields = cacheFields; + } + + /// + public void ApplyTo(CsvConfiguration configuration) + { + configuration.CacheFields = CacheFields; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/CommentAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/CommentAttribute.cs new file mode 100644 index 0000000..c0c6124 --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/CommentAttribute.cs @@ -0,0 +1,36 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// The character used to denote a line that is commented out. + /// Default is #. + /// + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class CommentAttribute : Attribute, IClassMapper + { + /// + /// Gets the character used to denote a line that is commented out. + /// + public char Comment { get; private set; } + + /// + /// The character used to denote a line that is commented out. + /// + /// The comment character. + public CommentAttribute(char comment) + { + Comment = comment; + } + + /// + public void ApplyTo(CsvConfiguration configuration) + { + configuration.Comment = Comment; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/ConstantAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/ConstantAttribute.cs new file mode 100644 index 0000000..5dd2dc5 --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/ConstantAttribute.cs @@ -0,0 +1,47 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// The constant value that will be used for every record when + /// reading and writing. This value will always be used no matter + /// what other mapping configurations are specified. + /// + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + public class ConstantAttribute : Attribute, IMemberMapper, IParameterMapper + { + /// + /// Gets the constant. + /// + public object Constant { get; private set; } + + /// + /// The constant value that will be used for every record when + /// reading and writing. This value will always be used no matter + /// what other mapping configurations are specified. + /// + /// The constant. + public ConstantAttribute(object constant) + { + Constant = constant; + } + + /// + public void ApplyTo(MemberMap memberMap) + { + memberMap.Data.Constant = Constant; + memberMap.Data.IsConstantSet = true; + } + + /// + public void ApplyTo(ParameterMap parameterMap) + { + parameterMap.Data.Constant = Constant; + parameterMap.Data.IsConstantSet = true; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/CountBytesAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/CountBytesAttribute.cs new file mode 100644 index 0000000..165784e --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/CountBytesAttribute.cs @@ -0,0 +1,45 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; +using System.Text; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// A value indicating whether the number of bytes should + /// be counted while parsing. Default is false. This will slow down parsing + /// because it needs to get the byte count of every char for the given encoding. + /// The needs to be set correctly for this to be accurate. + /// + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class CountBytesAttribute : Attribute, IClassMapper + { + /// + /// A value indicating whether the number of bytes should + /// be counted while parsing. Default is false. This will slow down parsing + /// because it needs to get the byte count of every char for the given encoding. + /// The needs to be set correctly for this to be accurate. + /// + public bool CountBytes { get; private set; } + + /// + /// A value indicating whether the number of bytes should + /// be counted while parsing. Default is false. This will slow down parsing + /// because it needs to get the byte count of every char for the given encoding. + /// The needs to be set correctly for this to be accurate. + /// + /// + public CountBytesAttribute(bool countBytes) + { + CountBytes = countBytes; + } + + /// + public void ApplyTo(CsvConfiguration configuration) + { + configuration.CountBytes = CountBytes; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/CultureInfoAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/CultureInfoAttribute.cs new file mode 100644 index 0000000..47940fb --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/CultureInfoAttribute.cs @@ -0,0 +1,46 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; +using System.Globalization; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// The used when type converting. + /// This will override the global + /// setting. Or set the same if the attribute is specified on class level. + /// + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + public class CultureInfoAttribute : Attribute, IMemberMapper, IParameterMapper + { + /// + /// Gets the culture info. + /// + public CultureInfo CultureInfo { get; private set; } + + /// + /// The used when type converting. + /// This will override the global + /// setting. Or set the same if the attribute is specified on class level. + /// + /// The culture. + public CultureInfoAttribute(string culture) + { + CultureInfo = CultureInfo.GetCultureInfo(culture); + } + + /// + public void ApplyTo(MemberMap memberMap) + { + memberMap.Data.TypeConverterOptions.CultureInfo = CultureInfo; + } + + /// + public void ApplyTo(ParameterMap parameterMap) + { + parameterMap.Data.TypeConverterOptions.CultureInfo = CultureInfo; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/DateTimeStylesAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/DateTimeStylesAttribute.cs new file mode 100644 index 0000000..42fd789 --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/DateTimeStylesAttribute.cs @@ -0,0 +1,44 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; +using System.Globalization; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// The to use when type converting. + /// This is used when doing any conversions. + /// + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + public class DateTimeStylesAttribute : Attribute, IMemberMapper, IParameterMapper + { + /// + /// Gets the date time styles. + /// + public DateTimeStyles DateTimeStyles { get; private set; } + + /// + /// The to use when type converting. + /// This is used when doing any conversions. + /// + /// The date time styles. + public DateTimeStylesAttribute(DateTimeStyles dateTimeStyles) + { + DateTimeStyles = dateTimeStyles; + } + + /// + public void ApplyTo(MemberMap memberMap) + { + memberMap.Data.TypeConverterOptions.DateTimeStyle = DateTimeStyles; + } + + /// + public void ApplyTo(ParameterMap parameterMap) + { + parameterMap.Data.TypeConverterOptions.DateTimeStyle = DateTimeStyles; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/DefaultAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/DefaultAttribute.cs new file mode 100644 index 0000000..f2e4e46 --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/DefaultAttribute.cs @@ -0,0 +1,45 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// The default value that will be used when reading when + /// the CSV field is empty. + /// + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + public class DefaultAttribute : Attribute, IMemberMapper, IParameterMapper + { + /// + /// Gets the default value. + /// + public object Default { get; private set; } + + /// + /// The default value that will be used when reading when + /// the CSV field is empty. + /// + /// The default value + public DefaultAttribute(object defaultValue) + { + Default = defaultValue; + } + + /// + public void ApplyTo(MemberMap memberMap) + { + memberMap.Data.Default = Default; + memberMap.Data.IsDefaultSet = true; + } + + /// + public void ApplyTo(ParameterMap parameterMap) + { + parameterMap.Data.Default = Default; + parameterMap.Data.IsDefaultSet = true; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/DelimiterAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/DelimiterAttribute.cs new file mode 100644 index 0000000..b8b53f6 --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/DelimiterAttribute.cs @@ -0,0 +1,35 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// The delimiter used to separate fields. + /// + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class DelimiterAttribute : Attribute, IClassMapper + { + /// + /// Gets the delimiter. + /// + public string Delimiter { get; private set; } + + /// + /// The delimiter used to separate fields. + /// + /// The delimiter. + public DelimiterAttribute(string delimiter) + { + Delimiter = delimiter; + } + + /// + public void ApplyTo(CsvConfiguration configuration) + { + configuration.Delimiter = Delimiter; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/DetectColumnCountChangesAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/DetectColumnCountChangesAttribute.cs new file mode 100644 index 0000000..f31aaf8 --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/DetectColumnCountChangesAttribute.cs @@ -0,0 +1,40 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// A value indicating whether changes in the column + /// count should be detected. If true, a + /// will be thrown if a different column count is detected. + /// + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class DetectColumnCountChangesAttribute : Attribute, IClassMapper + { + /// + /// A value indicating whether changes in the column + /// count should be detected. If true, a + /// will be thrown if a different column count is detected. + /// + public bool DetectColumnCountChanges { get; private set; } + + /// + /// A value indicating whether changes in the column + /// count should be detected. If true, a + /// will be thrown if a different column count is detected. + /// + public DetectColumnCountChangesAttribute(bool detectColumnCountChanges) + { + DetectColumnCountChanges = detectColumnCountChanges; + } + + /// + public void ApplyTo(CsvConfiguration configuration) + { + configuration.DetectColumnCountChanges = DetectColumnCountChanges; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/DetectDelimiterAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/DetectDelimiterAttribute.cs new file mode 100644 index 0000000..2c7da45 --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/DetectDelimiterAttribute.cs @@ -0,0 +1,35 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// Detect the delimiter instead of using the delimiter from configuration. + /// Default is false. + /// + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class DetectDelimiterAttribute : Attribute, IClassMapper + { + /// + /// Detect the delimiter instead of using the delimiter from configuration. + /// + public bool DetectDelimiter { get; private set; } + + /// + /// Detect the delimiter instead of using the delimiter from configuration. + /// + public DetectDelimiterAttribute(bool detectDelimiter) + { + DetectDelimiter = detectDelimiter; + } + + /// + public void ApplyTo(CsvConfiguration configuration) + { + configuration.DetectDelimiter = DetectDelimiter; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/DetectDelimiterValuesAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/DetectDelimiterValuesAttribute.cs new file mode 100644 index 0000000..af641df --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/DetectDelimiterValuesAttribute.cs @@ -0,0 +1,37 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; +using System.Text.RegularExpressions; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// The possible delimiter values used when detecting the delimiter. + /// Default is [",", ";", "|", "\t"]. + /// + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class DetectDelimiterValuesAttribute : Attribute, IClassMapper + { + /// + /// The possible delimiter values used when detecting the delimiter. + /// + public string[] DetectDelimiterValues { get; private set; } + + /// + /// The possible delimiter values used when detecting the delimiter. + /// + /// Whitespace separated list of values. + public DetectDelimiterValuesAttribute(string detectDelimiterValues) + { + DetectDelimiterValues = Regex.Split(detectDelimiterValues, @"\s+"); + } + + /// + public void ApplyTo(CsvConfiguration configuration) + { + configuration.DetectDelimiterValues = DetectDelimiterValues; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/EncodingAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/EncodingAttribute.cs new file mode 100644 index 0000000..ee378ba --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/EncodingAttribute.cs @@ -0,0 +1,36 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; +using System.Text; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// The encoding used when counting bytes. + /// + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class EncodingAttribute : Attribute, IClassMapper + { + /// + /// Gets the encoding used when counting bytes. + /// + public Encoding Encoding { get; private set; } + + /// + /// The encoding used when counting bytes. + /// + /// The encoding. + public EncodingAttribute(string encoding) + { + Encoding = Encoding.GetEncoding(encoding); + } + + /// + public void ApplyTo(CsvConfiguration configuration) + { + configuration.Encoding = Encoding; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/EnumIgnoreCaseAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/EnumIgnoreCaseAttribute.cs new file mode 100644 index 0000000..c2b25c9 --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/EnumIgnoreCaseAttribute.cs @@ -0,0 +1,41 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// Ignore case when parsing enums. + /// + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + public class EnumIgnoreCaseAttribute : Attribute, IMemberMapper, IMemberReferenceMapper, IParameterMapper + { + /// + public void ApplyTo(MemberMap memberMap) + { + memberMap.Data.TypeConverterOptions.EnumIgnoreCase = true; + } + + /// + public void ApplyTo(MemberReferenceMap referenceMap) + { + foreach (var memberMap in referenceMap.Data.Mapping.MemberMaps) + { + ApplyTo(memberMap); + } + } + + /// + public void ApplyTo(ParameterMap parameterMap) + { + parameterMap.Data.TypeConverterOptions.EnumIgnoreCase = true; + } + + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/EscapeAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/EscapeAttribute.cs new file mode 100644 index 0000000..0d20d50 --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/EscapeAttribute.cs @@ -0,0 +1,35 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// The escape character used to escape a quote inside a field. + /// + [AttributeUsage( AttributeTargets.Class, AllowMultiple = false, Inherited = true )] + public class EscapeAttribute : Attribute, IClassMapper + { + /// + /// Gets the escape character used to escape a quote inside a field. + /// + public char Escape { get; private set; } + + /// + /// The escape character used to escape a quote inside a field. + /// + /// The escape character. + public EscapeAttribute( char escape ) + { + Escape = escape; + } + + /// + public void ApplyTo(CsvConfiguration configuration) + { + configuration.Escape = Escape; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/ExceptionMessagesContainRawDataAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/ExceptionMessagesContainRawDataAttribute.cs new file mode 100644 index 0000000..2cb9608 --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/ExceptionMessagesContainRawDataAttribute.cs @@ -0,0 +1,39 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// A value indicating if exception messages contain raw CSV data. + /// true if exception contain raw CSV data, otherwise false. + /// Default is true. + /// + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class ExceptionMessagesContainRawDataAttribute : Attribute, IClassMapper + { + /// + /// A value indicating if exception messages contain raw CSV data. + /// true if exception contain raw CSV data, otherwise false. + /// + public bool ExceptionMessagesContainRawData { get; private set; } + + /// + /// A value indicating if exception messages contain raw CSV data. + /// true if exception contain raw CSV data, otherwise false. + /// + /// + public ExceptionMessagesContainRawDataAttribute(bool exceptionMessagesContainRawData) + { + ExceptionMessagesContainRawData = exceptionMessagesContainRawData; + } + + /// + public void ApplyTo(CsvConfiguration configuration) + { + configuration.ExceptionMessagesContainRawData = ExceptionMessagesContainRawData; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/FormatAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/FormatAttribute.cs new file mode 100644 index 0000000..b42d8ed --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/FormatAttribute.cs @@ -0,0 +1,50 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// The string format to be used when type converting. + /// + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + public class FormatAttribute : Attribute, IMemberMapper, IParameterMapper + { + /// + /// Gets the formats. + /// + public string[] Formats { get; private set; } + + /// + /// The string format to be used when type converting. + /// + /// The format. + public FormatAttribute(string format) + { + Formats = new string[] { format }; + } + + /// + /// The string format to be used when type converting. + /// + /// The formats. + public FormatAttribute(params string[] formats) + { + Formats = formats; + } + + /// + public void ApplyTo(MemberMap memberMap) + { + memberMap.Data.TypeConverterOptions.Formats = Formats; + } + + /// + public void ApplyTo(ParameterMap parameterMap) + { + parameterMap.Data.TypeConverterOptions.Formats = Formats; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/HasHeaderRecordAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/HasHeaderRecordAttribute.cs new file mode 100644 index 0000000..b0d93ae --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/HasHeaderRecordAttribute.cs @@ -0,0 +1,35 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// A value indicating if the CSV file has a header record. + /// + [AttributeUsage( AttributeTargets.Class, AllowMultiple = false, Inherited = true )] + public class HasHeaderRecordAttribute : Attribute, IClassMapper + { + /// + /// Gets a value indicating if the CSV file has a header record. + /// + public bool HasHeaderRecord { get; private set; } + + /// + /// A value indicating if the CSV file has a header record. + /// + /// A value indicating if the CSV file has a header record. + public HasHeaderRecordAttribute( bool hasHeaderRecord ) + { + HasHeaderRecord = hasHeaderRecord; + } + + /// + public void ApplyTo(CsvConfiguration configuration) + { + configuration.HasHeaderRecord = HasHeaderRecord; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/HeaderPrefixAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/HeaderPrefixAttribute.cs new file mode 100644 index 0000000..4ae8227 --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/HeaderPrefixAttribute.cs @@ -0,0 +1,73 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// Appends a prefix to the header of each field of the reference member. + /// + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + public class HeaderPrefixAttribute : Attribute, IMemberReferenceMapper, IParameterReferenceMapper + { + /// + /// Gets the prefix. + /// + public string? Prefix { get; private set; } + + /// + /// Gets a value indicating if the prefix should inherit parent prefixes. + /// + public bool Inherit { get; private set; } + + /// + /// Appends a prefix to the header of each field of the reference member. + /// + public HeaderPrefixAttribute() { } + + /// + /// Appends a prefix to the header of each field of the reference member. + /// + /// The prefix. + public HeaderPrefixAttribute(string prefix) + { + Prefix = prefix; + } + + /// + /// Appends a prefix to the header of each field of the reference member. + /// + /// Inherits parent object prefixes. + public HeaderPrefixAttribute(bool inherit) + { + Inherit = inherit; + } + + /// + /// Appends a prefix to the header of each field of the reference member. + /// + /// The prefix. + /// Inherits parent object prefixes. + public HeaderPrefixAttribute(string prefix, bool inherit) + { + Prefix = prefix; + Inherit = inherit; + } + + /// + public void ApplyTo(MemberReferenceMap referenceMap) + { + referenceMap.Data.Inherit = Inherit; + referenceMap.Data.Prefix = Prefix ?? referenceMap.Data.Member.Name + "."; + } + + /// + public void ApplyTo(ParameterReferenceMap referenceMap) + { + referenceMap.Data.Inherit = Inherit; + referenceMap.Data.Prefix = Prefix ?? referenceMap.Data.Parameter.Name + "."; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IClassMapper.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IClassMapper.cs new file mode 100644 index 0000000..d395ac9 --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IClassMapper.cs @@ -0,0 +1,19 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// Defines methods to enable pluggable configuration. + /// + public interface IClassMapper + { + /// + /// Applies configuration. + /// + /// The configuration to apply to. + void ApplyTo(CsvConfiguration configuration); + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IMemberMapper.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IMemberMapper.cs new file mode 100644 index 0000000..b8701f1 --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IMemberMapper.cs @@ -0,0 +1,20 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// Defines methods to enable pluggable configuration of member mapping. + /// + public interface IMemberMapper + { + /// + /// Applies configuration to the given . + /// + /// The member map. + void ApplyTo(MemberMap memberMap); + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IMemberReferenceMapper.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IMemberReferenceMapper.cs new file mode 100644 index 0000000..c9c4d32 --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IMemberReferenceMapper.cs @@ -0,0 +1,20 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// Defines methods to enable pluggable configuration of member reference mapping. + /// + public interface IMemberReferenceMapper + { + /// + /// Applies configuration to the given . + /// + /// The reference map. + void ApplyTo(MemberReferenceMap referenceMap); + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IParameterMapper.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IParameterMapper.cs new file mode 100644 index 0000000..0b5c289 --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IParameterMapper.cs @@ -0,0 +1,24 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// Defines methods to enable pluggable configuration of parameter mapping. + /// + public interface IParameterMapper + { + /// + /// Applies configuration to the given . + /// + /// The parameter map. + void ApplyTo(ParameterMap parameterMap); + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IParameterReferenceMapper.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IParameterReferenceMapper.cs new file mode 100644 index 0000000..ea4fc50 --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IParameterReferenceMapper.cs @@ -0,0 +1,24 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// Defines methods to enable pluggable configuration of parameter reference mapping. + /// + public interface IParameterReferenceMapper + { + /// + /// Applies configuration to the given . + /// + /// The reference map. + void ApplyTo(ParameterReferenceMap referenceMap); + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IgnoreAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IgnoreAttribute.cs new file mode 100644 index 0000000..41a199a --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IgnoreAttribute.cs @@ -0,0 +1,41 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; +using System.Reflection; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// Ignore the member when reading and writing. + /// If this member has already been mapped as a reference + /// member, either by a class map, or by automapping, calling + /// this method will not ignore all the child members down the + /// tree that have already been mapped. + /// + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + public class IgnoreAttribute : Attribute, IMemberMapper, IMemberReferenceMapper, IParameterMapper + { + /// + public void ApplyTo(MemberMap memberMap) + { + memberMap.Data.Ignore = true; + } + + /// + public void ApplyTo(MemberReferenceMap referenceMap) + { + foreach (var memberMap in referenceMap.Data.Mapping.MemberMaps) + { + ApplyTo(memberMap); + } + } + + /// + public void ApplyTo(ParameterMap parameterMap) + { + parameterMap.Data.Ignore = true; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IgnoreBaseAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IgnoreBaseAttribute.cs new file mode 100644 index 0000000..066be2e --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IgnoreBaseAttribute.cs @@ -0,0 +1,20 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// Ignores base classes when auto mapping. + /// + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class IgnoreBaseAttribute : Attribute + { + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IgnoreBlankLinesAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IgnoreBlankLinesAttribute.cs new file mode 100644 index 0000000..c270568 --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IgnoreBlankLinesAttribute.cs @@ -0,0 +1,35 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// A value indicating if blank lines should be ignored when reading. + /// + [AttributeUsage( AttributeTargets.Class, AllowMultiple = false, Inherited = true )] + public class IgnoreBlankLinesAttribute : Attribute, IClassMapper + { + /// + /// Gets a value indicating if blank lines should be ignored when reading. + /// + public bool IgnoreBlankLines { get; private set; } + + /// + /// A value indicating if blank lines should be ignored when reading. + /// + /// The Ignore Blank Lines Flag. + public IgnoreBlankLinesAttribute( bool ignoreBlankLines ) + { + IgnoreBlankLines = ignoreBlankLines; + } + + /// + public void ApplyTo(CsvConfiguration configuration) + { + configuration.IgnoreBlankLines = IgnoreBlankLines; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IgnoreReferencesAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IgnoreReferencesAttribute.cs new file mode 100644 index 0000000..05e7b0e --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IgnoreReferencesAttribute.cs @@ -0,0 +1,41 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// Gets a value indicating whether references + /// should be ignored when auto mapping. true to ignore + /// references, otherwise false. Default is false. + /// + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class IgnoreReferencesAttribute : Attribute, IClassMapper + { + /// + /// Gets a value indicating whether references + /// should be ignored when auto mapping. true to ignore + /// references, otherwise false. Default is false. + /// + public bool IgnoreReferences { get; private set; } + + /// + /// Gets a value indicating whether references + /// should be ignored when auto mapping. true to ignore + /// references, otherwise false. Default is false. + /// + /// Ignore references value. + public IgnoreReferencesAttribute(bool ignoreReferences) + { + IgnoreReferences = ignoreReferences; + } + + /// + public void ApplyTo(CsvConfiguration configuration) + { + configuration.IgnoreReferences = IgnoreReferences; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IncludePrivateMembersAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IncludePrivateMembersAttribute.cs new file mode 100644 index 0000000..92c7c1b --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IncludePrivateMembersAttribute.cs @@ -0,0 +1,35 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// A value indicating if private member should be read from and written to. + /// + [AttributeUsage( AttributeTargets.Class, AllowMultiple = false, Inherited = true )] + public class IncludePrivateMembersAttribute : Attribute, IClassMapper + { + /// + /// Gets a value indicating if private member should be read from and written to. + /// + public bool IncludePrivateMembers { get; private set; } + + /// + /// A value indicating if private member should be read from and written to. + /// + /// The Include Private Members Flag. + public IncludePrivateMembersAttribute( bool includePrivateMembers ) + { + IncludePrivateMembers = includePrivateMembers; + } + + /// + public void ApplyTo(CsvConfiguration configuration) + { + configuration.IncludePrivateMembers = IncludePrivateMembers; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IndexAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IndexAttribute.cs new file mode 100644 index 0000000..e469741 --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/IndexAttribute.cs @@ -0,0 +1,57 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// When reading, is used to get the field at + /// the given index. When writing, the fields + /// will be written in the order of the field + /// indexes. + /// + [AttributeUsage( AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true )] + public class IndexAttribute : Attribute, IMemberMapper, IParameterMapper + { + /// + /// Gets the index. + /// + public int Index { get; private set; } + + /// + /// Gets the index end. + /// + public int IndexEnd { get; private set; } + + /// + /// When reading, is used to get the field at + /// the given index. When writing, the fields + /// will be written in the order of the field + /// indexes. + /// + /// The index. + /// The index end. + public IndexAttribute( int index, int indexEnd = -1 ) + { + Index = index; + IndexEnd = indexEnd; + } + + /// + public void ApplyTo(MemberMap memberMap) + { + memberMap.Data.Index = Index; + memberMap.Data.IndexEnd = IndexEnd; + memberMap.Data.IsIndexSet = true; + } + + /// + public void ApplyTo(ParameterMap parameterMap) + { + parameterMap.Data.Index = Index; + parameterMap.Data.IsIndexSet = true; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/InjectionCharactersAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/InjectionCharactersAttribute.cs new file mode 100644 index 0000000..66f6964 --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/InjectionCharactersAttribute.cs @@ -0,0 +1,37 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; +using System.Linq; +using System.Text.RegularExpressions; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// Gets the characters that are used for injection attacks. + /// + public class InjectionCharactersAttribute : Attribute, IClassMapper + { + /// + /// Gets the characters that are used for injection attacks. + /// Default is '=', '@', '+', '-', '\t', '\r'. + /// + public char[] InjectionCharacters { get; private set; } + + /// + /// Gets the characters that are used for injection attacks. + /// + /// + public InjectionCharactersAttribute(string injectionCharacters) + { + InjectionCharacters = Regex.Split(injectionCharacters, @"\s+").Select(s => s[0]).ToArray(); + } + + /// + public void ApplyTo(CsvConfiguration configuration) + { + configuration.InjectionCharacters = InjectionCharacters; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/InjectionEscapeCharacterAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/InjectionEscapeCharacterAttribute.cs new file mode 100644 index 0000000..1db163d --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/InjectionEscapeCharacterAttribute.cs @@ -0,0 +1,35 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// The character used to escape a detected injection. + /// + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class InjectionEscapeCharacterAttribute : Attribute, IClassMapper + { + /// + /// The character used to escape a detected injection. + /// + public char InjectionEscapeCharacter { get; private set; } + + /// + /// The character used to escape a detected injection. + /// + /// + public InjectionEscapeCharacterAttribute(char injectionEscapeCharacter) + { + InjectionEscapeCharacter = injectionEscapeCharacter; + } + + /// + public void ApplyTo(CsvConfiguration configuration) + { + configuration.InjectionEscapeCharacter = InjectionEscapeCharacter; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/InjectionOptionsAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/InjectionOptionsAttribute.cs new file mode 100644 index 0000000..db97300 --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/InjectionOptionsAttribute.cs @@ -0,0 +1,35 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// The injection options. + /// + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class InjectionOptionsAttribute : Attribute, IClassMapper + { + /// + /// The injection options. + /// + public InjectionOptions InjectionOptions { get; private set; } + + /// + /// The injection options. + /// + /// + public InjectionOptionsAttribute(InjectionOptions injectionOptions) + { + InjectionOptions = injectionOptions; + } + + /// + public void ApplyTo(CsvConfiguration configuration) + { + configuration.InjectionOptions = InjectionOptions; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/LineBreakInQuotedFieldIsBadDataAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/LineBreakInQuotedFieldIsBadDataAttribute.cs new file mode 100644 index 0000000..db95cbc --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/LineBreakInQuotedFieldIsBadDataAttribute.cs @@ -0,0 +1,39 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// A value indicating if a line break found in a quote field should + /// be considered bad data. true to consider a line break bad data, otherwise false. + /// Defaults to false. + /// + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class LineBreakInQuotedFieldIsBadDataAttribute : Attribute, IClassMapper + { + /// + /// A value indicating if a line break found in a quote field should + /// be considered bad data. true to consider a line break bad data, otherwise false. + /// + public bool LineBreakInQuotedFieldIsBadData { get; private set; } + + /// + /// A value indicating if a line break found in a quote field should + /// be considered bad data. true to consider a line break bad data, otherwise false. + /// + /// + public LineBreakInQuotedFieldIsBadDataAttribute(bool lineBreakInQuotedFieldIsBadData) + { + LineBreakInQuotedFieldIsBadData = lineBreakInQuotedFieldIsBadData; + } + + /// + public void ApplyTo(CsvConfiguration configuration) + { + configuration.LineBreakInQuotedFieldIsBadData = LineBreakInQuotedFieldIsBadData; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/MaxFieldSizeAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/MaxFieldSizeAttribute.cs new file mode 100644 index 0000000..1d5c837 --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/MaxFieldSizeAttribute.cs @@ -0,0 +1,40 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// Gets or sets the maximum size of a field. + /// Defaults to 0, indicating maximum field size is not checked. + /// + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class MaxFieldSizeAttribute : Attribute, IClassMapper + { + /// + /// Gets or sets the maximum size of a field. + /// + public double MaxFieldSize { get; private set; } + + /// + /// Gets or sets the maximum size of a field. + /// + /// + public MaxFieldSizeAttribute(double maxFieldSize) + { + MaxFieldSize = maxFieldSize; + } + + /// + public void ApplyTo(CsvConfiguration configuration) + { + configuration.MaxFieldSize = MaxFieldSize; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/MemberTypesAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/MemberTypesAttribute.cs new file mode 100644 index 0000000..e07e86f --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/MemberTypesAttribute.cs @@ -0,0 +1,40 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// The member types that are used when auto mapping. + /// MemberTypes are flags, so you can choose more than one. + /// Default is Properties. + /// + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class MemberTypesAttribute : Attribute, IClassMapper + { + /// + /// The member types that are used when auto mapping. + /// MemberTypes are flags, so you can choose more than one. + /// Default is Properties. + /// + public MemberTypes MemberTypes { get; private set; } + + /// + /// The member types that are used when auto mapping. + /// MemberTypes are flags, so you can choose more than one. + /// Default is Properties. + /// + public MemberTypesAttribute(MemberTypes memberTypes) + { + MemberTypes = memberTypes; + } + + /// + public void ApplyTo(CsvConfiguration configuration) + { + configuration.MemberTypes = MemberTypes; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/ModeAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/ModeAttribute.cs new file mode 100644 index 0000000..448a543 --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/ModeAttribute.cs @@ -0,0 +1,38 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// The mode. + /// See for more details. + /// + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class ModeAttribute : Attribute, IClassMapper + { + /// + /// The mode. + /// See for more details. + /// + public CsvMode Mode { get; private set; } + + /// + /// The mode. + /// See for more details. + /// + /// + public ModeAttribute(CsvMode mode) + { + Mode = mode; + } + + /// + public void ApplyTo(CsvConfiguration configuration) + { + configuration.Mode = Mode; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/NameAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/NameAttribute.cs new file mode 100644 index 0000000..f1220e4 --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/NameAttribute.cs @@ -0,0 +1,77 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// When reading, is used to get the field + /// at the index of the name if there was a + /// header specified. It will look for the + /// first name match in the order listed. + /// When writing, sets the name of the + /// field in the header record. + /// The first name will be used. + /// + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + public class NameAttribute : Attribute, IMemberMapper, IParameterMapper + { + /// + /// Gets the names. + /// + public string[] Names { get; private set; } + + /// + /// When reading, is used to get the field + /// at the index of the name if there was a + /// header specified. It will look for the + /// first name match in the order listed. + /// When writing, sets the name of the + /// field in the header record. + /// The first name will be used. + /// + /// The name + public NameAttribute(string name) + { + Names = new string[] { name }; + } + + /// + /// When reading, is used to get the field + /// at the index of the name if there was a + /// header specified. It will look for the + /// first name match in the order listed. + /// When writing, sets the name of the + /// field in the header record. + /// The first name will be used. + /// + /// The names. + public NameAttribute(params string[] names) + { + if (names == null || names.Length == 0) + { + throw new ArgumentNullException(nameof(names)); + } + + Names = names; + } + + /// + public void ApplyTo(MemberMap memberMap) + { + memberMap.Data.Names.Clear(); + memberMap.Data.Names.AddRange(Names); + memberMap.Data.IsNameSet = true; + } + + /// + public void ApplyTo(ParameterMap parameterMap) + { + parameterMap.Data.Names.Clear(); + parameterMap.Data.Names.AddRange(Names); + parameterMap.Data.IsNameSet = true; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/NameIndexAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/NameIndexAttribute.cs new file mode 100644 index 0000000..e3d1dfa --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/NameIndexAttribute.cs @@ -0,0 +1,45 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// When reading, is used to get the + /// index of the name used when there + /// are multiple names that are the same. + /// + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + public class NameIndexAttribute : Attribute, IMemberMapper, IParameterMapper + { + /// + /// The name index. + /// + public int NameIndex { get; private set; } + + /// + /// When reading, is used to get the + /// index of the name used when there + /// are multiple names that are the same. + /// + /// The name index. + public NameIndexAttribute(int nameIndex) + { + NameIndex = nameIndex; + } + + /// + public void ApplyTo(MemberMap memberMap) + { + memberMap.Data.NameIndex = NameIndex; + } + + /// + public void ApplyTo(ParameterMap parameterMap) + { + parameterMap.Data.NameIndex = NameIndex; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/NewLineAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/NewLineAttribute.cs new file mode 100644 index 0000000..a2bdbd2 --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/NewLineAttribute.cs @@ -0,0 +1,39 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// The newline string to use. Default is \r\n (CRLF). + /// When writing, this value is always used. + /// When reading, this value is only used if explicitly set. + /// If not set, the parser uses one of \r\n, \r, or \n. + /// + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class NewLineAttribute : Attribute, IClassMapper + { + /// The newline string to use. Default is \r\n (CRLF). + /// When writing, this value is always used. + /// When reading, this value is only used if explicitly set. + /// If not set, the parser uses one of \r\n, \r, or \n. + public string NewLine { get; private set; } + + /// The newline string to use. Default is \r\n (CRLF). + /// When writing, this value is always used. + /// When reading, this value is only used if explicitly set. + /// If not set, the parser uses one of \r\n, \r, or \n. + public NewLineAttribute(string newLine) + { + NewLine = newLine; + } + + /// + public void ApplyTo(CsvConfiguration configuration) + { + configuration.NewLine = NewLine; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/NullValuesAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/NullValuesAttribute.cs new file mode 100644 index 0000000..8c87e28 --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/NullValuesAttribute.cs @@ -0,0 +1,52 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// The string values used to represent null when converting. + /// + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + public class NullValuesAttribute : Attribute, IMemberMapper, IParameterMapper + { + /// + /// Gets the null values. + /// + public string[] NullValues { get; private set; } + + /// + /// The string values used to represent null when converting. + /// + /// The null values. + public NullValuesAttribute(string nullValue) + { + NullValues = new string[] { nullValue }; + } + + /// + /// The string values used to represent null when converting. + /// + /// The null values. + public NullValuesAttribute(params string[] nullValues) + { + NullValues = nullValues; + } + + /// + public void ApplyTo(MemberMap memberMap) + { + memberMap.Data.TypeConverterOptions.NullValues.Clear(); + memberMap.Data.TypeConverterOptions.NullValues.AddRange(NullValues); + } + + /// + public void ApplyTo(ParameterMap parameterMap) + { + parameterMap.Data.TypeConverterOptions.NullValues.Clear(); + parameterMap.Data.TypeConverterOptions.NullValues.AddRange(NullValues); + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/NumberStylesAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/NumberStylesAttribute.cs new file mode 100644 index 0000000..1cd37fb --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/NumberStylesAttribute.cs @@ -0,0 +1,44 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; +using System.Globalization; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// The to use when type converting. + /// This is used when doing any number conversions. + /// + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + public class NumberStylesAttribute : Attribute, IMemberMapper, IParameterMapper + { + /// + /// Gets the number styles. + /// + public NumberStyles NumberStyles { get; private set; } + + /// + /// The to use when type converting. + /// This is used when doing any number conversions. + /// + /// The number styles. + public NumberStylesAttribute(NumberStyles numberStyles) + { + NumberStyles = numberStyles; + } + + /// + public void ApplyTo(MemberMap memberMap) + { + memberMap.Data.TypeConverterOptions.NumberStyles = NumberStyles; + } + + /// + public void ApplyTo(ParameterMap parameterMap) + { + parameterMap.Data.TypeConverterOptions.NumberStyles = NumberStyles; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/OptionalAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/OptionalAttribute.cs new file mode 100644 index 0000000..5348c85 --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/OptionalAttribute.cs @@ -0,0 +1,27 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// Ignore the member when reading if no matching field name can be found. + /// + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + public class OptionalAttribute : Attribute, IMemberMapper, IParameterMapper + { + /// + public void ApplyTo(MemberMap memberMap) + { + memberMap.Data.IsOptional = true; + } + + /// + public void ApplyTo(ParameterMap parameterMap) + { + parameterMap.Data.IsOptional = true; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/ProcessFieldBufferSizeAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/ProcessFieldBufferSizeAttribute.cs new file mode 100644 index 0000000..81f6178 --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/ProcessFieldBufferSizeAttribute.cs @@ -0,0 +1,36 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// The size of the buffer used when processing fields. + /// Default is 1024. + /// + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class ProcessFieldBufferSizeAttribute : Attribute, IClassMapper + { + /// + /// The size of the buffer used when processing fields. + /// + public int ProcessFieldBufferSize { get; private set; } + + /// + /// The size of the buffer used when processing fields. + /// + /// + public ProcessFieldBufferSizeAttribute(int processFieldBufferSize) + { + ProcessFieldBufferSize = processFieldBufferSize; + } + + /// + public void ApplyTo(CsvConfiguration configuration) + { + configuration.ProcessFieldBufferSize = ProcessFieldBufferSize; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/QuoteAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/QuoteAttribute.cs new file mode 100644 index 0000000..93b5887 --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/QuoteAttribute.cs @@ -0,0 +1,35 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// The character used to quote fields. + /// + [AttributeUsage( AttributeTargets.Class, AllowMultiple = false, Inherited = true )] + public class QuoteAttribute : Attribute, IClassMapper + { + /// + /// Gets the character used to quote fields. + /// + public char Quote { get; private set; } + + /// + /// The character used to quote fields. + /// + /// The quote character. + public QuoteAttribute( char quote ) + { + Quote = quote; + } + + /// + public void ApplyTo(CsvConfiguration configuration) + { + configuration.Quote = Quote; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/TrimOptionsAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/TrimOptionsAttribute.cs new file mode 100644 index 0000000..1b2f645 --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/TrimOptionsAttribute.cs @@ -0,0 +1,35 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// The fields trimming options. + /// + [AttributeUsage( AttributeTargets.Class, AllowMultiple = false, Inherited = true )] + public class TrimOptionsAttribute : Attribute, IClassMapper + { + /// + /// Gets the fields trimming options. + /// + public TrimOptions TrimOptions { get; private set; } + + /// + /// The fields trimming options. + /// + /// The TrimOptions. + public TrimOptionsAttribute( TrimOptions trimOptions ) + { + TrimOptions = trimOptions; + } + + /// + public void ApplyTo(CsvConfiguration configuration) + { + configuration.TrimOptions = TrimOptions; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/TypeConverterAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/TypeConverterAttribute.cs new file mode 100644 index 0000000..f3900ec --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/TypeConverterAttribute.cs @@ -0,0 +1,57 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using CsvHelper.TypeConversion; +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// Specifies the to use + /// when converting the member to and from a CSV field. + /// + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + public class TypeConverterAttribute : Attribute, IMemberMapper, IParameterMapper + { + /// + /// Gets the type converter. + /// + public ITypeConverter TypeConverter { get; private set; } + + /// + /// Specifies the to use + /// when converting the member to and from a CSV field. + /// + /// The type of the . + public TypeConverterAttribute(Type typeConverterType) : this(typeConverterType, new object[0]) { } + + /// + /// Specifies the to use + /// when converting the member to and from a CSV field. + /// + /// The type of the . + /// Type constructor arguments for the type converter. + public TypeConverterAttribute(Type typeConverterType, params object[] constructorArgs) + { + if (typeConverterType == null) + { + throw new ArgumentNullException(nameof(typeConverterType)); + } + + TypeConverter = ObjectResolver.Current.Resolve(typeConverterType, constructorArgs) as ITypeConverter ?? throw new ArgumentException($"Type '{typeConverterType.FullName}' does not implement {nameof(ITypeConverter)}"); + } + + /// + public void ApplyTo(MemberMap memberMap) + { + memberMap.Data.TypeConverter = TypeConverter; + } + + /// + public void ApplyTo(ParameterMap parameterMap) + { + parameterMap.Data.TypeConverter = TypeConverter; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/UseNewObjectForNullReferenceMembersAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/UseNewObjectForNullReferenceMembersAttribute.cs new file mode 100644 index 0000000..6bfbf37 --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/UseNewObjectForNullReferenceMembersAttribute.cs @@ -0,0 +1,47 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// Gets a value indicating that during writing if a new + /// object should be created when a reference member is null. + /// True to create a new object and use it's defaults for the + /// fields, or false to leave the fields empty for all the + /// reference member's member. + /// + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class UseNewObjectForNullReferenceMembersAttribute : Attribute, IClassMapper + { + /// + /// Gets a value indicating that during writing if a new + /// object should be created when a reference member is null. + /// True to create a new object and use it's defaults for the + /// fields, or false to leave the fields empty for all the + /// reference member's member. + /// + public bool UseNewObjectForNullReferenceMembers { get; private set; } + + /// + /// Gets a value indicating that during writing if a new + /// object should be created when a reference member is null. + /// True to create a new object and use it's defaults for the + /// fields, or false to leave the fields empty for all the + /// reference member's member. + /// + /// The value. + public UseNewObjectForNullReferenceMembersAttribute(bool useNewObjectForNullReferenceMembers) + { + UseNewObjectForNullReferenceMembers = useNewObjectForNullReferenceMembers; + } + + /// + public void ApplyTo(CsvConfiguration configuration) + { + configuration.UseNewObjectForNullReferenceMembers = UseNewObjectForNullReferenceMembers; + } + } +} diff --git a/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/WhiteSpaceCharsAttribute.cs b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/WhiteSpaceCharsAttribute.cs new file mode 100644 index 0000000..ef8f7cb --- /dev/null +++ b/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes/WhiteSpaceCharsAttribute.cs @@ -0,0 +1,41 @@ +// Copyright 2009-2022 Josh Close +// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. +// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. +// https://github.com/JoshClose/CsvHelper +using System; +using System.Linq; +using System.Text.RegularExpressions; + +namespace CsvHelper.Configuration.Attributes +{ + /// + /// Characters considered whitespace. + /// Used when trimming fields. + /// Default is [' ']. + /// + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class WhiteSpaceCharsAttribute : Attribute, IClassMapper + { + /// + /// Characters considered whitespace. + /// Used when trimming fields. + /// + public char[] WhiteSpaceChars { get; private set; } + + /// + /// Characters considered whitespace. + /// Used when trimming fields. + /// + /// + public WhiteSpaceCharsAttribute(string whiteSpaceChars) + { + WhiteSpaceChars = Regex.Split(whiteSpaceChars, @"\s").Select(s => s[0]).ToArray(); + } + + /// + public void ApplyTo(CsvConfiguration configuration) + { + configuration.WhiteSpaceChars = WhiteSpaceChars; + } + } +} -- cgit v1.1-26-g67d0