translate the IP to a country
using http://dev.maxmind.com/geoip/legacy/geolite/ code from https://github.com/maxmind/geoip-api-csharp2
This commit is contained in:
3
AUTHORS
3
AUTHORS
@@ -65,6 +65,9 @@ Also thanks to:
|
|||||||
* Vladimir Komarov (VrKomarov)
|
* Vladimir Komarov (VrKomarov)
|
||||||
* Wuschel
|
* Wuschel
|
||||||
|
|
||||||
|
Using GeoLite data created by MaxMind and
|
||||||
|
distributed under the CC BY-SA 3.0 license.
|
||||||
|
|
||||||
Finally, special thanks goes to the original teams
|
Finally, special thanks goes to the original teams
|
||||||
at Westwood Studios and EA for creating the classic
|
at Westwood Studios and EA for creating the classic
|
||||||
games that inspired the creation of OpenRA.
|
games that inspired the creation of OpenRA.
|
||||||
|
|||||||
165
GeoIP/COPYING
Normal file
165
GeoIP/COPYING
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
|
||||||
|
This version of the GNU Lesser General Public License incorporates
|
||||||
|
the terms and conditions of version 3 of the GNU General Public
|
||||||
|
License, supplemented by the additional permissions listed below.
|
||||||
|
|
||||||
|
0. Additional Definitions.
|
||||||
|
|
||||||
|
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||||
|
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||||
|
General Public License.
|
||||||
|
|
||||||
|
"The Library" refers to a covered work governed by this License,
|
||||||
|
other than an Application or a Combined Work as defined below.
|
||||||
|
|
||||||
|
An "Application" is any work that makes use of an interface provided
|
||||||
|
by the Library, but which is not otherwise based on the Library.
|
||||||
|
Defining a subclass of a class defined by the Library is deemed a mode
|
||||||
|
of using an interface provided by the Library.
|
||||||
|
|
||||||
|
A "Combined Work" is a work produced by combining or linking an
|
||||||
|
Application with the Library. The particular version of the Library
|
||||||
|
with which the Combined Work was made is also called the "Linked
|
||||||
|
Version".
|
||||||
|
|
||||||
|
The "Minimal Corresponding Source" for a Combined Work means the
|
||||||
|
Corresponding Source for the Combined Work, excluding any source code
|
||||||
|
for portions of the Combined Work that, considered in isolation, are
|
||||||
|
based on the Application, and not on the Linked Version.
|
||||||
|
|
||||||
|
The "Corresponding Application Code" for a Combined Work means the
|
||||||
|
object code and/or source code for the Application, including any data
|
||||||
|
and utility programs needed for reproducing the Combined Work from the
|
||||||
|
Application, but excluding the System Libraries of the Combined Work.
|
||||||
|
|
||||||
|
1. Exception to Section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
You may convey a covered work under sections 3 and 4 of this License
|
||||||
|
without being bound by section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
2. Conveying Modified Versions.
|
||||||
|
|
||||||
|
If you modify a copy of the Library, and, in your modifications, a
|
||||||
|
facility refers to a function or data to be supplied by an Application
|
||||||
|
that uses the facility (other than as an argument passed when the
|
||||||
|
facility is invoked), then you may convey a copy of the modified
|
||||||
|
version:
|
||||||
|
|
||||||
|
a) under this License, provided that you make a good faith effort to
|
||||||
|
ensure that, in the event an Application does not supply the
|
||||||
|
function or data, the facility still operates, and performs
|
||||||
|
whatever part of its purpose remains meaningful, or
|
||||||
|
|
||||||
|
b) under the GNU GPL, with none of the additional permissions of
|
||||||
|
this License applicable to that copy.
|
||||||
|
|
||||||
|
3. Object Code Incorporating Material from Library Header Files.
|
||||||
|
|
||||||
|
The object code form of an Application may incorporate material from
|
||||||
|
a header file that is part of the Library. You may convey such object
|
||||||
|
code under terms of your choice, provided that, if the incorporated
|
||||||
|
material is not limited to numerical parameters, data structure
|
||||||
|
layouts and accessors, or small macros, inline functions and templates
|
||||||
|
(ten or fewer lines in length), you do both of the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the object code that the
|
||||||
|
Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
4. Combined Works.
|
||||||
|
|
||||||
|
You may convey a Combined Work under terms of your choice that,
|
||||||
|
taken together, effectively do not restrict modification of the
|
||||||
|
portions of the Library contained in the Combined Work and reverse
|
||||||
|
engineering for debugging such modifications, if you also do each of
|
||||||
|
the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the Combined Work that
|
||||||
|
the Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
c) For a Combined Work that displays copyright notices during
|
||||||
|
execution, include the copyright notice for the Library among
|
||||||
|
these notices, as well as a reference directing the user to the
|
||||||
|
copies of the GNU GPL and this license document.
|
||||||
|
|
||||||
|
d) Do one of the following:
|
||||||
|
|
||||||
|
0) Convey the Minimal Corresponding Source under the terms of this
|
||||||
|
License, and the Corresponding Application Code in a form
|
||||||
|
suitable for, and under terms that permit, the user to
|
||||||
|
recombine or relink the Application with a modified version of
|
||||||
|
the Linked Version to produce a modified Combined Work, in the
|
||||||
|
manner specified by section 6 of the GNU GPL for conveying
|
||||||
|
Corresponding Source.
|
||||||
|
|
||||||
|
1) Use a suitable shared library mechanism for linking with the
|
||||||
|
Library. A suitable mechanism is one that (a) uses at run time
|
||||||
|
a copy of the Library already present on the user's computer
|
||||||
|
system, and (b) will operate properly with a modified version
|
||||||
|
of the Library that is interface-compatible with the Linked
|
||||||
|
Version.
|
||||||
|
|
||||||
|
e) Provide Installation Information, but only if you would otherwise
|
||||||
|
be required to provide such information under section 6 of the
|
||||||
|
GNU GPL, and only to the extent that such information is
|
||||||
|
necessary to install and execute a modified version of the
|
||||||
|
Combined Work produced by recombining or relinking the
|
||||||
|
Application with a modified version of the Linked Version. (If
|
||||||
|
you use option 4d0, the Installation Information must accompany
|
||||||
|
the Minimal Corresponding Source and Corresponding Application
|
||||||
|
Code. If you use option 4d1, you must provide the Installation
|
||||||
|
Information in the manner specified by section 6 of the GNU GPL
|
||||||
|
for conveying Corresponding Source.)
|
||||||
|
|
||||||
|
5. Combined Libraries.
|
||||||
|
|
||||||
|
You may place library facilities that are a work based on the
|
||||||
|
Library side by side in a single library together with other library
|
||||||
|
facilities that are not Applications and are not covered by this
|
||||||
|
License, and convey such a combined library under terms of your
|
||||||
|
choice, if you do both of the following:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work based
|
||||||
|
on the Library, uncombined with any other library facilities,
|
||||||
|
conveyed under the terms of this License.
|
||||||
|
|
||||||
|
b) Give prominent notice with the combined library that part of it
|
||||||
|
is a work based on the Library, and explaining where to find the
|
||||||
|
accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
6. Revised Versions of the GNU Lesser General Public License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the GNU Lesser General Public License from time to time. Such new
|
||||||
|
versions will be similar in spirit to the present version, but may
|
||||||
|
differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Library as you received it specifies that a certain numbered version
|
||||||
|
of the GNU Lesser General Public License "or any later version"
|
||||||
|
applies to it, you have the option of following the terms and
|
||||||
|
conditions either of that published version or of any later version
|
||||||
|
published by the Free Software Foundation. If the Library as you
|
||||||
|
received it does not specify a version number of the GNU Lesser
|
||||||
|
General Public License, you may choose any version of the GNU Lesser
|
||||||
|
General Public License ever published by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Library as you received it specifies that a proxy can decide
|
||||||
|
whether future versions of the GNU Lesser General Public License shall
|
||||||
|
apply, that proxy's public statement of acceptance of any version is
|
||||||
|
permanent authorization for you to choose that version for the
|
||||||
|
Library.
|
||||||
63
GeoIP/Country.cs
Normal file
63
GeoIP/Country.cs
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2008 MaxMind Inc. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace GeoIP
|
||||||
|
{
|
||||||
|
public class Country
|
||||||
|
{
|
||||||
|
String code;
|
||||||
|
String name;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Creates a new Country.
|
||||||
|
*
|
||||||
|
* @param code the country code.
|
||||||
|
* @param name the country name.
|
||||||
|
*/
|
||||||
|
public Country(String code, String name)
|
||||||
|
{
|
||||||
|
this.code = code;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns the ISO two-letter country code of this country.
|
||||||
|
*
|
||||||
|
* @return the country code.
|
||||||
|
*/
|
||||||
|
public String getCode()
|
||||||
|
{
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns the name of this country.
|
||||||
|
*
|
||||||
|
* @return the country name.
|
||||||
|
*/
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
106
GeoIP/DatabaseInfo.cs
Normal file
106
GeoIP/DatabaseInfo.cs
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2008 MaxMind Inc. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace GeoIP
|
||||||
|
{
|
||||||
|
public class DatabaseInfo
|
||||||
|
{
|
||||||
|
public static int COUNTRY_EDITION = 1;
|
||||||
|
public static int REGION_EDITION_REV0 = 7;
|
||||||
|
public static int REGION_EDITION_REV1 = 3;
|
||||||
|
public static int CITY_EDITION_REV0 = 6;
|
||||||
|
public static int CITY_EDITION_REV1 = 2;
|
||||||
|
public static int ORG_EDITION = 5;
|
||||||
|
public static int ISP_EDITION = 4;
|
||||||
|
public static int PROXY_EDITION = 8;
|
||||||
|
public static int ASNUM_EDITION = 9;
|
||||||
|
public static int NETSPEED_EDITION = 10;
|
||||||
|
public static int DOMAIN_EDITION = 11;
|
||||||
|
public static int COUNTRY_EDITION_V6 = 12;
|
||||||
|
public static int ASNUM_EDITION_V6 = 21;
|
||||||
|
public static int ISP_EDITION_V6 = 22;
|
||||||
|
public static int ORG_EDITION_V6 = 23;
|
||||||
|
public static int DOMAIN_EDITION_V6 = 24;
|
||||||
|
public static int CITY_EDITION_REV1_V6 = 30;
|
||||||
|
public static int CITY_EDITION_REV0_V6 = 31;
|
||||||
|
public static int NETSPEED_EDITION_REV1 = 32;
|
||||||
|
public static int NETSPEED_EDITION_REV1_V6 = 33;
|
||||||
|
|
||||||
|
private String info;
|
||||||
|
/**
|
||||||
|
* Creates a new DatabaseInfo object given the database info String.
|
||||||
|
* @param info
|
||||||
|
*/
|
||||||
|
|
||||||
|
public DatabaseInfo(String info)
|
||||||
|
{
|
||||||
|
this.info = info;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getType()
|
||||||
|
{
|
||||||
|
if ((info == null) | (info == ""))
|
||||||
|
{
|
||||||
|
return COUNTRY_EDITION;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Get the type code from the database info string and then
|
||||||
|
// subtract 105 from the value to preserve compatability with
|
||||||
|
// databases from April 2003 and earlier.
|
||||||
|
return Convert.ToInt32(info.Substring(4, 3)) - 105;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the date of the database.
|
||||||
|
*
|
||||||
|
* @return the date of the database.
|
||||||
|
*/
|
||||||
|
public DateTime getDate()
|
||||||
|
{
|
||||||
|
for (int i=0; i<info.Length-9; i++)
|
||||||
|
{
|
||||||
|
if (Char.IsWhiteSpace(info[i]) == true)
|
||||||
|
{
|
||||||
|
var dateString = info.Substring(i+1, 8);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return DateTime.ParseExact(dateString,"yyyyMMdd",null);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.Write(e.Message);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return DateTime.Now;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
44
GeoIP/GeoIP.csproj
Normal file
44
GeoIP/GeoIP.csproj
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProductVersion>10.0.0</ProductVersion>
|
||||||
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
|
<ProjectGuid>{021DDD6A-A608-424C-9A9A-252D8A9989E0}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<RootNamespace>GeoIP</RootNamespace>
|
||||||
|
<AssemblyName>GeoIP</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>..</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<ConsolePause>false</ConsolePause>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>..</OutputPath>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<ConsolePause>false</ConsolePause>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Country.cs" />
|
||||||
|
<Compile Include="DatabaseInfo.cs" />
|
||||||
|
<Compile Include="Location.cs" />
|
||||||
|
<Compile Include="LookupService.cs" />
|
||||||
|
<Compile Include="Region.cs" />
|
||||||
|
<Compile Include="RegionName.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
|
</Project>
|
||||||
67
GeoIP/Location.cs
Normal file
67
GeoIP/Location.cs
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2008 MaxMind Inc. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace GeoIP
|
||||||
|
{
|
||||||
|
public class Location
|
||||||
|
{
|
||||||
|
public String countryCode;
|
||||||
|
public String countryName;
|
||||||
|
public String region;
|
||||||
|
public String city;
|
||||||
|
public String postalCode;
|
||||||
|
public double latitude;
|
||||||
|
public double longitude;
|
||||||
|
public int dma_code;
|
||||||
|
public int area_code;
|
||||||
|
public String regionName;
|
||||||
|
public int metro_code;
|
||||||
|
|
||||||
|
private static double EARTH_DIAMETER = 2 * 6378.2;
|
||||||
|
private static double PI = 3.14159265;
|
||||||
|
private static double RAD_CONVERT = PI / 180;
|
||||||
|
|
||||||
|
public double distance (Location loc)
|
||||||
|
{
|
||||||
|
double delta_lat, delta_lon;
|
||||||
|
double temp;
|
||||||
|
|
||||||
|
double lat1 = latitude;
|
||||||
|
double lon1 = longitude;
|
||||||
|
double lat2 = loc.latitude;
|
||||||
|
double lon2 = loc.longitude;
|
||||||
|
|
||||||
|
// convert degrees to radians
|
||||||
|
lat1 *= RAD_CONVERT;
|
||||||
|
lat2 *= RAD_CONVERT;
|
||||||
|
|
||||||
|
// find the deltas
|
||||||
|
delta_lat = lat2 - lat1;
|
||||||
|
delta_lon = (lon2 - lon1) * RAD_CONVERT;
|
||||||
|
|
||||||
|
// Find the great circle distance
|
||||||
|
temp = Math.Pow(Math.Sin(delta_lat/2), 2) + Math.Cos(lat1) * Math.Cos(lat2) * Math.Pow(Math.Sin(delta_lon/2), 2);
|
||||||
|
return EARTH_DIAMETER * Math.Atan2(Math.Sqrt(temp), Math.Sqrt(1-temp));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1000
GeoIP/LookupService.cs
Normal file
1000
GeoIP/LookupService.cs
Normal file
File diff suppressed because it is too large
Load Diff
53
GeoIP/Region.cs
Normal file
53
GeoIP/Region.cs
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2008 MaxMind Inc. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
public class Region
|
||||||
|
{
|
||||||
|
public String countryCode;
|
||||||
|
public String countryName;
|
||||||
|
public String region;
|
||||||
|
|
||||||
|
public Region() { }
|
||||||
|
|
||||||
|
public Region(String countryCode,String countryName,String region)
|
||||||
|
{
|
||||||
|
this.countryCode = countryCode;
|
||||||
|
this.countryName = countryName;
|
||||||
|
this.region = region;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getcountryCode()
|
||||||
|
{
|
||||||
|
return countryCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getcountryName()
|
||||||
|
{
|
||||||
|
return countryName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getregion()
|
||||||
|
{
|
||||||
|
return region;
|
||||||
|
}
|
||||||
|
}
|
||||||
4489
GeoIP/RegionName.cs
Normal file
4489
GeoIP/RegionName.cs
Normal file
File diff suppressed because it is too large
Load Diff
12
Makefile
12
Makefile
@@ -71,6 +71,13 @@ fileformats_LIBS = $(COMMON_LIBS) thirdparty/Tao/Tao.Sdl.dll System.Windows.Form
|
|||||||
PROGRAMS = fileformats
|
PROGRAMS = fileformats
|
||||||
fileformats: $(fileformats_TARGET)
|
fileformats: $(fileformats_TARGET)
|
||||||
|
|
||||||
|
geoip_SRCS := $(shell find GeoIP/ -iname '*.cs')
|
||||||
|
geoip_TARGET = GeoIP.dll
|
||||||
|
geoip_KIND = library
|
||||||
|
geoip_LIBS = $(COMMON_LIBS)
|
||||||
|
PROGRAMS += geoip
|
||||||
|
geoip: $(geoip_TARGET)
|
||||||
|
|
||||||
game_SRCS := $(shell find OpenRA.Game/ -iname '*.cs')
|
game_SRCS := $(shell find OpenRA.Game/ -iname '*.cs')
|
||||||
game_TARGET = OpenRA.Game.exe
|
game_TARGET = OpenRA.Game.exe
|
||||||
game_KIND = winexe
|
game_KIND = winexe
|
||||||
@@ -125,8 +132,8 @@ STD_MOD_DEPS = $(STD_MOD_LIBS) $(ralint_TARGET)
|
|||||||
mod_ra_SRCS := $(shell find OpenRA.Mods.RA/ -iname '*.cs')
|
mod_ra_SRCS := $(shell find OpenRA.Mods.RA/ -iname '*.cs')
|
||||||
mod_ra_TARGET = mods/ra/OpenRA.Mods.RA.dll
|
mod_ra_TARGET = mods/ra/OpenRA.Mods.RA.dll
|
||||||
mod_ra_KIND = library
|
mod_ra_KIND = library
|
||||||
mod_ra_DEPS = $(STD_MOD_DEPS) $(utility_TARGET)
|
mod_ra_DEPS = $(STD_MOD_DEPS) $(utility_TARGET) $(geoip_TARGET)
|
||||||
mod_ra_LIBS = $(COMMON_LIBS) $(STD_MOD_LIBS) $(utility_TARGET)
|
mod_ra_LIBS = $(COMMON_LIBS) $(STD_MOD_LIBS) $(utility_TARGET) $(geoip_TARGET)
|
||||||
mod_ra_EXTRA_CMDS = mono --debug RALint.exe ra
|
mod_ra_EXTRA_CMDS = mono --debug RALint.exe ra
|
||||||
PROGRAMS += mod_ra
|
PROGRAMS += mod_ra
|
||||||
mod_ra: $(mod_ra_TARGET)
|
mod_ra: $(mod_ra_TARGET)
|
||||||
@@ -292,6 +299,7 @@ install-core: default
|
|||||||
@$(INSTALL_PROGRAM) $(mod_d2k_TARGET) "$(DATA_INSTALL_DIR)/mods/d2k"
|
@$(INSTALL_PROGRAM) $(mod_d2k_TARGET) "$(DATA_INSTALL_DIR)/mods/d2k"
|
||||||
|
|
||||||
@$(INSTALL_DATA) "global mix database.dat" "$(DATA_INSTALL_DIR)/global mix database.dat"
|
@$(INSTALL_DATA) "global mix database.dat" "$(DATA_INSTALL_DIR)/global mix database.dat"
|
||||||
|
@$(INSTALL_DATA) "GeoIP.dat" "$(DATA_INSTALL_DIR)/GeoIP.dat"
|
||||||
@$(INSTALL_DATA) AUTHORS "$(DATA_INSTALL_DIR)/AUTHORS"
|
@$(INSTALL_DATA) AUTHORS "$(DATA_INSTALL_DIR)/AUTHORS"
|
||||||
|
|
||||||
@$(CP_R) glsl "$(DATA_INSTALL_DIR)"
|
@$(CP_R) glsl "$(DATA_INSTALL_DIR)"
|
||||||
|
|||||||
192
OpenRA.sln
192
OpenRA.sln
@@ -35,6 +35,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Mods.D2k", "OpenRA.M
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Mods.TS", "OpenRA.Mods.TS\OpenRA.Mods.TS.csproj", "{5457CBF5-4CE4-421E-A8BF-9FD6C9732E1D}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Mods.TS", "OpenRA.Mods.TS\OpenRA.Mods.TS.csproj", "{5457CBF5-4CE4-421E-A8BF-9FD6C9732E1D}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GeoIP", "GeoIP\GeoIP.csproj", "{021DDD6A-A608-424C-9A9A-252D8A9989E0}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -51,6 +53,14 @@ Global
|
|||||||
{00038B75-405B-44F5-8691-BD2546DBE224}.Release|Any CPU.Build.0 = Release|Any CPU
|
{00038B75-405B-44F5-8691-BD2546DBE224}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{00038B75-405B-44F5-8691-BD2546DBE224}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
{00038B75-405B-44F5-8691-BD2546DBE224}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
{00038B75-405B-44F5-8691-BD2546DBE224}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
{00038B75-405B-44F5-8691-BD2546DBE224}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||||
|
{021DDD6A-A608-424C-9A9A-252D8A9989E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{021DDD6A-A608-424C-9A9A-252D8A9989E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{021DDD6A-A608-424C-9A9A-252D8A9989E0}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||||
|
{021DDD6A-A608-424C-9A9A-252D8A9989E0}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||||
|
{021DDD6A-A608-424C-9A9A-252D8A9989E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{021DDD6A-A608-424C-9A9A-252D8A9989E0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{021DDD6A-A608-424C-9A9A-252D8A9989E0}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
|
{021DDD6A-A608-424C-9A9A-252D8A9989E0}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||||
{0C4AEC1A-E7D5-4114-8CCD-3EEC82872981}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{0C4AEC1A-E7D5-4114-8CCD-3EEC82872981}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{0C4AEC1A-E7D5-4114-8CCD-3EEC82872981}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{0C4AEC1A-E7D5-4114-8CCD-3EEC82872981}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{0C4AEC1A-E7D5-4114-8CCD-3EEC82872981}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
{0C4AEC1A-E7D5-4114-8CCD-3EEC82872981}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||||
@@ -157,6 +167,188 @@ Global
|
|||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(MonoDevelopProperties) = preSolution
|
GlobalSection(MonoDevelopProperties) = preSolution
|
||||||
StartupItem = OpenRA.Game\OpenRA.Game.csproj
|
StartupItem = OpenRA.Game\OpenRA.Game.csproj
|
||||||
|
Policies = $0
|
||||||
|
$0.DotNetNamingPolicy = $1
|
||||||
|
$1.DirectoryNamespaceAssociation = None
|
||||||
|
$1.ResourceNamePolicy = FileFormatDefault
|
||||||
|
$0.TextStylePolicy = $2
|
||||||
|
$2.TabsToSpaces = False
|
||||||
|
$2.NoTabsAfterNonTabs = True
|
||||||
|
$2.inheritsSet = VisualStudio
|
||||||
|
$2.inheritsScope = text/plain
|
||||||
|
$2.scope = text/x-csharp
|
||||||
|
$0.CSharpFormattingPolicy = $3
|
||||||
|
$3.IndentSwitchBody = True
|
||||||
|
$3.AnonymousMethodBraceStyle = NextLine
|
||||||
|
$3.PropertyBraceStyle = NextLine
|
||||||
|
$3.PropertyGetBraceStyle = NextLine
|
||||||
|
$3.PropertySetBraceStyle = NextLine
|
||||||
|
$3.EventBraceStyle = NextLine
|
||||||
|
$3.EventAddBraceStyle = NextLine
|
||||||
|
$3.EventRemoveBraceStyle = NextLine
|
||||||
|
$3.StatementBraceStyle = NextLine
|
||||||
|
$3.ArrayInitializerBraceStyle = NextLine
|
||||||
|
$3.BeforeMethodDeclarationParentheses = False
|
||||||
|
$3.BeforeMethodCallParentheses = False
|
||||||
|
$3.BeforeConstructorDeclarationParentheses = False
|
||||||
|
$3.BeforeDelegateDeclarationParentheses = False
|
||||||
|
$3.NewParentheses = False
|
||||||
|
$3.inheritsSet = Mono
|
||||||
|
$3.inheritsScope = text/x-csharp
|
||||||
|
$3.scope = text/x-csharp
|
||||||
|
$0.TextStylePolicy = $4
|
||||||
|
$4.inheritsSet = VisualStudio
|
||||||
|
$4.inheritsScope = text/plain
|
||||||
|
$4.scope = text/plain
|
||||||
|
$0.TextStylePolicy = $5
|
||||||
|
$5.inheritsSet = null
|
||||||
|
$5.scope = text/microsoft-resx
|
||||||
|
$0.XmlFormattingPolicy = $6
|
||||||
|
$6.inheritsSet = null
|
||||||
|
$6.scope = text/microsoft-resx
|
||||||
|
$0.TextStylePolicy = $7
|
||||||
|
$7.inheritsSet = Mono
|
||||||
|
$7.inheritsScope = text/plain
|
||||||
|
$7.scope = application/xml
|
||||||
|
$0.XmlFormattingPolicy = $8
|
||||||
|
$8.inheritsSet = Mono
|
||||||
|
$8.inheritsScope = application/xml
|
||||||
|
$8.scope = application/xml
|
||||||
|
$0.StandardHeader = $9
|
||||||
|
$9.Text = @#region Copyright & License Information\n/*\n * Copyright 2007-${Year} The OpenRA Developers (see AUTHORS)\n * This file is part of OpenRA, which is free software. It is made\n * available to you under the terms of the GNU General Public License\n * as published by the Free Software Foundation. For more information,\n * see COPYING.\n */\n#endregion
|
||||||
|
$9.IncludeInNewFiles = True
|
||||||
|
$0.NameConventionPolicy = $10
|
||||||
|
$10.Rules = $11
|
||||||
|
$11.NamingRule = $12
|
||||||
|
$12.Name = Namespaces
|
||||||
|
$12.AffectedEntity = Namespace
|
||||||
|
$12.VisibilityMask = VisibilityMask
|
||||||
|
$12.NamingStyle = PascalCase
|
||||||
|
$12.IncludeInstanceMembers = True
|
||||||
|
$12.IncludeStaticEntities = True
|
||||||
|
$11.NamingRule = $13
|
||||||
|
$13.Name = Types
|
||||||
|
$13.AffectedEntity = Class, Struct, Enum, Delegate
|
||||||
|
$13.VisibilityMask = Public
|
||||||
|
$13.NamingStyle = PascalCase
|
||||||
|
$13.IncludeInstanceMembers = True
|
||||||
|
$13.IncludeStaticEntities = True
|
||||||
|
$11.NamingRule = $14
|
||||||
|
$14.Name = Interfaces
|
||||||
|
$14.RequiredPrefixes = $15
|
||||||
|
$15.String = I
|
||||||
|
$14.AffectedEntity = Interface
|
||||||
|
$14.VisibilityMask = Public
|
||||||
|
$14.NamingStyle = PascalCase
|
||||||
|
$14.IncludeInstanceMembers = True
|
||||||
|
$14.IncludeStaticEntities = True
|
||||||
|
$11.NamingRule = $16
|
||||||
|
$16.Name = Attributes
|
||||||
|
$16.RequiredSuffixes = $17
|
||||||
|
$17.String = Attribute
|
||||||
|
$16.AffectedEntity = CustomAttributes
|
||||||
|
$16.VisibilityMask = Public
|
||||||
|
$16.NamingStyle = PascalCase
|
||||||
|
$16.IncludeInstanceMembers = True
|
||||||
|
$16.IncludeStaticEntities = True
|
||||||
|
$11.NamingRule = $18
|
||||||
|
$18.Name = Event Arguments
|
||||||
|
$18.RequiredSuffixes = $19
|
||||||
|
$19.String = EventArgs
|
||||||
|
$18.AffectedEntity = CustomEventArgs
|
||||||
|
$18.VisibilityMask = Public
|
||||||
|
$18.NamingStyle = PascalCase
|
||||||
|
$18.IncludeInstanceMembers = True
|
||||||
|
$18.IncludeStaticEntities = True
|
||||||
|
$11.NamingRule = $20
|
||||||
|
$20.Name = Exceptions
|
||||||
|
$20.RequiredSuffixes = $21
|
||||||
|
$21.String = Exception
|
||||||
|
$20.AffectedEntity = CustomExceptions
|
||||||
|
$20.VisibilityMask = VisibilityMask
|
||||||
|
$20.NamingStyle = PascalCase
|
||||||
|
$20.IncludeInstanceMembers = True
|
||||||
|
$20.IncludeStaticEntities = True
|
||||||
|
$11.NamingRule = $22
|
||||||
|
$22.Name = Methods
|
||||||
|
$22.AffectedEntity = Methods
|
||||||
|
$22.VisibilityMask = Protected, Public
|
||||||
|
$22.NamingStyle = PascalCase
|
||||||
|
$22.IncludeInstanceMembers = True
|
||||||
|
$22.IncludeStaticEntities = True
|
||||||
|
$11.NamingRule = $23
|
||||||
|
$23.Name = Static Readonly Fields
|
||||||
|
$23.AffectedEntity = ReadonlyField
|
||||||
|
$23.VisibilityMask = Protected, Public
|
||||||
|
$23.NamingStyle = PascalCase
|
||||||
|
$23.IncludeInstanceMembers = False
|
||||||
|
$23.IncludeStaticEntities = True
|
||||||
|
$11.NamingRule = $24
|
||||||
|
$24.Name = Fields
|
||||||
|
$24.AffectedEntity = Field
|
||||||
|
$24.VisibilityMask = Protected, Public
|
||||||
|
$24.NamingStyle = PascalCase
|
||||||
|
$24.IncludeInstanceMembers = True
|
||||||
|
$24.IncludeStaticEntities = True
|
||||||
|
$11.NamingRule = $25
|
||||||
|
$25.Name = ReadOnly Fields
|
||||||
|
$25.AffectedEntity = ReadonlyField
|
||||||
|
$25.VisibilityMask = Protected, Public
|
||||||
|
$25.NamingStyle = PascalCase
|
||||||
|
$25.IncludeInstanceMembers = True
|
||||||
|
$25.IncludeStaticEntities = False
|
||||||
|
$11.NamingRule = $26
|
||||||
|
$26.Name = Constant Fields
|
||||||
|
$26.AffectedEntity = ConstantField
|
||||||
|
$26.VisibilityMask = Protected, Public
|
||||||
|
$26.NamingStyle = PascalCase
|
||||||
|
$26.IncludeInstanceMembers = True
|
||||||
|
$26.IncludeStaticEntities = True
|
||||||
|
$11.NamingRule = $27
|
||||||
|
$27.Name = Properties
|
||||||
|
$27.AffectedEntity = Property
|
||||||
|
$27.VisibilityMask = Protected, Public
|
||||||
|
$27.NamingStyle = PascalCase
|
||||||
|
$27.IncludeInstanceMembers = True
|
||||||
|
$27.IncludeStaticEntities = True
|
||||||
|
$11.NamingRule = $28
|
||||||
|
$28.Name = Events
|
||||||
|
$28.AffectedEntity = Event
|
||||||
|
$28.VisibilityMask = Protected, Public
|
||||||
|
$28.NamingStyle = PascalCase
|
||||||
|
$28.IncludeInstanceMembers = True
|
||||||
|
$28.IncludeStaticEntities = True
|
||||||
|
$11.NamingRule = $29
|
||||||
|
$29.Name = Enum Members
|
||||||
|
$29.AffectedEntity = EnumMember
|
||||||
|
$29.VisibilityMask = VisibilityMask
|
||||||
|
$29.NamingStyle = PascalCase
|
||||||
|
$29.IncludeInstanceMembers = True
|
||||||
|
$29.IncludeStaticEntities = True
|
||||||
|
$11.NamingRule = $30
|
||||||
|
$30.Name = Parameters
|
||||||
|
$30.AffectedEntity = Parameter
|
||||||
|
$30.VisibilityMask = VisibilityMask
|
||||||
|
$30.NamingStyle = CamelCase
|
||||||
|
$30.IncludeInstanceMembers = True
|
||||||
|
$30.IncludeStaticEntities = True
|
||||||
|
$11.NamingRule = $31
|
||||||
|
$31.Name = Type Parameters
|
||||||
|
$31.RequiredPrefixes = $32
|
||||||
|
$32.String = T
|
||||||
|
$31.AffectedEntity = TypeParameter
|
||||||
|
$31.VisibilityMask = VisibilityMask
|
||||||
|
$31.NamingStyle = PascalCase
|
||||||
|
$31.IncludeInstanceMembers = True
|
||||||
|
$31.IncludeStaticEntities = True
|
||||||
|
$0.VersionControlPolicy = $33
|
||||||
|
$33.inheritsSet = Mono
|
||||||
|
$0.ChangeLogPolicy = $34
|
||||||
|
$34.UpdateMode = None
|
||||||
|
$34.MessageStyle = $35
|
||||||
|
$35.LineAlign = 0
|
||||||
|
$34.inheritsSet = Mono
|
||||||
|
outputpath = .
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ FILES=('OpenRA.Game.exe' 'OpenRA.Editor.exe' 'OpenRA.Utility.exe' \
|
|||||||
'cg' 'glsl' 'mods/ra' 'mods/cnc' 'mods/d2k' \
|
'cg' 'glsl' 'mods/ra' 'mods/cnc' 'mods/d2k' \
|
||||||
'AUTHORS' 'COPYING' 'HACKING' 'INSTALL' 'CHANGELOG' \
|
'AUTHORS' 'COPYING' 'HACKING' 'INSTALL' 'CHANGELOG' \
|
||||||
'README.html' 'CONTRIBUTING.html' 'DOCUMENTATION.html' \
|
'README.html' 'CONTRIBUTING.html' 'DOCUMENTATION.html' \
|
||||||
'global mix database.dat')
|
'global mix database.dat' 'GeoIP.dll' 'GeoIP.dat')
|
||||||
|
|
||||||
echo "Copying files..."
|
echo "Copying files..."
|
||||||
for i in "${FILES[@]}"; do
|
for i in "${FILES[@]}"; do
|
||||||
|
|||||||
@@ -94,6 +94,8 @@ Section "Client" Client
|
|||||||
File "${SRCDIR}\Tao.*.dll"
|
File "${SRCDIR}\Tao.*.dll"
|
||||||
File "${SRCDIR}\SharpFont.dll"
|
File "${SRCDIR}\SharpFont.dll"
|
||||||
File "${SRCDIR}\global mix database.dat"
|
File "${SRCDIR}\global mix database.dat"
|
||||||
|
File "${SRCDIR}\GeoIP.dll
|
||||||
|
File "${SRCDIR}\GeoIP.dat"
|
||||||
|
|
||||||
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
|
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
|
||||||
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
|
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
|
||||||
@@ -280,6 +282,8 @@ Function ${UN}Clean
|
|||||||
Delete $INSTDIR\cgGL.dll
|
Delete $INSTDIR\cgGL.dll
|
||||||
Delete $INSTDIR\zlib1.dll
|
Delete $INSTDIR\zlib1.dll
|
||||||
Delete "$INSTDIR\global mix database.dat"
|
Delete "$INSTDIR\global mix database.dat"
|
||||||
|
Delete $INSTDIR\GeoIP.dat
|
||||||
|
Delete $INSTDIR\GeoIP.dll
|
||||||
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenRA"
|
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenRA"
|
||||||
Delete $INSTDIR\uninstaller.exe
|
Delete $INSTDIR\uninstaller.exe
|
||||||
RMDir $INSTDIR
|
RMDir $INSTDIR
|
||||||
|
|||||||
Reference in New Issue
Block a user