1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-23 21:50:44 -05:00

Branch for IW4X practically everything refactored

This commit is contained in:
RaidMax
2017-05-26 17:49:27 -05:00
parent 85a658b987
commit 10075b0d3f
107 changed files with 7426 additions and 3995 deletions

View File

@ -60,7 +60,7 @@ namespace CountryLookupProj
{
fileInput = new FileStream(fileName, FileMode.Open, FileAccess.Read);
}
catch (FileNotFoundException e)
catch (FileNotFoundException)
{
Console.WriteLine("File " + fileName + " not found.");
}
@ -73,7 +73,7 @@ namespace CountryLookupProj
{
addr = IPAddress.Parse(str);
}
catch (FormatException e)
catch (FormatException)
{
return "--";
}
@ -109,7 +109,7 @@ namespace CountryLookupProj
{
addr = IPAddress.Parse(str);
}
catch (FormatException e)
catch (FormatException)
{
return "N/A";
}
@ -134,7 +134,7 @@ namespace CountryLookupProj
fileInput.Seek(6 * offset, 0);
fileInput.Read(buf, 0, 6);
}
catch (IOException e)
catch (IOException)
{
Console.WriteLine("IO Exception");
}

BIN
Welcome Plugin/GeoIP.dat Normal file

Binary file not shown.

View File

@ -1,62 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SharedLibrary;
namespace Welcome_Plugin
{
public class Main : Plugin
{
public override string Author
{
get
{
return "RaidMax";
}
}
public override float Version
{
get
{
return 1.0f;
}
}
public override string Name
{
get
{
return "Welcome Plugin";
}
}
public override void onEvent(Event E)
{
if (E.Type == Event.GType.Connect)
{
Player newPlayer = E.Origin;
if (newPlayer.Level > Player.Permission.User)
E.Owner.Broadcast(Utilities.levelToColor(newPlayer.Level) + " ^5" + newPlayer.Name + " ^7has joined the server.");
else
{
CountryLookupProj.CountryLookup CLT = new CountryLookupProj.CountryLookup("GeoIP.dat");
E.Owner.Broadcast("^5" + newPlayer.Name + " ^7hails from ^5" + CLT.lookupCountryName(newPlayer.IP));
}
}
}
public override void onLoad()
{
return;
}
public override void onUnload()
{
return;
}
}
}

69
Welcome Plugin/Plugin.cs Normal file
View File

@ -0,0 +1,69 @@
using System;
using SharedLibrary;
using SharedLibrary.Extensions;
using System.Threading.Tasks;
namespace Welcome_Plugin
{
public class Plugin : IPlugin
{
public string Author
{
get
{
return "RaidMax";
}
}
public float Version
{
get
{
return 1.0f;
}
}
public string Name
{
get
{
return "Welcome Plugin";
}
}
public async Task OnLoad()
{
return;
}
public async Task OnUnload()
{
return;
}
public async Task OnTick(Server S)
{
return;
}
public async Task OnEvent(Event E, Server S)
{
if (E.Type == Event.GType.Connect)
{
Player newPlayer = E.Origin;
if (newPlayer.Level >= Player.Permission.Trusted && !E.Origin.Masked)
await E.Owner.Broadcast(Utilities.levelToColor(newPlayer.Level) + " ^5" + newPlayer.Name + " ^7has joined the server.");
if (newPlayer.Level == Player.Permission.Flagged)
await E.Owner.ToAdmins($"^1NOTICE: ^7Flagged player ^5{newPlayer.Name}^7 has joined!");
else
{
CountryLookupProj.CountryLookup CLT = new CountryLookupProj.CountryLookup("Plugins/GeoIP.dat");
await E.Owner.Broadcast($"^5{newPlayer.Name} ^7hails from ^5{CLT.lookupCountryName(newPlayer.IP)}");
}
}
}
}
}

View File

@ -8,9 +8,10 @@
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Welcome_Plugin</RootNamespace>
<AssemblyName>Welcome Plugin</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<AssemblyName>WelcomePlugin</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -20,6 +21,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@ -28,10 +30,11 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="SharedLibrary">
<HintPath>..\Admin\lib\SharedLibrary.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
@ -43,10 +46,25 @@
</ItemGroup>
<ItemGroup>
<Compile Include="CountryLookup.cs" />
<Compile Include="Main.cs" />
<Compile Include="Plugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="GeoIP.dat" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SharedLibrary\SharedLibrary.csproj">
<Project>{d51eeceb-438a-47da-870f-7d7b41bc24d6}</Project>
<Name>SharedLibrary</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>copy /Y "$(TargetDir)$(TargetName).dll" "$(SolutionDir)BUILD\plugins\"
copy /Y "$(ProjectDir)GeoIP.dat" "$(SolutionDir)Admin\bin\$(ConfigurationName)\GeoIP.dat"</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="10.0.2" targetFramework="net451" />
</packages>