Skip to content

Commit

Permalink
Merge pull request #19 from maxmind/greg/strong-name
Browse files Browse the repository at this point in the history
Strongly name assembly. Make CLS compliant.
  • Loading branch information
eilara committed Sep 8, 2015
2 parents 48610c8 + 59540d4 commit 32e879c
Show file tree
Hide file tree
Showing 11 changed files with 293 additions and 6 deletions.
8 changes: 7 additions & 1 deletion MaxMind.Db.Test/MaxMind.Db.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>..\MaxMind.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net40\Newtonsoft.Json.dll</HintPath>
Expand Down Expand Up @@ -77,4 +83,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
8 changes: 8 additions & 0 deletions MaxMind.Db.Test/ReaderTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ public void TestStream()
}
}

[Test]
[ExpectedException(typeof(ArgumentNullException), ExpectedMessage = "The database stream must not be null.",
MatchType = MessageMatch.Contains)]
public void NullStreamThrowsArgumentNullException()
{
new Reader((Stream)null);
}

[Test]
[ExpectedException(typeof(InvalidDatabaseException), ExpectedMessage = "zero bytes left in the stream",
MatchType = MessageMatch.Contains)]
Expand Down
2 changes: 1 addition & 1 deletion MaxMind.Db.Test/TestData/MaxMind-DB
Submodule MaxMind-DB updated 36 files
+6 −6 MaxMind-DB-spec.md
+12 −0 perltidyrc
+32 −0 source-data/GeoIP2-Anonymous-IP-Test.json
+72 −0 source-data/GeoIP2-City-Test.json
+0 −285 source-data/GeoIP2-Connection-Type-Test.json
+0 −50 source-data/GeoIP2-Domain-Test.json
+36 −33,645 source-data/GeoIP2-ISP-Test.json
+12,456 −0 source-data/GeoIP2-Precision-City-Test.json
+12,593 −0 source-data/GeoIP2-Precision-ISP-Test.json
+3 −0 source-data/README
+ test-data/GeoIP2-Anonymous-IP-Test.mmdb
+ test-data/GeoIP2-City-Test-Broken-Double-Format.mmdb
+ test-data/GeoIP2-City-Test.mmdb
+ test-data/GeoIP2-Connection-Type-Test.mmdb
+ test-data/GeoIP2-Country-Test.mmdb
+ test-data/GeoIP2-Domain-Test.mmdb
+ test-data/GeoIP2-ISP-Test.mmdb
+ test-data/GeoIP2-Precision-City-Test.mmdb
+ test-data/GeoIP2-Precision-ISP-Test.mmdb
+ test-data/MaxMind-DB-no-ipv4-search-tree.mmdb
+ test-data/MaxMind-DB-string-value-entries.mmdb
+ test-data/MaxMind-DB-test-broken-pointers-24.mmdb
+ test-data/MaxMind-DB-test-broken-search-tree-24.mmdb
+ test-data/MaxMind-DB-test-decoder.mmdb
+ test-data/MaxMind-DB-test-ipv4-24.mmdb
+ test-data/MaxMind-DB-test-ipv4-28.mmdb
+ test-data/MaxMind-DB-test-ipv4-32.mmdb
+ test-data/MaxMind-DB-test-ipv6-24.mmdb
+ test-data/MaxMind-DB-test-ipv6-28.mmdb
+ test-data/MaxMind-DB-test-ipv6-32.mmdb
+ test-data/MaxMind-DB-test-mixed-24.mmdb
+ test-data/MaxMind-DB-test-mixed-28.mmdb
+ test-data/MaxMind-DB-test-mixed-32.mmdb
+ test-data/MaxMind-DB-test-nested.mmdb
+73 −15 test-data/write-test-data.pl
+5 −0 tidyall.ini
Binary file added MaxMind.Db/GlobalSuppressions.cs
Binary file not shown.
14 changes: 13 additions & 1 deletion MaxMind.Db/MaxMind.Db.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>MaxMind.Db.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand All @@ -55,6 +56,7 @@
<DocumentationFile>bin\Release\MaxMind.Db.xml</DocumentationFile>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RunCodeAnalysis>true</RunCodeAnalysis>
<CodeAnalysisRuleSet>MaxMind.Db.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -64,6 +66,7 @@
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CodeAnalysisRuleSet>MaxMind.Db.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>bin\x86\Release\</OutputPath>
Expand All @@ -72,6 +75,13 @@
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MaxMind.Db.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>..\MaxMind.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
Expand All @@ -95,6 +105,7 @@
<ItemGroup>
<Compile Include="Decoder.cs" />
<Compile Include="ArrayReader.cs" />
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="IByteReader.cs" />
<Compile Include="InvalidDatabaseException.cs" />
<Compile Include="MemoryMapReader.cs" />
Expand All @@ -115,6 +126,7 @@
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<None Include="MaxMind.Db.ruleset" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Expand All @@ -126,4 +138,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
232 changes: 232 additions & 0 deletions MaxMind.Db/MaxMind.Db.ruleset
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="Rules for MaxMind.Db" Description="Code analysis rules for MaxMind.Db.csproj." ToolsVersion="14.0">
<Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed">
<Rule Id="CA1000" Action="Warning" />
<Rule Id="CA1001" Action="Warning" />
<Rule Id="CA1002" Action="Warning" />
<Rule Id="CA1003" Action="Warning" />
<Rule Id="CA1004" Action="Warning" />
<Rule Id="CA1005" Action="Warning" />
<Rule Id="CA1006" Action="Warning" />
<Rule Id="CA1007" Action="Warning" />
<Rule Id="CA1008" Action="Warning" />
<Rule Id="CA1009" Action="Warning" />
<Rule Id="CA1010" Action="Warning" />
<Rule Id="CA1011" Action="Warning" />
<Rule Id="CA1012" Action="Warning" />
<Rule Id="CA1013" Action="Warning" />
<Rule Id="CA1014" Action="Warning" />
<Rule Id="CA1016" Action="Warning" />
<Rule Id="CA1017" Action="Warning" />
<Rule Id="CA1018" Action="Warning" />
<Rule Id="CA1019" Action="Warning" />
<Rule Id="CA1020" Action="Warning" />
<Rule Id="CA1021" Action="Warning" />
<Rule Id="CA1023" Action="Warning" />
<Rule Id="CA1024" Action="Warning" />
<Rule Id="CA1025" Action="Warning" />
<Rule Id="CA1026" Action="Warning" />
<Rule Id="CA1027" Action="Warning" />
<Rule Id="CA1028" Action="Warning" />
<Rule Id="CA1030" Action="Warning" />
<Rule Id="CA1031" Action="Warning" />
<Rule Id="CA1033" Action="Warning" />
<Rule Id="CA1034" Action="Warning" />
<Rule Id="CA1035" Action="Warning" />
<Rule Id="CA1036" Action="Warning" />
<Rule Id="CA1038" Action="Warning" />
<Rule Id="CA1039" Action="Warning" />
<Rule Id="CA1040" Action="Warning" />
<Rule Id="CA1041" Action="Warning" />
<Rule Id="CA1043" Action="Warning" />
<Rule Id="CA1044" Action="Warning" />
<Rule Id="CA1045" Action="Warning" />
<Rule Id="CA1046" Action="Warning" />
<Rule Id="CA1047" Action="Warning" />
<Rule Id="CA1048" Action="Warning" />
<Rule Id="CA1049" Action="Warning" />
<Rule Id="CA1050" Action="Warning" />
<Rule Id="CA1051" Action="Warning" />
<Rule Id="CA1052" Action="Warning" />
<Rule Id="CA1053" Action="Warning" />
<Rule Id="CA1054" Action="Warning" />
<Rule Id="CA1055" Action="Warning" />
<Rule Id="CA1056" Action="Warning" />
<Rule Id="CA1057" Action="Warning" />
<Rule Id="CA1059" Action="Warning" />
<Rule Id="CA1060" Action="Warning" />
<Rule Id="CA1061" Action="Warning" />
<Rule Id="CA1062" Action="Warning" />
<Rule Id="CA1063" Action="Warning" />
<Rule Id="CA1064" Action="Warning" />
<Rule Id="CA1065" Action="Warning" />
<Rule Id="CA1300" Action="Warning" />
<Rule Id="CA1301" Action="Warning" />
<Rule Id="CA1302" Action="Warning" />
<Rule Id="CA1303" Action="Warning" />
<Rule Id="CA1304" Action="Warning" />
<Rule Id="CA1306" Action="Warning" />
<Rule Id="CA1307" Action="Warning" />
<Rule Id="CA1308" Action="Warning" />
<Rule Id="CA1309" Action="Warning" />
<Rule Id="CA1400" Action="Warning" />
<Rule Id="CA1401" Action="Warning" />
<Rule Id="CA1402" Action="Warning" />
<Rule Id="CA1403" Action="Warning" />
<Rule Id="CA1404" Action="Warning" />
<Rule Id="CA1405" Action="Warning" />
<Rule Id="CA1406" Action="Warning" />
<Rule Id="CA1407" Action="Warning" />
<Rule Id="CA1408" Action="Warning" />
<Rule Id="CA1409" Action="Warning" />
<Rule Id="CA1410" Action="Warning" />
<Rule Id="CA1411" Action="Warning" />
<Rule Id="CA1412" Action="Warning" />
<Rule Id="CA1413" Action="Warning" />
<Rule Id="CA1414" Action="Warning" />
<Rule Id="CA1415" Action="Warning" />
<Rule Id="CA1500" Action="Warning" />
<Rule Id="CA1501" Action="Warning" />
<Rule Id="CA1502" Action="Warning" />
<Rule Id="CA1504" Action="Warning" />
<Rule Id="CA1505" Action="Warning" />
<Rule Id="CA1506" Action="Warning" />
<Rule Id="CA1600" Action="Warning" />
<Rule Id="CA1601" Action="Warning" />
<Rule Id="CA1700" Action="Warning" />
<Rule Id="CA1701" Action="Warning" />
<Rule Id="CA1702" Action="Warning" />
<Rule Id="CA1703" Action="Warning" />
<Rule Id="CA1704" Action="Warning" />
<Rule Id="CA1707" Action="Warning" />
<Rule Id="CA1708" Action="Warning" />
<Rule Id="CA1709" Action="Warning" />
<Rule Id="CA1710" Action="Warning" />
<Rule Id="CA1711" Action="Warning" />
<Rule Id="CA1712" Action="Warning" />
<Rule Id="CA1713" Action="Warning" />
<Rule Id="CA1714" Action="Warning" />
<Rule Id="CA1715" Action="Warning" />
<Rule Id="CA1716" Action="Warning" />
<Rule Id="CA1717" Action="Warning" />
<Rule Id="CA1719" Action="Warning" />
<Rule Id="CA1720" Action="Warning" />
<Rule Id="CA1721" Action="Warning" />
<Rule Id="CA1722" Action="Warning" />
<Rule Id="CA1724" Action="Warning" />
<Rule Id="CA1725" Action="Warning" />
<Rule Id="CA1726" Action="Warning" />
<Rule Id="CA1800" Action="Warning" />
<Rule Id="CA1801" Action="Warning" />
<Rule Id="CA1802" Action="Warning" />
<Rule Id="CA1804" Action="Warning" />
<Rule Id="CA1806" Action="Warning" />
<Rule Id="CA1809" Action="Warning" />
<Rule Id="CA1810" Action="Warning" />
<Rule Id="CA1811" Action="Warning" />
<Rule Id="CA1812" Action="Warning" />
<Rule Id="CA1813" Action="Warning" />
<Rule Id="CA1814" Action="Warning" />
<Rule Id="CA1815" Action="Warning" />
<Rule Id="CA1816" Action="Warning" />
<Rule Id="CA1819" Action="Warning" />
<Rule Id="CA1820" Action="Warning" />
<Rule Id="CA1821" Action="Warning" />
<Rule Id="CA1823" Action="Warning" />
<Rule Id="CA1824" Action="Warning" />
<Rule Id="CA1900" Action="Warning" />
<Rule Id="CA1901" Action="Warning" />
<Rule Id="CA1903" Action="Warning" />
<Rule Id="CA2000" Action="Warning" />
<Rule Id="CA2001" Action="Warning" />
<Rule Id="CA2002" Action="Warning" />
<Rule Id="CA2003" Action="Warning" />
<Rule Id="CA2004" Action="Warning" />
<Rule Id="CA2006" Action="Warning" />
<Rule Id="CA2100" Action="Warning" />
<Rule Id="CA2101" Action="Warning" />
<Rule Id="CA2102" Action="Warning" />
<Rule Id="CA2103" Action="Warning" />
<Rule Id="CA2104" Action="Warning" />
<Rule Id="CA2105" Action="Warning" />
<Rule Id="CA2106" Action="Warning" />
<Rule Id="CA2107" Action="Warning" />
<Rule Id="CA2108" Action="Warning" />
<Rule Id="CA2109" Action="Warning" />
<Rule Id="CA2111" Action="Warning" />
<Rule Id="CA2112" Action="Warning" />
<Rule Id="CA2114" Action="Warning" />
<Rule Id="CA2115" Action="Warning" />
<Rule Id="CA2116" Action="Warning" />
<Rule Id="CA2117" Action="Warning" />
<Rule Id="CA2118" Action="Warning" />
<Rule Id="CA2119" Action="Warning" />
<Rule Id="CA2120" Action="Warning" />
<Rule Id="CA2121" Action="Warning" />
<Rule Id="CA2122" Action="Warning" />
<Rule Id="CA2123" Action="Warning" />
<Rule Id="CA2124" Action="Warning" />
<Rule Id="CA2126" Action="Warning" />
<Rule Id="CA2130" Action="Warning" />
<Rule Id="CA2131" Action="Warning" />
<Rule Id="CA2132" Action="Warning" />
<Rule Id="CA2133" Action="Warning" />
<Rule Id="CA2134" Action="Warning" />
<Rule Id="CA2135" Action="Warning" />
<Rule Id="CA2136" Action="Warning" />
<Rule Id="CA2137" Action="Warning" />
<Rule Id="CA2138" Action="Warning" />
<Rule Id="CA2139" Action="Warning" />
<Rule Id="CA2140" Action="Warning" />
<Rule Id="CA2141" Action="Warning" />
<Rule Id="CA2142" Action="Warning" />
<Rule Id="CA2143" Action="Warning" />
<Rule Id="CA2144" Action="Warning" />
<Rule Id="CA2145" Action="Warning" />
<Rule Id="CA2146" Action="Warning" />
<Rule Id="CA2147" Action="Warning" />
<Rule Id="CA2149" Action="Warning" />
<Rule Id="CA2151" Action="Warning" />
<Rule Id="CA2200" Action="Warning" />
<Rule Id="CA2201" Action="Warning" />
<Rule Id="CA2202" Action="Warning" />
<Rule Id="CA2205" Action="Warning" />
<Rule Id="CA2207" Action="Warning" />
<Rule Id="CA2208" Action="Warning" />
<Rule Id="CA2210" Action="Warning" />
<Rule Id="CA2211" Action="Warning" />
<Rule Id="CA2212" Action="Warning" />
<Rule Id="CA2213" Action="Warning" />
<Rule Id="CA2214" Action="Warning" />
<Rule Id="CA2215" Action="Warning" />
<Rule Id="CA2216" Action="Warning" />
<Rule Id="CA2217" Action="Warning" />
<Rule Id="CA2218" Action="Warning" />
<Rule Id="CA2219" Action="Warning" />
<Rule Id="CA2220" Action="Warning" />
<Rule Id="CA2221" Action="Warning" />
<Rule Id="CA2222" Action="Warning" />
<Rule Id="CA2223" Action="Warning" />
<Rule Id="CA2224" Action="Warning" />
<Rule Id="CA2225" Action="Warning" />
<Rule Id="CA2226" Action="Warning" />
<Rule Id="CA2227" Action="Warning" />
<Rule Id="CA2228" Action="Warning" />
<Rule Id="CA2229" Action="Warning" />
<Rule Id="CA2230" Action="Warning" />
<Rule Id="CA2231" Action="Warning" />
<Rule Id="CA2232" Action="Warning" />
<Rule Id="CA2233" Action="Warning" />
<Rule Id="CA2234" Action="Warning" />
<Rule Id="CA2235" Action="Warning" />
<Rule Id="CA2236" Action="Warning" />
<Rule Id="CA2237" Action="Warning" />
<Rule Id="CA2238" Action="Warning" />
<Rule Id="CA2239" Action="Warning" />
<Rule Id="CA2240" Action="Warning" />
<Rule Id="CA2241" Action="Warning" />
<Rule Id="CA2242" Action="Warning" />
<Rule Id="CA2243" Action="Warning" />
<Rule Id="CA5122" Action="Warning" />
</Rules>
</RuleSet>
7 changes: 7 additions & 0 deletions MaxMind.Db/Metadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,18 @@ public class Metadata
/// <summary>
/// The major version number for the MaxMind DB binary format used by the database.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
[JsonProperty("binary_format_major_version")]
public int BinaryFormatMajorVersion { get; private set; }

/// <summary>
/// The minor version number for the MaxMind DB binary format used by the database.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
[JsonProperty("binary_format_minor_version")]
public int BinaryFormatMinorVersion { get; private set; }

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
[JsonProperty("build_epoch")]
internal long BuildEpoch { get; private set; }

Expand All @@ -39,24 +42,28 @@ public class Metadata
/// <summary>
/// The MaxMind DB database type.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
[JsonProperty("database_type")]
public string DatabaseType { get; private set; }

/// <summary>
/// A map from locale codes to the database description in that language.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
[JsonProperty("description")]
public Hashtable Description { get; private set; }

/// <summary>
/// The IP version that the database supports. This will be 4 or 6.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
[JsonProperty("ip_version")]
public int IPVersion { get; private set; }

/// <summary>
/// A list of locale codes for languages that the database supports.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
[JsonProperty("languages")]
public List<string> Languages { get; private set; }

Expand Down
Loading

0 comments on commit 32e879c

Please sign in to comment.