move GeoIP functions into it's own class

extract the geoip database .gz in-game
This commit is contained in:
Matthias Mailänder
2015-05-23 15:37:33 +02:00
parent 78f1e9fb2f
commit 8e919d3215
6 changed files with 56 additions and 28 deletions

View File

@@ -15,7 +15,6 @@ using System.IO;
using System.Linq;
using System.Net;
using System.Threading;
using MaxMind.GeoIP2;
using OpenRA.FileSystem;
using OpenRA.Graphics;
using OpenRA.Network;
@@ -44,8 +43,6 @@ namespace OpenRA
public static Renderer Renderer;
public static bool HasInputFocus = false;
public static DatabaseReader GeoIpDatabase;
public static OrderManager JoinServer(string host, int port, string password, bool recordReplay = true)
{
IConnection connection = new NetworkConnection(host, port);
@@ -216,14 +213,7 @@ namespace OpenRA
Settings.Server.AllowPortForward = false;
}
try
{
GeoIpDatabase = new DatabaseReader("GeoLite2-Country.mmdb");
}
catch (Exception e)
{
Log.Write("geoip", "DatabaseReader failed: {0}", e);
}
GeoIP.Initialize();
GlobalFileSystem.Mount(Platform.GameDir); // Needed to access shaders
var renderers = new[] { Settings.Graphics.Renderer, "Sdl2", null };