Skip to content

Commit

Permalink
Merge pull request #108 from maxmind/greg/netstandard2.0
Browse files Browse the repository at this point in the history
Add back netstandard2.0 support
  • Loading branch information
ugexe committed Feb 3, 2022
2 parents 4d7997b + 9b3acce commit 1fa735a
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 deletions.
3 changes: 2 additions & 1 deletion MaxMind.Db.Benchmark/MaxMind.Db.Benchmark.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
<PropertyGroup>
<Description>Benchmark project to validate .NET reader for the MaxMind DB file format</Description>
<VersionPrefix>4.0.0</VersionPrefix>
<TargetFrameworks>net6.0;net5.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net6.0;net5.0;net461;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">net6.0;net5.0;netcoreapp3.1</TargetFrameworks>
<AssemblyName>MaxMind.Db.Benchmark</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>MaxMind.Db.Benchmark</PackageId>
Expand Down
3 changes: 2 additions & 1 deletion MaxMind.Db.Test/MaxMind.Db.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
<PropertyGroup>
<Description>Test project to validate .NET reader for the MaxMind DB file format</Description>
<VersionPrefix>4.0.0</VersionPrefix>
<TargetFrameworks>net6.0;net5.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net6.0;net5.0;net461;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">net6.0;net5.0;netcoreapp3.1</TargetFrameworks>
<AssemblyName>MaxMind.Db.Test</AssemblyName>
<AssemblyOriginatorKeyFile>../MaxMind.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
Expand Down
6 changes: 6 additions & 0 deletions MaxMind.Db/Buffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,13 @@ internal double ReadDouble(long offset)
/// </summary>
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
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion MaxMind.Db/MaxMind.Db.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<Description>.NET reader for the MaxMind DB file format</Description>
<VersionPrefix>4.0.0</VersionPrefix>
<TargetFrameworks>net6.0;net5.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net6.0;net5.0;netstandard2.1;netstandard2.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyName>MaxMind.Db</AssemblyName>
<AssemblyOriginatorKeyFile>../MaxMind.snk</AssemblyOriginatorKeyFile>
Expand Down
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 ###
Expand Down
3 changes: 2 additions & 1 deletion releasenotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) ##

Expand Down

0 comments on commit 1fa735a

Please sign in to comment.