From 9b3acce828e5d0eeb0f510845b16a39614336301 Mon Sep 17 00:00:00 2001 From: Gregory Oschwald Date: Thu, 3 Feb 2022 13:16:35 -0800 Subject: [PATCH] Add back netstandard2.0 support Also remove requirements from README.md as the NuGet page covers this and is less likely to get out of sync. --- MaxMind.Db.Benchmark/MaxMind.Db.Benchmark.csproj | 3 ++- MaxMind.Db.Test/MaxMind.Db.Test.csproj | 3 ++- MaxMind.Db/Buffer.cs | 6 ++++++ MaxMind.Db/MaxMind.Db.csproj | 2 +- README.md | 5 ----- releasenotes.md | 3 ++- 6 files changed, 13 insertions(+), 9 deletions(-) diff --git a/MaxMind.Db.Benchmark/MaxMind.Db.Benchmark.csproj b/MaxMind.Db.Benchmark/MaxMind.Db.Benchmark.csproj index 35bbafe..2e9e852 100644 --- a/MaxMind.Db.Benchmark/MaxMind.Db.Benchmark.csproj +++ b/MaxMind.Db.Benchmark/MaxMind.Db.Benchmark.csproj @@ -3,7 +3,8 @@ Benchmark project to validate .NET reader for the MaxMind DB file format 4.0.0 - net6.0;net5.0;netcoreapp3.1 + net6.0;net5.0;net461;netcoreapp3.1 + net6.0;net5.0;netcoreapp3.1 MaxMind.Db.Benchmark Exe MaxMind.Db.Benchmark diff --git a/MaxMind.Db.Test/MaxMind.Db.Test.csproj b/MaxMind.Db.Test/MaxMind.Db.Test.csproj index 8ed34d6..4ab5b22 100644 --- a/MaxMind.Db.Test/MaxMind.Db.Test.csproj +++ b/MaxMind.Db.Test/MaxMind.Db.Test.csproj @@ -3,7 +3,8 @@ Test project to validate .NET reader for the MaxMind DB file format 4.0.0 - net6.0;net5.0;netcoreapp3.1 + net6.0;net5.0;net461;netcoreapp3.1 + net6.0;net5.0;netcoreapp3.1 MaxMind.Db.Test ../MaxMind.snk true diff --git a/MaxMind.Db/Buffer.cs b/MaxMind.Db/Buffer.cs index 231ff28..cf609f9 100644 --- a/MaxMind.Db/Buffer.cs +++ b/MaxMind.Db/Buffer.cs @@ -52,7 +52,13 @@ internal double ReadDouble(long offset) /// internal float ReadFloat(long offset) { +#if NETSTANDARD2_0 + var buffer = Read(offset, 4); + Array.Reverse(buffer); + return BitConverter.ToSingle(buffer, 0); +#else return BitConverter.Int32BitsToSingle(ReadInt(offset)); +#endif } /// diff --git a/MaxMind.Db/MaxMind.Db.csproj b/MaxMind.Db/MaxMind.Db.csproj index b89eaba..acb958b 100644 --- a/MaxMind.Db/MaxMind.Db.csproj +++ b/MaxMind.Db/MaxMind.Db.csproj @@ -3,7 +3,7 @@ .NET reader for the MaxMind DB file format 4.0.0 - net6.0;net5.0;netstandard2.1 + net6.0;net5.0;netstandard2.1;netstandard2.0 true MaxMind.Db ../MaxMind.snk diff --git a/README.md b/README.md index 26a12e7..13ad31e 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,6 @@ This is the .NET API for reading MaxMind DB files. MaxMind DB is a binary file format that stores data indexed by IP address subnets (IPv4 or IPv6). -## Requirements ## - -This library works with .NET 5.0 and above and .NET Standard -3.1 or above. - ## Installation ## ### NuGet ### diff --git a/releasenotes.md b/releasenotes.md index b902c90..acd7c7c 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -2,7 +2,8 @@ ## 4.0.0 (2022-02-03) ## -* This library now requires .NET 5.0 or greater or .NET Standard 3.1. +* This library no longer targets .NET 4.6.1. +* .NET 6.0 was added as a target. ## 3.0.0 (2020-11-16) ##