2017-06-06 23:45:21 -04:00
|
|
|
|
using Kayak;
|
|
|
|
|
using Kayak.Http;
|
|
|
|
|
using SharedLibrary;
|
|
|
|
|
using System;
|
2017-05-26 18:49:27 -04:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Net;
|
2017-06-06 23:45:21 -04:00
|
|
|
|
using System.Text;
|
2017-05-26 18:49:27 -04:00
|
|
|
|
using System.Threading;
|
|
|
|
|
|
|
|
|
|
namespace IW4MAdmin
|
|
|
|
|
{
|
|
|
|
|
public class WebService
|
|
|
|
|
{
|
|
|
|
|
public static IServer webService;
|
|
|
|
|
|
2017-06-06 23:45:21 -04:00
|
|
|
|
public static IScheduler GetScheduler()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
var webScheduler = Kayak.KayakScheduler.Factory.Create(new Scheduler());
|
|
|
|
|
webService = KayakServer.Factory.CreateHttp(new Request(), webScheduler);
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
SharedLibrary.WebService.PageList.Add(new Pages());
|
|
|
|
|
SharedLibrary.WebService.PageList.Add(new Homepage());
|
|
|
|
|
SharedLibrary.WebService.PageList.Add(new ServersJSON());
|
2017-09-27 16:07:43 -04:00
|
|
|
|
SharedLibrary.WebService.PageList.Add(new PlayerHistoryJSON());
|
2017-06-12 13:50:00 -04:00
|
|
|
|
SharedLibrary.WebService.PageList.Add(new Penalties());
|
|
|
|
|
SharedLibrary.WebService.PageList.Add(new PenaltiesJSON());
|
|
|
|
|
SharedLibrary.WebService.PageList.Add(new Players());
|
|
|
|
|
SharedLibrary.WebService.PageList.Add(new GetPlayer());
|
|
|
|
|
SharedLibrary.WebService.PageList.Add(new WebConsole());
|
|
|
|
|
SharedLibrary.WebService.PageList.Add(new ConsoleJSON());
|
|
|
|
|
SharedLibrary.WebService.PageList.Add(new PubbansJSON());
|
2017-08-17 19:28:08 -04:00
|
|
|
|
SharedLibrary.WebService.PageList.Add(new AdminsJSON());
|
|
|
|
|
SharedLibrary.WebService.PageList.Add(new Admins());
|
2017-06-12 13:50:00 -04:00
|
|
|
|
|
|
|
|
|
Thread scheduleThread = new Thread(() => { ScheduleThreadStart(webScheduler, webService); })
|
|
|
|
|
{
|
|
|
|
|
Name = "Web Service Thread"
|
|
|
|
|
};
|
2017-05-26 18:49:27 -04:00
|
|
|
|
scheduleThread.Start();
|
|
|
|
|
|
|
|
|
|
return webScheduler;
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-06 23:45:21 -04:00
|
|
|
|
private static void ScheduleThreadStart(IScheduler S, IServer ss)
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string[] webConfig = System.IO.File.ReadAllLines("config\\web.cfg");
|
|
|
|
|
var address = Dns.GetHostAddresses(webConfig[0])[0];
|
|
|
|
|
int port = Convert.ToInt32(webConfig[1]);
|
2017-05-27 00:22:50 -04:00
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
using (ss.Listen(new IPEndPoint(address, port)))
|
|
|
|
|
S.Start();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
2017-09-27 16:07:43 -04:00
|
|
|
|
ApplicationManager.GetInstance().Logger.WriteError($"Unable to start webservice ( port is probably in use ): {e.Message}");
|
2017-05-27 00:22:50 -04:00
|
|
|
|
}
|
2017-05-26 18:49:27 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
using (ss.Listen(new IPEndPoint(IPAddress.Any, 1624)))
|
|
|
|
|
S.Start();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-06 23:45:21 -04:00
|
|
|
|
public static HttpResponse GetPage(string path, System.Collections.Specialized.NameValueCollection queryset, IDictionary<string, string> headers)
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
2017-06-12 13:50:00 -04:00
|
|
|
|
if (SharedLibrary.WebService.PageList == null || SharedLibrary.WebService.PageList.Count == 0)
|
2017-06-06 23:45:21 -04:00
|
|
|
|
return new HttpResponse() { content = "Error: page list not initialized!", contentType = "text/plaintext" };
|
|
|
|
|
|
|
|
|
|
if (path == null)
|
|
|
|
|
return new HttpResponse() { content = "Error: no path specified", contentType = "text/plaintext" };
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
IPage requestedPage = SharedLibrary.WebService.PageList.Find(x => x.GetPath().ToLower() == path.ToLower());
|
2017-05-26 18:49:27 -04:00
|
|
|
|
|
|
|
|
|
if (requestedPage != null)
|
2017-06-12 13:50:00 -04:00
|
|
|
|
return requestedPage.GetPage(queryset, headers);
|
2017-05-26 18:49:27 -04:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (System.IO.File.Exists(path.Replace("/", "\\").Substring(1)))
|
|
|
|
|
{
|
|
|
|
|
IFile f = new IFile(path.Replace("/", "\\").Substring(1));
|
|
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
if (path.Contains(".css"))
|
|
|
|
|
{
|
2017-06-12 13:50:00 -04:00
|
|
|
|
HttpResponse css = new HttpResponse()
|
|
|
|
|
{
|
|
|
|
|
additionalHeaders = new Dictionary<string, string>(),
|
|
|
|
|
content = f.GetText(),
|
|
|
|
|
contentType = "text/css"
|
|
|
|
|
};
|
2017-05-26 18:49:27 -04:00
|
|
|
|
f.Close();
|
|
|
|
|
return css;
|
2017-05-27 00:22:50 -04:00
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else if (path.Contains(".js"))
|
|
|
|
|
{
|
2017-06-12 13:50:00 -04:00
|
|
|
|
HttpResponse css = new HttpResponse()
|
|
|
|
|
{
|
|
|
|
|
additionalHeaders = new Dictionary<string, string>(),
|
|
|
|
|
content = f.GetText(),
|
|
|
|
|
contentType = "application/javascript"
|
|
|
|
|
};
|
2017-05-26 18:49:27 -04:00
|
|
|
|
f.Close();
|
|
|
|
|
return css;
|
|
|
|
|
}
|
2017-05-27 00:22:50 -04:00
|
|
|
|
f.Close();
|
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
requestedPage = new Error404();
|
2017-06-12 13:50:00 -04:00
|
|
|
|
return requestedPage.GetPage(queryset, headers);
|
2017-05-26 18:49:27 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class Error404 : IPage
|
|
|
|
|
{
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public string GetName()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return "404";
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public string GetPath()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public HttpResponse GetPage(System.Collections.Specialized.NameValueCollection querySet, IDictionary<string, string> headers)
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
2017-06-12 13:50:00 -04:00
|
|
|
|
HttpResponse resp = new HttpResponse()
|
|
|
|
|
{
|
|
|
|
|
additionalHeaders = new Dictionary<string, string>(),
|
|
|
|
|
content = "404 not found!",
|
|
|
|
|
contentType = GetContentType()
|
|
|
|
|
};
|
2017-05-26 18:49:27 -04:00
|
|
|
|
return resp;
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public string GetContentType()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return "text/html";
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public bool Visible()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class Homepage : HTMLPage
|
|
|
|
|
{
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public override string GetName()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return "Home";
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public override string GetPath()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return "/";
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public override string GetContent(System.Collections.Specialized.NameValueCollection querySet, IDictionary<string, string> headers)
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
StringBuilder S = new StringBuilder();
|
2017-06-12 13:50:00 -04:00
|
|
|
|
S.Append(LoadHeader());
|
2017-05-26 18:49:27 -04:00
|
|
|
|
IFile p = new IFile("webfront\\main.html");
|
2017-06-12 13:50:00 -04:00
|
|
|
|
S.Append(p.GetText());
|
2017-05-26 18:49:27 -04:00
|
|
|
|
p.Close();
|
2017-06-12 13:50:00 -04:00
|
|
|
|
S.Append(LoadFooter());
|
2017-05-26 18:49:27 -04:00
|
|
|
|
|
|
|
|
|
return S.ToString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class ServersJSON : IPage
|
|
|
|
|
{
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public string GetName()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return "Servers";
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public string GetPath()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return "/_servers";
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public HttpResponse GetPage(System.Collections.Specialized.NameValueCollection querySet, IDictionary<string, string> headers)
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
var info = new List<ServerInfo>();
|
|
|
|
|
|
2017-09-27 16:07:43 -04:00
|
|
|
|
int i = 0;
|
2017-06-19 13:58:01 -04:00
|
|
|
|
foreach (Server S in ApplicationManager.GetInstance().Servers)
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
2017-06-12 13:50:00 -04:00
|
|
|
|
ServerInfo eachServer = new ServerInfo()
|
|
|
|
|
{
|
|
|
|
|
serverName = S.Hostname,
|
|
|
|
|
serverPort = S.GetPort(),
|
|
|
|
|
maxPlayers = S.MaxClients,
|
|
|
|
|
mapName = S.CurrentMap.Alias,
|
2017-06-12 17:47:31 -04:00
|
|
|
|
gameType = Utilities.GetLocalizedGametype(S.Gametype),
|
2017-06-12 13:50:00 -04:00
|
|
|
|
currentPlayers = S.GetPlayersAsList().Count,
|
|
|
|
|
chatHistory = S.ChatHistory,
|
2017-09-27 16:07:43 -04:00
|
|
|
|
players = new List<PlayerInfo>(),
|
|
|
|
|
ID = i
|
2017-06-12 13:50:00 -04:00
|
|
|
|
};
|
2017-09-27 16:07:43 -04:00
|
|
|
|
|
|
|
|
|
i++;
|
|
|
|
|
|
|
|
|
|
bool authed = ApplicationManager.GetInstance().GetPrivilegedClients()
|
|
|
|
|
.Where(x => x.IP == querySet["IP"])
|
|
|
|
|
.Where(x => x.Level > Player.Permission.Trusted).Count() > 0
|
|
|
|
|
|| querySet["IP"] == "127.0.0.1";
|
2017-06-12 13:50:00 -04:00
|
|
|
|
|
2017-06-07 20:59:59 -04:00
|
|
|
|
foreach (Player P in S.GetPlayersAsList())
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
2017-06-12 13:50:00 -04:00
|
|
|
|
PlayerInfo pInfo = new PlayerInfo()
|
|
|
|
|
{
|
|
|
|
|
playerID = P.DatabaseID,
|
|
|
|
|
playerName = P.Name,
|
2017-08-23 18:29:48 -04:00
|
|
|
|
playerLevel = authed ? P.Level.ToString() : Player.Permission.User.ToString()
|
2017-06-12 13:50:00 -04:00
|
|
|
|
};
|
2017-05-26 18:49:27 -04:00
|
|
|
|
eachServer.players.Add(pInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
info.Add(eachServer);
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
HttpResponse resp = new HttpResponse()
|
|
|
|
|
{
|
|
|
|
|
contentType = GetContentType(),
|
|
|
|
|
content = Newtonsoft.Json.JsonConvert.SerializeObject(info),
|
|
|
|
|
additionalHeaders = new Dictionary<string, string>()
|
|
|
|
|
};
|
2017-05-26 18:49:27 -04:00
|
|
|
|
return resp;
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public string GetContentType()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return "application/json";
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public bool Visible()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-27 16:07:43 -04:00
|
|
|
|
|
|
|
|
|
class PlayerHistoryJSON : IPage
|
|
|
|
|
{
|
|
|
|
|
public string GetName()
|
|
|
|
|
{
|
|
|
|
|
return "Player History";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string GetPath()
|
|
|
|
|
{
|
|
|
|
|
return "/_playerhistory";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public HttpResponse GetPage(System.Collections.Specialized.NameValueCollection querySet, IDictionary<string, string> headers)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var history = new SharedLibrary.Helpers.PlayerHistory[0];
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
int id = Int32.Parse(querySet["server"]);
|
|
|
|
|
history = ApplicationManager.GetInstance().GetServers()[id].PlayerHistory.ToArray();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HttpResponse resp = new HttpResponse()
|
|
|
|
|
{
|
|
|
|
|
contentType = GetContentType(),
|
|
|
|
|
content = Newtonsoft.Json.JsonConvert.SerializeObject(history),
|
|
|
|
|
additionalHeaders = new Dictionary<string, string>()
|
|
|
|
|
};
|
|
|
|
|
return resp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string GetContentType()
|
|
|
|
|
{
|
|
|
|
|
return "application/json";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool Visible()
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
class Info : IPage
|
|
|
|
|
{
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public string GetName()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return "Info";
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public string GetPath()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return "/_info";
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public HttpResponse GetPage(System.Collections.Specialized.NameValueCollection querySet, IDictionary<string, string> headers)
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
2017-06-12 13:50:00 -04:00
|
|
|
|
ApplicationInfo info = new ApplicationInfo()
|
|
|
|
|
{
|
|
|
|
|
name = "IW4MAdmin",
|
|
|
|
|
version = Program.Version
|
|
|
|
|
};
|
|
|
|
|
HttpResponse resp = new HttpResponse()
|
|
|
|
|
{
|
|
|
|
|
contentType = GetContentType(),
|
|
|
|
|
content = Newtonsoft.Json.JsonConvert.SerializeObject(info),
|
|
|
|
|
additionalHeaders = new Dictionary<string, string>()
|
|
|
|
|
};
|
2017-05-26 18:49:27 -04:00
|
|
|
|
return resp;
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public string GetContentType()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return "application/json";
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public bool Visible()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ConsoleJSON : IPage
|
|
|
|
|
{
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public string GetName()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return "_Console";
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public string GetPath()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return "/_console";
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public HttpResponse GetPage(System.Collections.Specialized.NameValueCollection querySet, IDictionary<string, string> headers)
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
2017-06-12 13:50:00 -04:00
|
|
|
|
CommandInfo cmd = new CommandInfo()
|
|
|
|
|
{
|
|
|
|
|
Result = new List<string>()
|
|
|
|
|
};
|
2017-05-26 18:49:27 -04:00
|
|
|
|
|
|
|
|
|
if (querySet["command"] != null)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (querySet["server"] != null)
|
|
|
|
|
{
|
2017-06-19 13:58:01 -04:00
|
|
|
|
Server S = ApplicationManager.GetInstance().Servers.ToList().Find(x => (x.GetPort().ToString() == querySet["server"]));
|
2017-05-26 18:49:27 -04:00
|
|
|
|
|
|
|
|
|
if (S != null)
|
|
|
|
|
{
|
2017-06-19 13:58:01 -04:00
|
|
|
|
Player admin = ApplicationManager.GetInstance().GetClientDatabase().GetPlayer(querySet["IP"]);
|
2017-05-26 18:49:27 -04:00
|
|
|
|
|
|
|
|
|
if (admin == null)
|
|
|
|
|
admin = new Player("RestUser", "-1", -1, (int)Player.Permission.User);
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
Event remoteEvent = new Event(Event.GType.Say, querySet["command"], admin, null, S)
|
|
|
|
|
{
|
|
|
|
|
Remote = true
|
|
|
|
|
};
|
2017-05-26 18:49:27 -04:00
|
|
|
|
admin.lastEvent = remoteEvent;
|
|
|
|
|
|
|
|
|
|
S.ExecuteEvent(remoteEvent);
|
|
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
|
while (S.commandResult.Count > 0)
|
2017-05-26 18:49:27 -04:00
|
|
|
|
cmd.Result.Add(S.commandResult.Dequeue());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
cmd.Result.Add("Invalid server selected.");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
cmd.Result.Add("Invalid server selected.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
cmd.Result.Add("No command entered.");
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
HttpResponse resp = new HttpResponse()
|
|
|
|
|
{
|
|
|
|
|
contentType = GetContentType(),
|
|
|
|
|
content = Newtonsoft.Json.JsonConvert.SerializeObject(cmd),
|
|
|
|
|
additionalHeaders = new Dictionary<string, string>()
|
|
|
|
|
};
|
2017-05-26 18:49:27 -04:00
|
|
|
|
return resp;
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public string GetContentType()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return "application/json";
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public bool Visible()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PenaltiesJSON : IPage
|
|
|
|
|
{
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public string GetName()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return "Penalties";
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public string GetPath()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return "/_penalties";
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public HttpResponse GetPage(System.Collections.Specialized.NameValueCollection querySet, IDictionary<string, string> headers)
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
int from = 0;
|
|
|
|
|
if (querySet["from"] != null)
|
|
|
|
|
from = Int32.Parse(querySet["from"]);
|
|
|
|
|
List<Penalty> selectedPenalties;
|
|
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
|
try
|
|
|
|
|
{
|
2017-06-19 13:58:01 -04:00
|
|
|
|
selectedPenalties = ((ApplicationManager.GetInstance().GetClientPenalties()) as PenaltyList).AsChronoList(Convert.ToInt32(querySet["from"]), 15).OrderByDescending(b => b.When).ToList();
|
2017-05-26 18:49:27 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
selectedPenalties = new List<Penalty>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<PenaltyInfo> info = new List<PenaltyInfo>();
|
|
|
|
|
|
|
|
|
|
foreach (var p in selectedPenalties)
|
|
|
|
|
{
|
2017-08-08 22:44:52 -04:00
|
|
|
|
Player admin = ApplicationManager.GetInstance().GetClientDatabase().GetPlayer(p.PenaltyOriginID, 0) ??
|
|
|
|
|
new Player("IW4MAdmin", "-1", -1, (int)Player.Permission.Banned);
|
|
|
|
|
|
2017-06-19 13:58:01 -04:00
|
|
|
|
Player penalized = ApplicationManager.GetInstance().GetClientDatabase().GetPlayer(p.OffenderID, 0);
|
2017-05-26 18:49:27 -04:00
|
|
|
|
if (admin == null && penalized == null)
|
|
|
|
|
continue;
|
2017-06-12 13:50:00 -04:00
|
|
|
|
|
|
|
|
|
PenaltyInfo pInfo = new PenaltyInfo()
|
|
|
|
|
{
|
|
|
|
|
adminName = admin.Name,
|
|
|
|
|
adminLevel = admin.Level.ToString(),
|
|
|
|
|
penaltyReason = p.Reason,
|
2017-08-08 22:44:52 -04:00
|
|
|
|
penaltyTime = Utilities.GetTimePassed(p.When),
|
2017-06-12 13:50:00 -04:00
|
|
|
|
penaltyType = p.BType.ToString(),
|
|
|
|
|
playerName = penalized.Name,
|
2017-09-27 16:07:43 -04:00
|
|
|
|
playerID = penalized.DatabaseID,
|
|
|
|
|
Expires = p.Expires > DateTime.Now ? (p.Expires - DateTime.Now).TimeSpanText() : ""
|
2017-06-12 13:50:00 -04:00
|
|
|
|
};
|
|
|
|
|
|
2017-05-31 01:31:56 -04:00
|
|
|
|
if (admin.NetworkID == penalized.NetworkID)
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
pInfo.adminName = "IW4MAdmin";
|
|
|
|
|
pInfo.adminLevel = Player.Permission.Console.ToString();
|
|
|
|
|
}
|
|
|
|
|
info.Add(pInfo);
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
HttpResponse resp = new HttpResponse()
|
|
|
|
|
{
|
|
|
|
|
contentType = GetContentType(),
|
|
|
|
|
content = Newtonsoft.Json.JsonConvert.SerializeObject(info),
|
|
|
|
|
additionalHeaders = new Dictionary<string, string>()
|
|
|
|
|
};
|
2017-05-26 18:49:27 -04:00
|
|
|
|
return resp;
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public string GetContentType()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return "application/json";
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public bool Visible()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class Penalties : HTMLPage
|
|
|
|
|
{
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public override string GetName()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return "Penalties";
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public override string GetPath()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return "/penalties";
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public override string GetContent(System.Collections.Specialized.NameValueCollection querySet, IDictionary<string, string> headers)
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
StringBuilder S = new StringBuilder();
|
2017-06-12 13:50:00 -04:00
|
|
|
|
S.Append(LoadHeader());
|
2017-05-26 18:49:27 -04:00
|
|
|
|
|
|
|
|
|
IFile penalities = new IFile("webfront\\penalties.html");
|
2017-06-12 13:50:00 -04:00
|
|
|
|
S.Append(penalities.GetText());
|
2017-05-26 18:49:27 -04:00
|
|
|
|
penalities.Close();
|
2017-05-27 00:22:50 -04:00
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
S.Append(LoadFooter());
|
2017-05-26 18:49:27 -04:00
|
|
|
|
|
|
|
|
|
return S.ToString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class WebConsole : HTMLPage
|
|
|
|
|
{
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public override string GetName()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return "Console";
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public override string GetPath()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return "/console";
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public override string GetContent(System.Collections.Specialized.NameValueCollection querySet, IDictionary<string, string> headers)
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
StringBuilder S = new StringBuilder();
|
2017-06-12 13:50:00 -04:00
|
|
|
|
S.Append(LoadHeader());
|
2017-05-26 18:49:27 -04:00
|
|
|
|
|
|
|
|
|
IFile console = new IFile("webfront\\console.html");
|
2017-06-12 13:50:00 -04:00
|
|
|
|
S.Append(console.GetText());
|
2017-05-26 18:49:27 -04:00
|
|
|
|
console.Close();
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
S.Append(LoadFooter());
|
2017-05-26 18:49:27 -04:00
|
|
|
|
|
|
|
|
|
return S.ToString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class Players : HTMLPage
|
|
|
|
|
{
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public override string GetName()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return "Players";
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public override string GetPath()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return "/players";
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public override string GetContent(System.Collections.Specialized.NameValueCollection querySet, IDictionary<string, string> headers)
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
StringBuilder S = new StringBuilder();
|
2017-06-12 13:50:00 -04:00
|
|
|
|
S.Append(LoadHeader());
|
2017-05-26 18:49:27 -04:00
|
|
|
|
|
|
|
|
|
IFile penalities = new IFile("webfront\\players.html");
|
2017-06-12 13:50:00 -04:00
|
|
|
|
S.Append(penalities.GetText());
|
2017-05-26 18:49:27 -04:00
|
|
|
|
penalities.Close();
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
S.Append(LoadFooter());
|
2017-05-26 18:49:27 -04:00
|
|
|
|
|
|
|
|
|
return S.ToString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-08-17 19:28:08 -04:00
|
|
|
|
|
|
|
|
|
class Admins : HTMLPage
|
|
|
|
|
{
|
|
|
|
|
public override string GetName()
|
|
|
|
|
{
|
|
|
|
|
return "Admins";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override string GetPath()
|
|
|
|
|
{
|
|
|
|
|
return "/Admins";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override string GetContent(System.Collections.Specialized.NameValueCollection querySet, IDictionary<string, string> headers)
|
|
|
|
|
{
|
|
|
|
|
StringBuilder S = new StringBuilder();
|
|
|
|
|
S.Append(LoadHeader());
|
|
|
|
|
|
|
|
|
|
IFile admins = new IFile("webfront\\admins.html");
|
|
|
|
|
S.Append(admins.GetText());
|
|
|
|
|
admins.Close();
|
|
|
|
|
|
|
|
|
|
S.Append(LoadFooter());
|
|
|
|
|
|
|
|
|
|
return S.ToString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class AdminsJSON : IPage
|
|
|
|
|
{
|
|
|
|
|
public string GetName()
|
|
|
|
|
{
|
|
|
|
|
return "Admins Json";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string GetPath()
|
|
|
|
|
{
|
|
|
|
|
return "/GetAdmins";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public HttpResponse GetPage(System.Collections.Specialized.NameValueCollection querySet, IDictionary<string, string> headers)
|
|
|
|
|
{
|
|
|
|
|
var Admins = ApplicationManager.GetInstance().GetClientDatabase().GetAdmins().OrderByDescending(a => a.Level);
|
|
|
|
|
HttpResponse resp = new HttpResponse()
|
|
|
|
|
{
|
|
|
|
|
contentType = GetContentType(),
|
|
|
|
|
content = Newtonsoft.Json.JsonConvert.SerializeObject(Admins, Newtonsoft.Json.Formatting.Indented),
|
|
|
|
|
additionalHeaders = new Dictionary<string, string>()
|
|
|
|
|
};
|
|
|
|
|
return resp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string GetContentType()
|
|
|
|
|
{
|
|
|
|
|
return "application/json";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool Visible()
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
|
class PubbansJSON : IPage
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public string GetName()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return "Public Ban List";
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public string GetPath()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return "/pubbans";
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public HttpResponse GetPage(System.Collections.Specialized.NameValueCollection querySet, IDictionary<string, string> headers)
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
2017-06-12 13:50:00 -04:00
|
|
|
|
HttpResponse resp = new HttpResponse()
|
|
|
|
|
{
|
|
|
|
|
contentType = GetContentType(),
|
2017-06-19 13:58:01 -04:00
|
|
|
|
content = Newtonsoft.Json.JsonConvert.SerializeObject(((ApplicationManager.GetInstance().GetClientPenalties()) as PenaltyList).AsChronoList(Convert.ToInt32(querySet["from"]), 15), Newtonsoft.Json.Formatting.Indented, new Newtonsoft.Json.JsonConverter[] { new Newtonsoft.Json.Converters.StringEnumConverter() }),
|
2017-06-12 13:50:00 -04:00
|
|
|
|
additionalHeaders = new Dictionary<string, string>()
|
|
|
|
|
};
|
2017-05-26 18:49:27 -04:00
|
|
|
|
return resp;
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public string GetContentType()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return "application/json";
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public bool Visible()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class Pages : IPage
|
|
|
|
|
{
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public string GetName()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return "Pages";
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public string GetPath()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return "/pages";
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public HttpResponse GetPage(System.Collections.Specialized.NameValueCollection querySet, IDictionary<string, string> headers)
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
List<PageInfo> pages = new List<PageInfo>();
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
foreach (var p in SharedLibrary.WebService.PageList.Where(x => x.Visible()))
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
if (p == this)
|
|
|
|
|
continue;
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
PageInfo pi = new PageInfo()
|
|
|
|
|
{
|
2017-09-27 16:07:43 -04:00
|
|
|
|
pagePath = p.GetPath(),
|
2017-06-12 13:50:00 -04:00
|
|
|
|
pageName = p.GetName(),
|
|
|
|
|
visible = p.Visible()
|
|
|
|
|
};
|
2017-05-26 18:49:27 -04:00
|
|
|
|
pages.Add(pi);
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
HttpResponse resp = new HttpResponse()
|
|
|
|
|
{
|
|
|
|
|
contentType = GetContentType(),
|
|
|
|
|
content = Newtonsoft.Json.JsonConvert.SerializeObject(pages),
|
|
|
|
|
additionalHeaders = new Dictionary<string, string>()
|
|
|
|
|
};
|
2017-05-26 18:49:27 -04:00
|
|
|
|
return resp;
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public string GetContentType()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return "application/json";
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public bool Visible()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-09-27 16:07:43 -04:00
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
class GetPlayer : IPage
|
|
|
|
|
{
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public string GetContentType()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return "application/json";
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public string GetPath()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return "/getplayer";
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public string GetName()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return "GetPlayer";
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public HttpResponse GetPage(System.Collections.Specialized.NameValueCollection querySet, IDictionary<string, string> headers)
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
List<PlayerInfo> pInfo = new List<PlayerInfo>();
|
|
|
|
|
List<Player> matchedPlayers = new List<Player>();
|
2017-06-12 13:50:00 -04:00
|
|
|
|
HttpResponse resp = new HttpResponse()
|
|
|
|
|
{
|
|
|
|
|
contentType = GetContentType(),
|
|
|
|
|
additionalHeaders = new Dictionary<string, string>()
|
|
|
|
|
};
|
2017-08-17 19:28:08 -04:00
|
|
|
|
bool authed = ApplicationManager.GetInstance().GetClientDatabase().GetAdmins().FindAll(x => x.IP == querySet["IP"] && x.Level > Player.Permission.Trusted).Count > 0
|
|
|
|
|
|| querySet["IP"] == "127.0.0.1";
|
2017-06-01 13:42:28 -04:00
|
|
|
|
bool recent = false;
|
2017-05-27 00:22:50 -04:00
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
if (querySet["id"] != null)
|
|
|
|
|
{
|
2017-06-19 13:58:01 -04:00
|
|
|
|
matchedPlayers.Add(ApplicationManager.GetInstance().GetClientDatabase().GetPlayer(Convert.ToInt32(querySet["id"])));
|
2017-05-26 18:49:27 -04:00
|
|
|
|
}
|
|
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
|
else if (querySet["npID"] != null)
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
2017-06-19 13:58:01 -04:00
|
|
|
|
matchedPlayers.Add(ApplicationManager.GetInstance().GetClientDatabase().GetPlayers(new List<string> { querySet["npID"] }).First());
|
2017-05-26 18:49:27 -04:00
|
|
|
|
}
|
|
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
|
else if (querySet["name"] != null)
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
2017-06-19 13:58:01 -04:00
|
|
|
|
matchedPlayers = ApplicationManager.GetInstance().GetClientDatabase().FindPlayers(querySet["name"]);
|
2017-05-26 18:49:27 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else if (querySet["recent"] != null)
|
|
|
|
|
{
|
2017-09-27 16:07:43 -04:00
|
|
|
|
matchedPlayers = ApplicationManager.GetInstance().GetClientDatabase().GetRecentPlayers();
|
2017-06-01 13:42:28 -04:00
|
|
|
|
recent = true;
|
2017-05-26 18:49:27 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (matchedPlayers != null && matchedPlayers.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (var pp in matchedPlayers)
|
|
|
|
|
{
|
2017-05-27 00:22:50 -04:00
|
|
|
|
if (pp == null) continue;
|
2017-06-12 13:50:00 -04:00
|
|
|
|
|
|
|
|
|
PlayerInfo eachPlayer = new PlayerInfo()
|
|
|
|
|
{
|
|
|
|
|
playerID = pp.DatabaseID,
|
|
|
|
|
playerIP = pp.IP,
|
|
|
|
|
playerLevel = pp.Level.ToString(),
|
|
|
|
|
playerName = pp.Name,
|
|
|
|
|
playernpID = pp.NetworkID,
|
|
|
|
|
forumID = -1,
|
|
|
|
|
authed = authed,
|
|
|
|
|
showV2Features = false
|
|
|
|
|
};
|
2017-05-26 18:49:27 -04:00
|
|
|
|
|
2017-06-01 13:42:28 -04:00
|
|
|
|
if (!recent)
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
2017-08-17 19:28:08 -04:00
|
|
|
|
foreach (var a in ApplicationManager.GetInstance().GetAliases(pp))
|
2017-06-01 13:42:28 -04:00
|
|
|
|
{
|
|
|
|
|
eachPlayer.playerAliases = a.Names;
|
|
|
|
|
eachPlayer.playerIPs = a.IPS;
|
|
|
|
|
}
|
2017-05-26 18:49:27 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
eachPlayer.playerConnections = pp.Connections;
|
2017-06-12 17:47:31 -04:00
|
|
|
|
eachPlayer.lastSeen = Utilities.GetTimePassed(pp.LastConnection);
|
2017-05-26 18:49:27 -04:00
|
|
|
|
pInfo.Add(eachPlayer);
|
2017-05-27 00:22:50 -04:00
|
|
|
|
|
|
|
|
|
}
|
2017-05-26 18:49:27 -04:00
|
|
|
|
|
|
|
|
|
resp.content = Newtonsoft.Json.JsonConvert.SerializeObject(pInfo);
|
|
|
|
|
return resp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
resp.content = Newtonsoft.Json.JsonConvert.SerializeObject(null);
|
|
|
|
|
return resp;
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 13:50:00 -04:00
|
|
|
|
public bool Visible()
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Serializable]
|
|
|
|
|
struct ServerInfo
|
|
|
|
|
{
|
|
|
|
|
public string serverName;
|
|
|
|
|
public int serverPort;
|
|
|
|
|
public string mapName;
|
|
|
|
|
public string gameType;
|
|
|
|
|
public int currentPlayers;
|
|
|
|
|
public int maxPlayers;
|
|
|
|
|
public List<Chat> chatHistory;
|
|
|
|
|
public List<PlayerInfo> players;
|
2017-09-27 16:07:43 -04:00
|
|
|
|
public int ID;
|
2017-05-26 18:49:27 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Serializable]
|
|
|
|
|
struct ApplicationInfo
|
|
|
|
|
{
|
|
|
|
|
public double version;
|
|
|
|
|
public string name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Serializable]
|
|
|
|
|
struct PageInfo
|
|
|
|
|
{
|
|
|
|
|
public string pageName;
|
|
|
|
|
public string pagePath;
|
2017-05-27 00:22:50 -04:00
|
|
|
|
public string pageType;
|
2017-05-26 18:49:27 -04:00
|
|
|
|
public bool visible;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Serializable]
|
|
|
|
|
struct PlayerInfo
|
|
|
|
|
{
|
|
|
|
|
public string playerName;
|
|
|
|
|
public int playerID;
|
|
|
|
|
public string playerLevel;
|
|
|
|
|
public string playerIP;
|
|
|
|
|
public string playernpID;
|
|
|
|
|
public Int64 forumID;
|
|
|
|
|
public List<string> playerAliases;
|
|
|
|
|
public List<string> playerIPs;
|
|
|
|
|
public int playerConnections;
|
|
|
|
|
public string lastSeen;
|
2017-05-27 00:22:50 -04:00
|
|
|
|
public bool showV2Features;
|
|
|
|
|
public bool authed;
|
2017-05-26 18:49:27 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Serializable]
|
|
|
|
|
struct PenaltyInfo
|
|
|
|
|
{
|
|
|
|
|
public string playerName;
|
|
|
|
|
public int playerID;
|
|
|
|
|
public string adminName;
|
|
|
|
|
public string adminLevel;
|
|
|
|
|
public string penaltyType;
|
|
|
|
|
public string penaltyReason;
|
|
|
|
|
public string penaltyTime;
|
2017-09-27 16:07:43 -04:00
|
|
|
|
public string Expires;
|
2017-05-26 18:49:27 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Serializable]
|
|
|
|
|
struct CommandInfo
|
|
|
|
|
{
|
|
|
|
|
public List<string> Result;
|
|
|
|
|
}
|
2017-08-17 19:28:08 -04:00
|
|
|
|
|
|
|
|
|
[Serializable]
|
|
|
|
|
class PrivilegedUsers
|
|
|
|
|
{
|
|
|
|
|
public Player.Permission Permission { get; set; }
|
|
|
|
|
public List<Player> Players { get; set; }
|
|
|
|
|
}
|
2017-05-27 00:22:50 -04:00
|
|
|
|
}
|