@@ -502,10 +502,6 @@
|
||||
<Project>{85B48234-8B31-4BE6-AF9C-665CC6866841}</Project>
|
||||
<Name>OpenRA.Irc</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\GeoIP\GeoIP.csproj">
|
||||
<Project>{021DDD6A-A608-424C-9A9A-252D8A9989E0}</Project>
|
||||
<Name>GeoIP</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
|
||||
@@ -12,6 +12,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using MaxMind.GeoIP2;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Network;
|
||||
using OpenRA.Primitives;
|
||||
@@ -197,9 +198,15 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
|
||||
public static string LookupCountry(string ip)
|
||||
{
|
||||
var ip2geo = new GeoIP.LookupService("GeoIP.dat", GeoIP.LookupService.GEOIP_MEMORY_CACHE);
|
||||
var country = ip2geo.getCountry(ip);
|
||||
return country.getName();
|
||||
try
|
||||
{
|
||||
return Game.GeoIpDatabase.Omni(ip).Country.Name;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Write("geoip", "LookupCountry failed: {0}", e);
|
||||
return "Unknown Location";
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetupClientWidget(Widget parent, Session.Slot s, Session.Client c, OrderManager orderManager, bool visible)
|
||||
|
||||
Reference in New Issue
Block a user