diff --git a/Logic/Logic.csproj b/Logic/Logic.csproj index 9e68995d..ca94b603 100644 --- a/Logic/Logic.csproj +++ b/Logic/Logic.csproj @@ -68,8 +68,12 @@ False ..\External Dependencies\bin\NBitcoin.dll + + ..\packages\NGeoIP.1.0.1\lib\net45\NGeoIP.dll + True + - ..\packages\RestSharp.104.2.0\lib\net4\RestSharp.dll + ..\packages\NGeoIP.1.0.1\lib\net45\RestSharp.dll True @@ -288,6 +292,7 @@ + diff --git a/Logic/Special/DummyGeoLookup.cs b/Logic/Special/DummyGeoLookup.cs new file mode 100644 index 00000000..11f6be02 --- /dev/null +++ b/Logic/Special/DummyGeoLookup.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Web; +using NGeoIP; +using NGeoIP.Client; + +namespace Swarmops.Logic.Special +{ + /// + /// The point of this class is to reference NGeoIP, so the DLL gets copied to the output folder for Site to use. + /// Kind of a kludgy hack, but works. + /// + public class DummyGeoLookup + { + public static string Lookup (string ip) + { + NGeoIP.Request request = new Request() + { + Format = Format.Json, + IP = HttpContext.Current.Request.UserHostAddress + }; + NGeoClient client = new NGeoClient(request); + NGeoIP.RawData rawData = client.Execute(); + + return rawData.CountryCode; + } + } +}