Add project files.

This commit is contained in:
INSANEMODE 2020-11-13 04:54:46 -06:00
commit cf148bd558
6 changed files with 485 additions and 0 deletions

63
.gitattributes vendored Normal file
View File

@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain

246
.gitignore vendored Normal file
View File

@ -0,0 +1,246 @@
_build/
_site/
Properties/
# Use git add -f to force override .sln when required. Not needed in most cases.
# git add -f myProj.sln
*.sln
Project_Readme.html
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
*.vscode/
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
# Visual Studo 2015 cache/options directory
.vs/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding addin-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# Windows Azure Build Output
csx/
*.build.csdef
# Windows Store app package directory
AppPackages/
# Others
*.[Cc]ache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
project.lock.json
**/wwwroot/lib/
**/wwwroot/lib/
**/wwwroot/lib/*
__pycache__/
#Mac OSX
.DS_Store
# Windows thumbnail cache files
Thumbs.db
DEPLOY
global.min.css
global.min.js
bootstrap-custom.min.css
bootstrap-custom.css
**/Master/static
**/Master/dev_env
/WebfrontCore/Views/Plugins/*
/WebfrontCore/wwwroot/**/dds
/WebfrontCore/wwwroot/images/radar/*
/DiscordWebhook/env
/DiscordWebhook/config.dev.json
/GameLogServer/env
launchSettings.json
/VpnDetectionPrivate.js
/Plugins/ScriptPlugins/VpnDetectionPrivate.js
**/Master/env_master
/GameLogServer/log_env
**/*.css
/Master/master/persistence
/WebfrontCore/wwwroot/fonts
/WebfrontCore/wwwroot/font
/Plugins/Tests/TestSourceFiles
/Tests/ApplicationTests/Files/GameEvents.json
/Tests/ApplicationTests/Files/replay.json
/GameLogServer/game_log_server_env

20
ClanTagRankApi.csproj Normal file
View File

@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<ApplicationIcon />
<StartupObject />
<Configurations>Debug;Release;Prerelease</Configurations>
<LangVersion>7.1</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2.4.9" PrivateAssets="All" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="dotnet publish $(ProjectPath) -c $(ConfigurationName) -o $(ProjectDir)..\..\Build\Plugins --no-build --no-restore --no-dependencies" />
</Target>
</Project>

20
Configuration.cs Normal file
View File

@ -0,0 +1,20 @@

using SharedLibraryCore.Interfaces;
namespace ClanTagRankApi
{
internal class Configuration : IBaseConfiguration
{
internal const string _name = "IW4MAdmin";
public int RestartTimerLength { get; set; }
public IBaseConfiguration Generate()
{
//this.RestartTimerLength = Utilities.PromptInt("How long in seconds until a server is killed after it is empty?", (string)null, 60, 86400, new int?(43200));
return (IBaseConfiguration)this;
}
string IBaseConfiguration.Name() => "ClanTagRankApi";
}
}

78
GscApiController.cs Normal file
View File

@ -0,0 +1,78 @@
using Microsoft.AspNetCore.Mvc;
using SharedLibraryCore;
using SharedLibraryCore.Interfaces;
using System.Linq;
using System.Text;
namespace WebfrontCore.Controllers.API
{
[Route("api/gsc/[action]")]
public class GscApiController : BaseController
{
string rankName;
public GscApiController(IManager manager) : base(manager)
{
}
/// <summary>
/// grabs basic info about the client from IW4MAdmin
/// </summary>
/// <param name="clientname"></param>
/// <returns></returns>
[HttpGet("{clientname}")]
public IActionResult Clientname(string clientname)
{
var clientInfo = Manager.GetActiveClients()
.FirstOrDefault(c => c.Name == clientname);
if (clientInfo != null)
{
switch((int)clientInfo.Level)
{
case 0:
rankName = "User";
break;
case 1:
rankName = "User";
break;
case 2:
rankName = "Trusted";
break;
case 3:
rankName = "Mod";
break;
case 4:
rankName = "Admin";
break;
case 5:
rankName = "Sr.Admin";
break;
case 6:
rankName = "Owner";
break;
case 7:
rankName = "Creator";
break;
case 8:
rankName = "Console";
break;
default:
break;
}
var sb = new StringBuilder();
sb.AppendLine(rankName);
return Content(sb.ToString());
}
return Content("Error: Client info is null");
}
}
}

58
Plugin.cs Normal file
View File

@ -0,0 +1,58 @@
using SharedLibraryCore;
using SharedLibraryCore.Interfaces;
using System.Threading.Tasks;
namespace ClanTagRankApi
{
public class Plugin : IPlugin
{
private readonly IConfigurationHandler<Configuration> _configurationHandler;
private Configuration Config;
public string Name => "ClanTagRankApi";
public float Version => 1.0f;
public string Author => "INSANEMODE";
private readonly IMetaService _metaService;
public Plugin(IMetaService metaService, IConfigurationHandlerFactory configurationHandlerFactory)
{
_metaService = metaService;
_configurationHandler = (IConfigurationHandler<Configuration>)configurationHandlerFactory.GetConfigurationHandler<Configuration>("ClanTagRankApi");
}
public Task OnLoadAsync(IManager manager)// => Task.CompletedTask;
{
if (_configurationHandler.Configuration() == null)
{
_configurationHandler.Set((Configuration)new Configuration().Generate());
_configurationHandler.Save();
}
Config = _configurationHandler.Configuration();
string version = manager.Version;
string str = string.Format("Loaded {0} ({1}) by {2} in {3} ({4})!", (object)((IPlugin)this).Name, (object)((IPlugin)this).Version, (object)((IPlugin)this).Author, (object)"IW4MAdmin", (object)version);
manager.GetLogger(0L).WriteVerbose(str);
return Task.CompletedTask;
}
public Task OnEventAsync(GameEvent E, Server S) => Task.CompletedTask;
public Task OnTickAsync(Server S)// =>
{
return Task.CompletedTask;
}
public Task OnUnloadAsync() => Task.CompletedTask;
}
}