@@ -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