diff --git a/FlatFiles/DataRecordExtensions.cs b/FlatFiles/DataRecordExtensions.cs index 38d8748..e324705 100644 --- a/FlatFiles/DataRecordExtensions.cs +++ b/FlatFiles/DataRecordExtensions.cs @@ -1,5 +1,4 @@ -#if NET451 || NETSTANDARD2_0 || NETCOREAPP -using System; +using System; using System.Data; using System.Reflection; @@ -1087,4 +1086,3 @@ private static T Get(IDataRecord record, string name, Func getter) } } } -#endif \ No newline at end of file diff --git a/FlatFiles/DataTableExtensions.cs b/FlatFiles/DataTableExtensions.cs index e0b33dc..0da0447 100644 --- a/FlatFiles/DataTableExtensions.cs +++ b/FlatFiles/DataTableExtensions.cs @@ -1,5 +1,3 @@ -#if NET451 || NETSTANDARD2_0 || NETCOREAPP - using System; using System.Data; using System.Linq; @@ -72,5 +70,3 @@ public static void WriteFlatFile(this DataTable table, IWriter writer) } } } - -#endif \ No newline at end of file diff --git a/FlatFiles/FlatFileDataReader.cs b/FlatFiles/FlatFileDataReader.cs index 41642e0..87be082 100644 --- a/FlatFiles/FlatFileDataReader.cs +++ b/FlatFiles/FlatFileDataReader.cs @@ -1,5 +1,4 @@ -#if NET451 || NETSTANDARD2_0 || NETCOREAPP - + using System; using System.Data; using System.Data.Common; @@ -230,11 +229,7 @@ public long GetBytes(int i, long fieldOffset, byte[] buffer, int bufferoffset, i { var values = GetValues(); var bytes = (byte[])values[i]; -#if NET451 Array.Copy(bytes, fieldOffset, buffer, bufferoffset, length); -#else - Array.Copy(bytes, (int)fieldOffset, buffer, bufferoffset, length); -#endif return Math.Min(bytes.Length - fieldOffset, length); } @@ -266,11 +261,7 @@ public long GetChars(int i, long fieldoffset, char[] buffer, int bufferoffset, i } var values = GetValues(); var chars = (char[])values[i]; -#if NET451 Array.Copy(buffer, fieldoffset, buffer, bufferoffset, length); -#else - Array.Copy(buffer, (int)fieldoffset, buffer, bufferoffset, length); -#endif return Math.Min(chars.Length - fieldoffset, length); } @@ -611,5 +602,3 @@ private ColumnCollection GetColumns(ISchema schema) } } } - -#endif diff --git a/FlatFiles/FlatFileDataReaderOptions.cs b/FlatFiles/FlatFileDataReaderOptions.cs index 1863bc3..58353f3 100644 --- a/FlatFiles/FlatFileDataReaderOptions.cs +++ b/FlatFiles/FlatFileDataReaderOptions.cs @@ -1,5 +1,3 @@ -#if NET451 || NETSTANDARD2_0 || NETCOREAPP - using System; namespace FlatFiles @@ -28,5 +26,3 @@ public FlatFileDataReaderOptions() public bool IsNullStringAllowed { get; set; } } } - -#endif \ No newline at end of file diff --git a/FlatFiles/FlatFiles.csproj b/FlatFiles/FlatFiles.csproj index b11be6b..a655110 100644 --- a/FlatFiles/FlatFiles.csproj +++ b/FlatFiles/FlatFiles.csproj @@ -1,7 +1,7 @@  - netcoreapp3.0;netstandard2.1;netstandard2.0;netstandard1.6;net451 + net462;netstandard2.0;netstandard2.1 en-US Reads and writes CSV, fixed-length and other flat file formats with a focus on schema definition, configuration and speed. Supports mapping directly between files and classes. Copyright @ 2021 @@ -26,14 +26,14 @@ enable - - bin\Debug\netstandard1.6\FlatFiles.xml + + bin\Debug\net462\FlatFiles.xml - - bin\Release\netstandard1.6\FlatFiles.xml + + bin\Release\net462\FlatFiles.xml - + bin\Debug\netstandard2.0\FlatFiles.xml @@ -42,24 +42,12 @@ bin\Release\netstandard2.0\FlatFiles.xml - - bin\Release\netstandard2.1\FlatFiles.xml - - - - bin\Debug\netcoreapp3.0\FlatFiles.xml - - - - bin\Release\netcoreapp3.0\FlatFiles.xml - - - - bin\Debug\net451\FlatFiles.xml + + bin\Debug\netstandard2.1\FlatFiles.xml - - bin\Release\net451\FlatFiles.xml + + bin\Release\netstandard2.1\FlatFiles.xml @@ -78,27 +66,17 @@ - - - - - - - - - - - + - - - + + + - - - + + + diff --git a/FlatFiles/IFlatFileDataRecord.cs b/FlatFiles/IFlatFileDataRecord.cs index 5d8bcc4..dfa35bf 100644 --- a/FlatFiles/IFlatFileDataRecord.cs +++ b/FlatFiles/IFlatFileDataRecord.cs @@ -1,6 +1,4 @@ -#if NET451 || NETSTANDARD2_0 || NETCOREAPP - -using System; +using System; using System.Data; namespace FlatFiles @@ -53,5 +51,3 @@ public interface IFlatFileDataRecord : IDataRecord ulong GetUInt64(int i); } } - -#endif \ No newline at end of file diff --git a/FlatFiles/TypeMapping/FixedLengthTypeMapper.cs b/FlatFiles/TypeMapping/FixedLengthTypeMapper.cs index 4e55964..4b00d4c 100644 --- a/FlatFiles/TypeMapping/FixedLengthTypeMapper.cs +++ b/FlatFiles/TypeMapping/FixedLengthTypeMapper.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Threading.Tasks; @@ -470,7 +469,6 @@ public interface IFixedLengthTypeMapper : IFixedLengthTypeConfiguration /// The entities that are extracted from the file. IEnumerable Read(TextReader reader, FixedLengthOptions options = null); -#if !NET451 && !NETSTANDARD1_6 && !NETSTANDARD2_0 /// /// Reads the entities from the given reader. /// @@ -478,7 +476,6 @@ public interface IFixedLengthTypeMapper : IFixedLengthTypeConfiguration /// The options controlling how the fixed-length document is read. /// An asynchronous enumerable over the entities. IAsyncEnumerable ReadAsync(TextReader reader, FixedLengthOptions options = null); -#endif /// /// Gets a typed reader to read entities from the underlying document. @@ -504,7 +501,6 @@ public interface IFixedLengthTypeMapper : IFixedLengthTypeConfiguration /// The options controlling how the separated value document is written. Task WriteAsync(TextWriter writer, IEnumerable entities, FixedLengthOptions options = null); -#if !NET451 && !NETSTANDARD1_6 && !NETSTANDARD2_0 /// /// Writes the given entities to the given writer. /// @@ -512,7 +508,6 @@ public interface IFixedLengthTypeMapper : IFixedLengthTypeConfiguration /// The entities to write to the document. /// The options controlling how the separated value document is written. Task WriteAsync(TextWriter writer, IAsyncEnumerable entities, FixedLengthOptions options = null); -#endif /// /// Gets a typed writer to write entities to the underlying document. @@ -770,7 +765,6 @@ public interface IDynamicFixedLengthTypeMapper : IDynamicFixedLengthTypeConfigur /// The entities that are extracted from the file. IEnumerable Read(TextReader reader, FixedLengthOptions options = null); -#if !NET451 && !NETSTANDARD1_6 && !NETSTANDARD2_0 /// /// Reads the entities from the given reader. /// @@ -778,7 +772,6 @@ public interface IDynamicFixedLengthTypeMapper : IDynamicFixedLengthTypeConfigur /// The options controlling how the fixed-length document is read. /// An asynchronous enumerable over the entities. IAsyncEnumerable ReadAsync(TextReader reader, FixedLengthOptions options = null); -#endif /// /// Gets a typed reader to read entities from the underlying document. @@ -804,7 +797,6 @@ public interface IDynamicFixedLengthTypeMapper : IDynamicFixedLengthTypeConfigur /// The options used to format the output. Task WriteAsync(TextWriter writer, IEnumerable entities, FixedLengthOptions options = null); -#if !NET451 && !NETSTANDARD1_6 && !NETSTANDARD2_0 /// /// Writes the given entities to the given stream. /// @@ -812,7 +804,6 @@ public interface IDynamicFixedLengthTypeMapper : IDynamicFixedLengthTypeConfigur /// The entities to write to the stream. /// The options used to format the output. Task WriteAsync(TextWriter writer, IAsyncEnumerable entities, FixedLengthOptions options = null); -#endif /// /// Gets a typed writer to write entities to the underlying document. @@ -1369,13 +1360,11 @@ public IEnumerable Read(TextReader reader, FixedLengthOptions options = return typedReader.ReadAll(); } -#if !NET451 && !NETSTANDARD1_6 && !NETSTANDARD2_0 public IAsyncEnumerable ReadAsync(TextReader reader, FixedLengthOptions options = null) { var typedReader = GetReader(reader, options); return typedReader.ReadAllAsync(); } -#endif public IFixedLengthTypedReader GetReader(TextReader reader, FixedLengthOptions options = null) { @@ -1410,7 +1399,6 @@ public Task WriteAsync(TextWriter writer, IEnumerable entities, FixedLe return typedWriter.WriteAllAsync(entities); } -#if !NET451 && !NETSTANDARD1_6 && !NETSTANDARD2_0 public Task WriteAsync(TextWriter writer, IAsyncEnumerable entities, FixedLengthOptions options = null) { if (entities == null) @@ -1420,7 +1408,6 @@ public Task WriteAsync(TextWriter writer, IAsyncEnumerable entities, Fi var typedWriter = GetWriter(writer, options); return typedWriter.WriteAllAsync(entities); } -#endif public ITypedWriter GetWriter(TextWriter writer, FixedLengthOptions options = null) { @@ -1629,14 +1616,12 @@ IEnumerable IDynamicFixedLengthTypeMapper.Read(TextReader reader, FixedL return untypedReader.ReadAll(); } -#if !NET451 && !NETSTANDARD1_6 && !NETSTANDARD2_0 IAsyncEnumerable IDynamicFixedLengthTypeMapper.ReadAsync(TextReader reader, FixedLengthOptions options) { IDynamicFixedLengthTypeMapper untypedMapper = this; var untypedReader = untypedMapper.GetReader(reader, options); return untypedReader.ReadAllAsync(); } -#endif IFixedLengthTypedReader IDynamicFixedLengthTypeMapper.GetReader(TextReader reader, FixedLengthOptions options) { @@ -1657,14 +1642,12 @@ Task IDynamicFixedLengthTypeMapper.WriteAsync(TextWriter writer, IEnumerable entities, FixedLengthOptions options) { IDynamicFixedLengthTypeMapper untypedMapper = this; var untypedWriter = untypedMapper.GetWriter(writer, options); return untypedWriter.WriteAllAsync(entities); } -#endif ITypedWriter IDynamicFixedLengthTypeMapper.GetWriter(TextWriter writer, FixedLengthOptions options) { diff --git a/FlatFiles/TypeMapping/SeparatedValueTypeMapper.cs b/FlatFiles/TypeMapping/SeparatedValueTypeMapper.cs index 56ac11c..cb39293 100644 --- a/FlatFiles/TypeMapping/SeparatedValueTypeMapper.cs +++ b/FlatFiles/TypeMapping/SeparatedValueTypeMapper.cs @@ -675,7 +675,6 @@ public interface ISeparatedValueTypeMapper : ISeparatedValueTypeConfigu /// The entities that are extracted from the file. IEnumerable Read(TextReader reader, SeparatedValueOptions options = null); -#if !NET451 && !NETSTANDARD1_6 && !NETSTANDARD2_0 /// /// Reads the entities from the given reader. /// @@ -683,7 +682,6 @@ public interface ISeparatedValueTypeMapper : ISeparatedValueTypeConfigu /// The options controlling how the separated value document is read. /// An asynchronous enumerable over the entities. IAsyncEnumerable ReadAsync(TextReader reader, SeparatedValueOptions options = null); -#endif /// /// Gets a typed reader to read entities from the underlying document. @@ -709,7 +707,6 @@ public interface ISeparatedValueTypeMapper : ISeparatedValueTypeConfigu /// The options used to format the output. Task WriteAsync(TextWriter writer, IEnumerable entities, SeparatedValueOptions options = null); -#if !NET451 && !NETSTANDARD1_6 && !NETSTANDARD2_0 /// /// Writes the given entities to the given stream. /// @@ -717,7 +714,6 @@ public interface ISeparatedValueTypeMapper : ISeparatedValueTypeConfigu /// The entities to write to the stream. /// The options used to format the output. Task WriteAsync(TextWriter writer, IAsyncEnumerable entities, SeparatedValueOptions options = null); -#endif /// /// Gets a typed writer to write entities to the underlying document. @@ -950,7 +946,6 @@ public interface IDynamicSeparatedValueTypeMapper : IDynamicSeparatedValueTypeCo /// The entities that are extracted from the file. IEnumerable Read(TextReader reader, SeparatedValueOptions options = null); -#if !NET451 && !NETSTANDARD1_6 && !NETSTANDARD2_0 /// /// Reads the entities from the given reader. /// @@ -958,7 +953,6 @@ public interface IDynamicSeparatedValueTypeMapper : IDynamicSeparatedValueTypeCo /// The options controlling how the separated value document is read. /// An asynchronous enumerable over the entities. IAsyncEnumerable ReadAsync(TextReader reader, SeparatedValueOptions options = null); -#endif /// /// Gets a typed reader to read entities from the underlying document. @@ -984,7 +978,6 @@ public interface IDynamicSeparatedValueTypeMapper : IDynamicSeparatedValueTypeCo /// The options used to format the output. Task WriteAsync(TextWriter writer, IEnumerable entities, SeparatedValueOptions options = null); -#if !NET451 && !NETSTANDARD1_6 && !NETSTANDARD2_0 /// /// Writes the given entities to the given stream. /// @@ -992,7 +985,6 @@ public interface IDynamicSeparatedValueTypeMapper : IDynamicSeparatedValueTypeCo /// The entities to write to the stream. /// The options used to format the output. Task WriteAsync(TextWriter writer, IAsyncEnumerable entities, SeparatedValueOptions options = null); -#endif /// /// Gets a typed writer to write entities to the underlying document. @@ -1499,13 +1491,11 @@ public IEnumerable Read(TextReader reader, SeparatedValueOptions option return typedReader.ReadAll(); } -#if !NET451 && !NETSTANDARD1_6 && !NETSTANDARD2_0 public IAsyncEnumerable ReadAsync(TextReader reader, SeparatedValueOptions options = null) { var typedReader = GetReader(reader, options); return typedReader.ReadAllAsync(); } -#endif public ISeparatedValueTypedReader GetReader(TextReader reader, SeparatedValueOptions options = null) { @@ -1546,7 +1536,6 @@ public Task WriteAsync(TextWriter writer, IEnumerable entities, Separat return typedWriter.WriteAllAsync(entities); } -#if !NET451 && !NETSTANDARD1_6 && !NETSTANDARD2_0 public Task WriteAsync(TextWriter writer, IAsyncEnumerable entities, SeparatedValueOptions options = null) { if (entities == null) @@ -1556,7 +1545,6 @@ public Task WriteAsync(TextWriter writer, IAsyncEnumerable entities, Se var typedWriter = GetWriter(writer, options); return typedWriter.WriteAllAsync(entities); } -#endif public ITypedWriter GetWriter(TextWriter writer, SeparatedValueOptions options = null) { @@ -1763,14 +1751,12 @@ IEnumerable IDynamicSeparatedValueTypeMapper.Read(TextReader reader, Sep return untypedReader.ReadAll(); } -#if !NET451 && !NETSTANDARD1_6 && !NETSTANDARD2_0 IAsyncEnumerable IDynamicSeparatedValueTypeMapper.ReadAsync(TextReader reader, SeparatedValueOptions options) { IDynamicSeparatedValueTypeMapper untypedMapper = this; var untypedReader = untypedMapper.GetReader(reader, options); return untypedReader.ReadAllAsync(); } -#endif ISeparatedValueTypedReader IDynamicSeparatedValueTypeMapper.GetReader(TextReader reader, SeparatedValueOptions options) { @@ -1791,14 +1777,12 @@ Task IDynamicSeparatedValueTypeMapper.WriteAsync(TextWriter writer, IEnumerable< return untypedWriter.WriteAllAsync(entities); } -#if !NET451 && !NETSTANDARD1_6 && !NETSTANDARD2_0 Task IDynamicSeparatedValueTypeMapper.WriteAsync(TextWriter writer, IAsyncEnumerable entities, SeparatedValueOptions options) { IDynamicSeparatedValueTypeMapper untypedMapper = this; var untypedWriter = untypedMapper.GetWriter(writer, options); return untypedWriter.WriteAllAsync(entities); } -#endif ITypedWriter IDynamicSeparatedValueTypeMapper.GetWriter(TextWriter writer, SeparatedValueOptions options) { diff --git a/FlatFiles/TypeMapping/TypedReader.cs b/FlatFiles/TypeMapping/TypedReader.cs index 85f2585..3268d27 100644 --- a/FlatFiles/TypeMapping/TypedReader.cs +++ b/FlatFiles/TypeMapping/TypedReader.cs @@ -438,7 +438,6 @@ public static IEnumerable ReadAll(this ITypedReader r } } -#if !NET451 && !NETSTANDARD1_6 && !NETSTANDARD2_0 /// /// Reads each record from the given reader, such that each record is retrieved asynchronously. /// @@ -453,6 +452,5 @@ public static async IAsyncEnumerable ReadAllAsync(this ITypedR yield return entity; } } -#endif } } diff --git a/FlatFiles/TypeMapping/TypedWriter.cs b/FlatFiles/TypeMapping/TypedWriter.cs index 556f044..034ab24 100644 --- a/FlatFiles/TypeMapping/TypedWriter.cs +++ b/FlatFiles/TypeMapping/TypedWriter.cs @@ -244,7 +244,6 @@ public static async Task WriteAllAsync(this ITypedWriter write } } -#if !NET451 && !NETSTANDARD1_6 && !NETSTANDARD2_0 /// /// Writes all of the entities to the typed writer. /// @@ -263,6 +262,5 @@ public static async Task WriteAllAsync(this ITypedWriter write await writer.WriteAsync(entity).ConfigureAwait(false); } } -#endif } }