diff options
Diffstat (limited to 'ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/Attributes')
52 files changed, 2065 insertions, 0 deletions
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 +{ + /// <summary> + /// A value indicating if comments are allowed. + /// </summary> + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class AllowCommentsAttribute : Attribute, IClassMapper + { + /// <summary> + /// Gets a value indicating if comments are allowed. + /// </summary> + public bool AllowComments { get; private set; } + + /// <summary> + /// A value indicating if comments are allowed. + /// </summary> + /// <param name="allowComments">The value indicating id comments are allowed.</param> + public AllowCommentsAttribute(bool allowComments) + { + AllowComments = allowComments; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// The string values used to represent a boolean false when converting. + /// </summary> + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + public class BooleanFalseValuesAttribute : Attribute, IMemberMapper, IParameterMapper + { + /// <summary> + /// Gets the false values. + /// </summary> + public string[] FalseValues { get; private set; } + + /// <summary> + /// The string values used to represent a boolean false when converting. + /// </summary> + /// <param name="falseValue">The false values.</param> + public BooleanFalseValuesAttribute(string falseValue) + { + FalseValues = new string[] { falseValue }; + } + + /// <summary> + /// The string values used to represent a boolean false when converting. + /// </summary> + /// <param name="falseValues">The false values.</param> + public BooleanFalseValuesAttribute(params string[] falseValues) + { + FalseValues = falseValues; + } + + /// <inheritdoc /> + public void ApplyTo(MemberMap memberMap) + { + memberMap.Data.TypeConverterOptions.BooleanFalseValues.Clear(); + memberMap.Data.TypeConverterOptions.BooleanFalseValues.AddRange(FalseValues); + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// The string values used to represent a boolean true when converting. + /// </summary> + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + public class BooleanTrueValuesAttribute : Attribute, IMemberMapper, IParameterMapper + { + /// <summary> + /// Gets the true values. + /// </summary> + public string[] TrueValues { get; private set; } + + /// <summary> + /// The string values used to represent a boolean true when converting. + /// </summary> + /// <param name="trueValue"></param> + public BooleanTrueValuesAttribute(string trueValue) + { + TrueValues = new string[] { trueValue }; + } + + /// <summary> + /// The string values used to represent a boolean true when converting. + /// </summary> + /// <param name="trueValues"></param> + public BooleanTrueValuesAttribute(params string[] trueValues) + { + TrueValues = trueValues; + } + + /// <inheritdoc /> + public void ApplyTo(MemberMap memberMap) + { + memberMap.Data.TypeConverterOptions.BooleanTrueValues.Clear(); + memberMap.Data.TypeConverterOptions.BooleanTrueValues.AddRange(TrueValues); + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// The size of the buffer used for parsing and writing CSV files. + /// Default is 0x1000. + /// </summary> + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class BufferSizeAttribute : Attribute, IClassMapper + { + /// <summary> + /// The buffer size. + /// </summary> + public int BufferSize { get; private set; } + + /// <summary> + /// The size of the buffer used for parsing and writing CSV files. + /// </summary> + /// <param name="bufferSize"></param> + public BufferSizeAttribute(int bufferSize) + { + BufferSize = bufferSize; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// Cache fields that are created when parsing. + /// Default is false. + /// </summary> + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class CacheFieldsAttribute : Attribute, IClassMapper + { + /// <summary> + /// Cache fields that are created when parsing. + /// </summary> + public bool CacheFields { get; private set; } + + /// <summary> + /// Cache fields that are created when parsing. + /// </summary> + /// <param name="cacheFields"></param> + public CacheFieldsAttribute(bool cacheFields) + { + CacheFields = cacheFields; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// The character used to denote a line that is commented out. + /// Default is #. + /// </summary> + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class CommentAttribute : Attribute, IClassMapper + { + /// <summary> + /// Gets the character used to denote a line that is commented out. + /// </summary> + public char Comment { get; private set; } + + /// <summary> + /// The character used to denote a line that is commented out. + /// </summary> + /// <param name="comment">The comment character.</param> + public CommentAttribute(char comment) + { + Comment = comment; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// 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. + /// </summary> + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + public class ConstantAttribute : Attribute, IMemberMapper, IParameterMapper + { + /// <summary> + /// Gets the constant. + /// </summary> + public object Constant { get; private set; } + + /// <summary> + /// 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. + /// </summary> + /// <param name="constant">The constant.</param> + public ConstantAttribute(object constant) + { + Constant = constant; + } + + /// <inheritdoc /> + public void ApplyTo(MemberMap memberMap) + { + memberMap.Data.Constant = Constant; + memberMap.Data.IsConstantSet = true; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// 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 <see cref="Encoding"/> needs to be set correctly for this to be accurate. + /// </summary> + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class CountBytesAttribute : Attribute, IClassMapper + { + /// <summary> + /// 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 <see cref="Encoding"/> needs to be set correctly for this to be accurate. + /// </summary> + public bool CountBytes { get; private set; } + + /// <summary> + /// 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 <see cref="Encoding"/> needs to be set correctly for this to be accurate. + /// </summary> + /// <param name="countBytes"></param> + public CountBytesAttribute(bool countBytes) + { + CountBytes = countBytes; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// The <see cref="CultureInfo"/> used when type converting. + /// This will override the global <see cref="CsvConfiguration.CultureInfo"/> + /// setting. Or set the same if the attribute is specified on class level. + /// </summary> + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + public class CultureInfoAttribute : Attribute, IMemberMapper, IParameterMapper + { + /// <summary> + /// Gets the culture info. + /// </summary> + public CultureInfo CultureInfo { get; private set; } + + /// <summary> + /// The <see cref="CultureInfo"/> used when type converting. + /// This will override the global <see cref="CsvConfiguration.CultureInfo"/> + /// setting. Or set the same if the attribute is specified on class level. + /// </summary> + /// <param name="culture">The culture.</param> + public CultureInfoAttribute(string culture) + { + CultureInfo = CultureInfo.GetCultureInfo(culture); + } + + /// <inheritdoc /> + public void ApplyTo(MemberMap memberMap) + { + memberMap.Data.TypeConverterOptions.CultureInfo = CultureInfo; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// The <see cref="DateTimeStyles"/> to use when type converting. + /// This is used when doing any <see cref="DateTime"/> conversions. + /// </summary> + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + public class DateTimeStylesAttribute : Attribute, IMemberMapper, IParameterMapper + { + /// <summary> + /// Gets the date time styles. + /// </summary> + public DateTimeStyles DateTimeStyles { get; private set; } + + /// <summary> + /// The <see cref="DateTimeStyles"/> to use when type converting. + /// This is used when doing any <see cref="DateTime"/> conversions. + /// </summary> + /// <param name="dateTimeStyles">The date time styles.</param> + public DateTimeStylesAttribute(DateTimeStyles dateTimeStyles) + { + DateTimeStyles = dateTimeStyles; + } + + /// <inheritdoc /> + public void ApplyTo(MemberMap memberMap) + { + memberMap.Data.TypeConverterOptions.DateTimeStyle = DateTimeStyles; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// The default value that will be used when reading when + /// the CSV field is empty. + /// </summary> + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + public class DefaultAttribute : Attribute, IMemberMapper, IParameterMapper + { + /// <summary> + /// Gets the default value. + /// </summary> + public object Default { get; private set; } + + /// <summary> + /// The default value that will be used when reading when + /// the CSV field is empty. + /// </summary> + /// <param name="defaultValue">The default value</param> + public DefaultAttribute(object defaultValue) + { + Default = defaultValue; + } + + /// <inheritdoc /> + public void ApplyTo(MemberMap memberMap) + { + memberMap.Data.Default = Default; + memberMap.Data.IsDefaultSet = true; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// The delimiter used to separate fields. + /// </summary> + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class DelimiterAttribute : Attribute, IClassMapper + { + /// <summary> + /// Gets the delimiter. + /// </summary> + public string Delimiter { get; private set; } + + /// <summary> + /// The delimiter used to separate fields. + /// </summary> + /// <param name="delimiter">The delimiter.</param> + public DelimiterAttribute(string delimiter) + { + Delimiter = delimiter; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// A value indicating whether changes in the column + /// count should be detected. If true, a <see cref="BadDataException"/> + /// will be thrown if a different column count is detected. + /// </summary> + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class DetectColumnCountChangesAttribute : Attribute, IClassMapper + { + /// <summary> + /// A value indicating whether changes in the column + /// count should be detected. If true, a <see cref="BadDataException"/> + /// will be thrown if a different column count is detected. + /// </summary> + public bool DetectColumnCountChanges { get; private set; } + + /// <summary> + /// A value indicating whether changes in the column + /// count should be detected. If true, a <see cref="BadDataException"/> + /// will be thrown if a different column count is detected. + /// </summary> + public DetectColumnCountChangesAttribute(bool detectColumnCountChanges) + { + DetectColumnCountChanges = detectColumnCountChanges; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// Detect the delimiter instead of using the delimiter from configuration. + /// Default is <c>false</c>. + /// </summary> + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class DetectDelimiterAttribute : Attribute, IClassMapper + { + /// <summary> + /// Detect the delimiter instead of using the delimiter from configuration. + /// </summary> + public bool DetectDelimiter { get; private set; } + + /// <summary> + /// Detect the delimiter instead of using the delimiter from configuration. + /// </summary> + public DetectDelimiterAttribute(bool detectDelimiter) + { + DetectDelimiter = detectDelimiter; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// The possible delimiter values used when detecting the delimiter. + /// Default is [",", ";", "|", "\t"]. + /// </summary> + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class DetectDelimiterValuesAttribute : Attribute, IClassMapper + { + /// <summary> + /// The possible delimiter values used when detecting the delimiter. + /// </summary> + public string[] DetectDelimiterValues { get; private set; } + + /// <summary> + /// The possible delimiter values used when detecting the delimiter. + /// </summary> + /// <param name="detectDelimiterValues">Whitespace separated list of values.</param> + public DetectDelimiterValuesAttribute(string detectDelimiterValues) + { + DetectDelimiterValues = Regex.Split(detectDelimiterValues, @"\s+"); + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// The encoding used when counting bytes. + /// </summary> + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class EncodingAttribute : Attribute, IClassMapper + { + /// <summary> + /// Gets the encoding used when counting bytes. + /// </summary> + public Encoding Encoding { get; private set; } + + /// <summary> + /// The encoding used when counting bytes. + /// </summary> + /// <param name="encoding">The encoding.</param> + public EncodingAttribute(string encoding) + { + Encoding = Encoding.GetEncoding(encoding); + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// Ignore case when parsing enums. + /// </summary> + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + public class EnumIgnoreCaseAttribute : Attribute, IMemberMapper, IMemberReferenceMapper, IParameterMapper + { + /// <inheritdoc/> + public void ApplyTo(MemberMap memberMap) + { + memberMap.Data.TypeConverterOptions.EnumIgnoreCase = true; + } + + /// <inheritdoc/> + public void ApplyTo(MemberReferenceMap referenceMap) + { + foreach (var memberMap in referenceMap.Data.Mapping.MemberMaps) + { + ApplyTo(memberMap); + } + } + + /// <inheritdoc/> + 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 +{ + /// <summary> + /// The escape character used to escape a quote inside a field. + /// </summary> + [AttributeUsage( AttributeTargets.Class, AllowMultiple = false, Inherited = true )] + public class EscapeAttribute : Attribute, IClassMapper + { + /// <summary> + /// Gets the escape character used to escape a quote inside a field. + /// </summary> + public char Escape { get; private set; } + + /// <summary> + /// The escape character used to escape a quote inside a field. + /// </summary> + /// <param name="escape">The escape character.</param> + public EscapeAttribute( char escape ) + { + Escape = escape; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// A value indicating if exception messages contain raw CSV data. + /// <c>true</c> if exception contain raw CSV data, otherwise <c>false</c>. + /// Default is <c>true</c>. + /// </summary> + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class ExceptionMessagesContainRawDataAttribute : Attribute, IClassMapper + { + /// <summary> + /// A value indicating if exception messages contain raw CSV data. + /// <c>true</c> if exception contain raw CSV data, otherwise <c>false</c>. + /// </summary> + public bool ExceptionMessagesContainRawData { get; private set; } + + /// <summary> + /// A value indicating if exception messages contain raw CSV data. + /// <c>true</c> if exception contain raw CSV data, otherwise <c>false</c>. + /// </summary> + /// <param name="exceptionMessagesContainRawData"></param> + public ExceptionMessagesContainRawDataAttribute(bool exceptionMessagesContainRawData) + { + ExceptionMessagesContainRawData = exceptionMessagesContainRawData; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// The string format to be used when type converting. + /// </summary> + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + public class FormatAttribute : Attribute, IMemberMapper, IParameterMapper + { + /// <summary> + /// Gets the formats. + /// </summary> + public string[] Formats { get; private set; } + + /// <summary> + /// The string format to be used when type converting. + /// </summary> + /// <param name="format">The format.</param> + public FormatAttribute(string format) + { + Formats = new string[] { format }; + } + + /// <summary> + /// The string format to be used when type converting. + /// </summary> + /// <param name="formats">The formats.</param> + public FormatAttribute(params string[] formats) + { + Formats = formats; + } + + /// <inheritdoc /> + public void ApplyTo(MemberMap memberMap) + { + memberMap.Data.TypeConverterOptions.Formats = Formats; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// A value indicating if the CSV file has a header record. + /// </summary> + [AttributeUsage( AttributeTargets.Class, AllowMultiple = false, Inherited = true )] + public class HasHeaderRecordAttribute : Attribute, IClassMapper + { + /// <summary> + /// Gets a value indicating if the CSV file has a header record. + /// </summary> + public bool HasHeaderRecord { get; private set; } + + /// <summary> + /// A value indicating if the CSV file has a header record. + /// </summary> + /// <param name="hasHeaderRecord">A value indicating if the CSV file has a header record.</param> + public HasHeaderRecordAttribute( bool hasHeaderRecord ) + { + HasHeaderRecord = hasHeaderRecord; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// Appends a prefix to the header of each field of the reference member. + /// </summary> + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + public class HeaderPrefixAttribute : Attribute, IMemberReferenceMapper, IParameterReferenceMapper + { + /// <summary> + /// Gets the prefix. + /// </summary> + public string? Prefix { get; private set; } + + /// <summary> + /// Gets a value indicating if the prefix should inherit parent prefixes. + /// </summary> + public bool Inherit { get; private set; } + + /// <summary> + /// Appends a prefix to the header of each field of the reference member. + /// </summary> + public HeaderPrefixAttribute() { } + + /// <summary> + /// Appends a prefix to the header of each field of the reference member. + /// </summary> + /// <param name="prefix">The prefix.</param> + public HeaderPrefixAttribute(string prefix) + { + Prefix = prefix; + } + + /// <summary> + /// Appends a prefix to the header of each field of the reference member. + /// </summary> + /// <param name="inherit">Inherits parent object prefixes.</param> + public HeaderPrefixAttribute(bool inherit) + { + Inherit = inherit; + } + + /// <summary> + /// Appends a prefix to the header of each field of the reference member. + /// </summary> + /// <param name="prefix">The prefix.</param> + /// <param name="inherit">Inherits parent object prefixes.</param> + public HeaderPrefixAttribute(string prefix, bool inherit) + { + Prefix = prefix; + Inherit = inherit; + } + + /// <inheritdoc /> + public void ApplyTo(MemberReferenceMap referenceMap) + { + referenceMap.Data.Inherit = Inherit; + referenceMap.Data.Prefix = Prefix ?? referenceMap.Data.Member.Name + "."; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// Defines methods to enable pluggable configuration. + /// </summary> + public interface IClassMapper + { + /// <summary> + /// Applies configuration. + /// </summary> + /// <param name="configuration">The configuration to apply to.</param> + 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 +{ + /// <summary> + /// Defines methods to enable pluggable configuration of member mapping. + /// </summary> + public interface IMemberMapper + { + /// <summary> + /// Applies configuration to the given <see cref="MemberMap"/>. + /// </summary> + /// <param name="memberMap">The member map.</param> + 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 +{ + /// <summary> + /// Defines methods to enable pluggable configuration of member reference mapping. + /// </summary> + public interface IMemberReferenceMapper + { + /// <summary> + /// Applies configuration to the given <see cref="MemberReferenceMap" />. + /// </summary> + /// <param name="referenceMap">The reference map.</param> + 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 +{ + /// <summary> + /// Defines methods to enable pluggable configuration of parameter mapping. + /// </summary> + public interface IParameterMapper + { + /// <summary> + /// Applies configuration to the given <see cref="ParameterMap"/>. + /// </summary> + /// <param name="parameterMap">The parameter map.</param> + 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 +{ + /// <summary> + /// Defines methods to enable pluggable configuration of parameter reference mapping. + /// </summary> + public interface IParameterReferenceMapper + { + /// <summary> + /// Applies configuration to the given <see cref="ParameterReferenceMap" />. + /// </summary> + /// <param name="referenceMap">The reference map.</param> + 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 +{ + /// <summary> + /// 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. + /// </summary> + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + public class IgnoreAttribute : Attribute, IMemberMapper, IMemberReferenceMapper, IParameterMapper + { + /// <inheritdoc /> + public void ApplyTo(MemberMap memberMap) + { + memberMap.Data.Ignore = true; + } + + /// <inheritdoc /> + public void ApplyTo(MemberReferenceMap referenceMap) + { + foreach (var memberMap in referenceMap.Data.Mapping.MemberMaps) + { + ApplyTo(memberMap); + } + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// Ignores base classes when auto mapping. + /// </summary> + [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 +{ + /// <summary> + /// A value indicating if blank lines should be ignored when reading. + /// </summary> + [AttributeUsage( AttributeTargets.Class, AllowMultiple = false, Inherited = true )] + public class IgnoreBlankLinesAttribute : Attribute, IClassMapper + { + /// <summary> + /// Gets a value indicating if blank lines should be ignored when reading. + /// </summary> + public bool IgnoreBlankLines { get; private set; } + + /// <summary> + /// A value indicating if blank lines should be ignored when reading. + /// </summary> + /// <param name="ignoreBlankLines">The Ignore Blank Lines Flag.</param> + public IgnoreBlankLinesAttribute( bool ignoreBlankLines ) + { + IgnoreBlankLines = ignoreBlankLines; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// Gets a value indicating whether references + /// should be ignored when auto mapping. <c>true</c> to ignore + /// references, otherwise <c>false</c>. Default is false. + /// </summary> + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class IgnoreReferencesAttribute : Attribute, IClassMapper + { + /// <summary> + /// Gets a value indicating whether references + /// should be ignored when auto mapping. <c>true</c> to ignore + /// references, otherwise <c>false</c>. Default is false. + /// </summary> + public bool IgnoreReferences { get; private set; } + + /// <summary> + /// Gets a value indicating whether references + /// should be ignored when auto mapping. <c>true</c> to ignore + /// references, otherwise <c>false</c>. Default is false. + /// </summary> + /// <param name="ignoreReferences">Ignore references value.</param> + public IgnoreReferencesAttribute(bool ignoreReferences) + { + IgnoreReferences = ignoreReferences; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// A value indicating if private member should be read from and written to. + /// </summary> + [AttributeUsage( AttributeTargets.Class, AllowMultiple = false, Inherited = true )] + public class IncludePrivateMembersAttribute : Attribute, IClassMapper + { + /// <summary> + /// Gets a value indicating if private member should be read from and written to. + /// </summary> + public bool IncludePrivateMembers { get; private set; } + + /// <summary> + /// A value indicating if private member should be read from and written to. + /// </summary> + /// <param name="includePrivateMembers">The Include Private Members Flag.</param> + public IncludePrivateMembersAttribute( bool includePrivateMembers ) + { + IncludePrivateMembers = includePrivateMembers; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// 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. + /// </summary> + [AttributeUsage( AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true )] + public class IndexAttribute : Attribute, IMemberMapper, IParameterMapper + { + /// <summary> + /// Gets the index. + /// </summary> + public int Index { get; private set; } + + /// <summary> + /// Gets the index end. + /// </summary> + public int IndexEnd { get; private set; } + + /// <summary> + /// 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. + /// </summary> + /// <param name="index">The index.</param> + /// <param name="indexEnd">The index end.</param> + public IndexAttribute( int index, int indexEnd = -1 ) + { + Index = index; + IndexEnd = indexEnd; + } + + /// <inheritdoc /> + public void ApplyTo(MemberMap memberMap) + { + memberMap.Data.Index = Index; + memberMap.Data.IndexEnd = IndexEnd; + memberMap.Data.IsIndexSet = true; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// Gets the characters that are used for injection attacks. + /// </summary> + public class InjectionCharactersAttribute : Attribute, IClassMapper + { + /// <summary> + /// Gets the characters that are used for injection attacks. + /// Default is '=', '@', '+', '-', '\t', '\r'. + /// </summary> + public char[] InjectionCharacters { get; private set; } + + /// <summary> + /// Gets the characters that are used for injection attacks. + /// </summary> + /// <param name="injectionCharacters"></param> + public InjectionCharactersAttribute(string injectionCharacters) + { + InjectionCharacters = Regex.Split(injectionCharacters, @"\s+").Select(s => s[0]).ToArray(); + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// The character used to escape a detected injection. + /// </summary> + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class InjectionEscapeCharacterAttribute : Attribute, IClassMapper + { + /// <summary> + /// The character used to escape a detected injection. + /// </summary> + public char InjectionEscapeCharacter { get; private set; } + + /// <summary> + /// The character used to escape a detected injection. + /// </summary> + /// <param name="injectionEscapeCharacter"></param> + public InjectionEscapeCharacterAttribute(char injectionEscapeCharacter) + { + InjectionEscapeCharacter = injectionEscapeCharacter; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// The injection options. + /// </summary> + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class InjectionOptionsAttribute : Attribute, IClassMapper + { + /// <summary> + /// The injection options. + /// </summary> + public InjectionOptions InjectionOptions { get; private set; } + + /// <summary> + /// The injection options. + /// </summary> + /// <param name="injectionOptions"></param> + public InjectionOptionsAttribute(InjectionOptions injectionOptions) + { + InjectionOptions = injectionOptions; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// A value indicating if a line break found in a quote field should + /// be considered bad data. <c>true</c> to consider a line break bad data, otherwise <c>false</c>. + /// Defaults to false. + /// </summary> + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class LineBreakInQuotedFieldIsBadDataAttribute : Attribute, IClassMapper + { + /// <summary> + /// A value indicating if a line break found in a quote field should + /// be considered bad data. <c>true</c> to consider a line break bad data, otherwise <c>false</c>. + /// </summary> + public bool LineBreakInQuotedFieldIsBadData { get; private set; } + + /// <summary> + /// A value indicating if a line break found in a quote field should + /// be considered bad data. <c>true</c> to consider a line break bad data, otherwise <c>false</c>. + /// </summary> + /// <param name="lineBreakInQuotedFieldIsBadData"></param> + public LineBreakInQuotedFieldIsBadDataAttribute(bool lineBreakInQuotedFieldIsBadData) + { + LineBreakInQuotedFieldIsBadData = lineBreakInQuotedFieldIsBadData; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// Gets or sets the maximum size of a field. + /// Defaults to 0, indicating maximum field size is not checked. + /// </summary> + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class MaxFieldSizeAttribute : Attribute, IClassMapper + { + /// <summary> + /// Gets or sets the maximum size of a field. + /// </summary> + public double MaxFieldSize { get; private set; } + + /// <summary> + /// Gets or sets the maximum size of a field. + /// </summary> + /// <param name="maxFieldSize"></param> + public MaxFieldSizeAttribute(double maxFieldSize) + { + MaxFieldSize = maxFieldSize; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// The member types that are used when auto mapping. + /// MemberTypes are flags, so you can choose more than one. + /// Default is Properties. + /// </summary> + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class MemberTypesAttribute : Attribute, IClassMapper + { + /// <summary> + /// The member types that are used when auto mapping. + /// MemberTypes are flags, so you can choose more than one. + /// Default is Properties. + /// </summary> + public MemberTypes MemberTypes { get; private set; } + + /// <summary> + /// The member types that are used when auto mapping. + /// MemberTypes are flags, so you can choose more than one. + /// Default is Properties. + /// </summary> + public MemberTypesAttribute(MemberTypes memberTypes) + { + MemberTypes = memberTypes; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// The mode. + /// See <see cref="CsvMode"/> for more details. + /// </summary> + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class ModeAttribute : Attribute, IClassMapper + { + /// <summary> + /// The mode. + /// See <see cref="CsvMode"/> for more details. + /// </summary> + public CsvMode Mode { get; private set; } + + /// <summary> + /// The mode. + /// See <see cref="CsvMode"/> for more details. + /// </summary> + /// <param name="mode"></param> + public ModeAttribute(CsvMode mode) + { + Mode = mode; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// 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. + /// </summary> + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + public class NameAttribute : Attribute, IMemberMapper, IParameterMapper + { + /// <summary> + /// Gets the names. + /// </summary> + public string[] Names { get; private set; } + + /// <summary> + /// 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. + /// </summary> + /// <param name="name">The name</param> + public NameAttribute(string name) + { + Names = new string[] { name }; + } + + /// <summary> + /// 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. + /// </summary> + /// <param name="names">The names.</param> + public NameAttribute(params string[] names) + { + if (names == null || names.Length == 0) + { + throw new ArgumentNullException(nameof(names)); + } + + Names = names; + } + + /// <inheritdoc /> + public void ApplyTo(MemberMap memberMap) + { + memberMap.Data.Names.Clear(); + memberMap.Data.Names.AddRange(Names); + memberMap.Data.IsNameSet = true; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// When reading, is used to get the + /// index of the name used when there + /// are multiple names that are the same. + /// </summary> + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + public class NameIndexAttribute : Attribute, IMemberMapper, IParameterMapper + { + /// <summary> + /// The name index. + /// </summary> + public int NameIndex { get; private set; } + + /// <summary> + /// When reading, is used to get the + /// index of the name used when there + /// are multiple names that are the same. + /// </summary> + /// <param name="nameIndex">The name index.</param> + public NameIndexAttribute(int nameIndex) + { + NameIndex = nameIndex; + } + + /// <inheritdoc /> + public void ApplyTo(MemberMap memberMap) + { + memberMap.Data.NameIndex = NameIndex; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// 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. + /// </summary> + [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; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// The string values used to represent null when converting. + /// </summary> + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + public class NullValuesAttribute : Attribute, IMemberMapper, IParameterMapper + { + /// <summary> + /// Gets the null values. + /// </summary> + public string[] NullValues { get; private set; } + + /// <summary> + /// The string values used to represent null when converting. + /// </summary> + /// <param name="nullValue">The null values.</param> + public NullValuesAttribute(string nullValue) + { + NullValues = new string[] { nullValue }; + } + + /// <summary> + /// The string values used to represent null when converting. + /// </summary> + /// <param name="nullValues">The null values.</param> + public NullValuesAttribute(params string[] nullValues) + { + NullValues = nullValues; + } + + /// <inheritdoc /> + public void ApplyTo(MemberMap memberMap) + { + memberMap.Data.TypeConverterOptions.NullValues.Clear(); + memberMap.Data.TypeConverterOptions.NullValues.AddRange(NullValues); + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// The <see cref="NumberStyles"/> to use when type converting. + /// This is used when doing any number conversions. + /// </summary> + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + public class NumberStylesAttribute : Attribute, IMemberMapper, IParameterMapper + { + /// <summary> + /// Gets the number styles. + /// </summary> + public NumberStyles NumberStyles { get; private set; } + + /// <summary> + /// The <see cref="NumberStyles"/> to use when type converting. + /// This is used when doing any number conversions. + /// </summary> + /// <param name="numberStyles">The number styles.</param> + public NumberStylesAttribute(NumberStyles numberStyles) + { + NumberStyles = numberStyles; + } + + /// <inheritdoc /> + public void ApplyTo(MemberMap memberMap) + { + memberMap.Data.TypeConverterOptions.NumberStyles = NumberStyles; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// Ignore the member when reading if no matching field name can be found. + /// </summary> + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + public class OptionalAttribute : Attribute, IMemberMapper, IParameterMapper + { + /// <inheritdoc /> + public void ApplyTo(MemberMap memberMap) + { + memberMap.Data.IsOptional = true; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// The size of the buffer used when processing fields. + /// Default is 1024. + /// </summary> + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class ProcessFieldBufferSizeAttribute : Attribute, IClassMapper + { + /// <summary> + /// The size of the buffer used when processing fields. + /// </summary> + public int ProcessFieldBufferSize { get; private set; } + + /// <summary> + /// The size of the buffer used when processing fields. + /// </summary> + /// <param name="processFieldBufferSize"></param> + public ProcessFieldBufferSizeAttribute(int processFieldBufferSize) + { + ProcessFieldBufferSize = processFieldBufferSize; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// The character used to quote fields. + /// </summary> + [AttributeUsage( AttributeTargets.Class, AllowMultiple = false, Inherited = true )] + public class QuoteAttribute : Attribute, IClassMapper + { + /// <summary> + /// Gets the character used to quote fields. + /// </summary> + public char Quote { get; private set; } + + /// <summary> + /// The character used to quote fields. + /// </summary> + /// <param name="quote">The quote character.</param> + public QuoteAttribute( char quote ) + { + Quote = quote; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// The fields trimming options. + /// </summary> + [AttributeUsage( AttributeTargets.Class, AllowMultiple = false, Inherited = true )] + public class TrimOptionsAttribute : Attribute, IClassMapper + { + /// <summary> + /// Gets the fields trimming options. + /// </summary> + public TrimOptions TrimOptions { get; private set; } + + /// <summary> + /// The fields trimming options. + /// </summary> + /// <param name="trimOptions">The TrimOptions.</param> + public TrimOptionsAttribute( TrimOptions trimOptions ) + { + TrimOptions = trimOptions; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// Specifies the <see cref="TypeConverter"/> to use + /// when converting the member to and from a CSV field. + /// </summary> + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + public class TypeConverterAttribute : Attribute, IMemberMapper, IParameterMapper + { + /// <summary> + /// Gets the type converter. + /// </summary> + public ITypeConverter TypeConverter { get; private set; } + + /// <summary> + /// Specifies the <see cref="TypeConverter"/> to use + /// when converting the member to and from a CSV field. + /// </summary> + /// <param name="typeConverterType">The type of the <see cref="ITypeConverter"/>.</param> + public TypeConverterAttribute(Type typeConverterType) : this(typeConverterType, new object[0]) { } + + /// <summary> + /// Specifies the <see cref="TypeConverter"/> to use + /// when converting the member to and from a CSV field. + /// </summary> + /// <param name="typeConverterType">The type of the <see cref="ITypeConverter"/>.</param> + /// <param name="constructorArgs">Type constructor arguments for the type converter.</param> + 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)}"); + } + + /// <inheritdoc /> + public void ApplyTo(MemberMap memberMap) + { + memberMap.Data.TypeConverter = TypeConverter; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// 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. + /// </summary> + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class UseNewObjectForNullReferenceMembersAttribute : Attribute, IClassMapper + { + /// <summary> + /// 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. + /// </summary> + public bool UseNewObjectForNullReferenceMembers { get; private set; } + + /// <summary> + /// 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. + /// </summary> + /// <param name="useNewObjectForNullReferenceMembers">The value.</param> + public UseNewObjectForNullReferenceMembersAttribute(bool useNewObjectForNullReferenceMembers) + { + UseNewObjectForNullReferenceMembers = useNewObjectForNullReferenceMembers; + } + + /// <inheritdoc /> + 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 +{ + /// <summary> + /// Characters considered whitespace. + /// Used when trimming fields. + /// Default is [' ']. + /// </summary> + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class WhiteSpaceCharsAttribute : Attribute, IClassMapper + { + /// <summary> + /// Characters considered whitespace. + /// Used when trimming fields. + /// </summary> + public char[] WhiteSpaceChars { get; private set; } + + /// <summary> + /// Characters considered whitespace. + /// Used when trimming fields. + /// </summary> + /// <param name="whiteSpaceChars"></param> + public WhiteSpaceCharsAttribute(string whiteSpaceChars) + { + WhiteSpaceChars = Regex.Split(whiteSpaceChars, @"\s").Select(s => s[0]).ToArray(); + } + + /// <inheritdoc /> + public void ApplyTo(CsvConfiguration configuration) + { + configuration.WhiteSpaceChars = WhiteSpaceChars; + } + } +} |