Ignore:
Timestamp:
Aug 1, 2022, 12:54:31 PM (2 years ago)
Author:
alloc
Message:

Switched to use SpaceWizards.HttpListener

Location:
binary-improvements2/MapRendering/Web/API
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • binary-improvements2/MapRendering/Web/API/ExecuteConsoleCommand.cs

    r360 r382  
    11using System;
    22using System.Net;
     3using HttpListenerRequest = SpaceWizards.HttpListener.HttpListenerRequest;
     4using HttpListenerResponse = SpaceWizards.HttpListener.HttpListenerResponse;
    35
    46namespace AllocsFixes.NetConnections.Servers.Web.API {
  • binary-improvements2/MapRendering/Web/API/GetAllowedCommands.cs

    r360 r382  
    11using System.Net;
    22using AllocsFixes.JSON;
     3using HttpListenerRequest = SpaceWizards.HttpListener.HttpListenerRequest;
     4using HttpListenerResponse = SpaceWizards.HttpListener.HttpListenerResponse;
    35
    46namespace AllocsFixes.NetConnections.Servers.Web.API {
  • binary-improvements2/MapRendering/Web/API/GetAnimalsLocation.cs

    r351 r382  
    33using AllocsFixes.JSON;
    44using AllocsFixes.LiveData;
     5using HttpListenerRequest = SpaceWizards.HttpListener.HttpListenerRequest;
     6using HttpListenerResponse = SpaceWizards.HttpListener.HttpListenerResponse;
    57
    68namespace AllocsFixes.NetConnections.Servers.Web.API {
  • binary-improvements2/MapRendering/Web/API/GetHostileLocation.cs

    r351 r382  
    33using AllocsFixes.JSON;
    44using AllocsFixes.LiveData;
     5using HttpListenerRequest = SpaceWizards.HttpListener.HttpListenerRequest;
     6using HttpListenerResponse = SpaceWizards.HttpListener.HttpListenerResponse;
    57
    68namespace AllocsFixes.NetConnections.Servers.Web.API {
  • binary-improvements2/MapRendering/Web/API/GetLandClaims.cs

    r369 r382  
    33using AllocsFixes.JSON;
    44using AllocsFixes.PersistentData;
     5using HttpListenerRequest = SpaceWizards.HttpListener.HttpListenerRequest;
     6using HttpListenerResponse = SpaceWizards.HttpListener.HttpListenerResponse;
    57
    68namespace AllocsFixes.NetConnections.Servers.Web.API {
  • binary-improvements2/MapRendering/Web/API/GetLog.cs

    r350 r382  
    22using System.Net;
    33using AllocsFixes.JSON;
     4using HttpListenerRequest = SpaceWizards.HttpListener.HttpListenerRequest;
     5using HttpListenerResponse = SpaceWizards.HttpListener.HttpListenerResponse;
    46
    57namespace AllocsFixes.NetConnections.Servers.Web.API {
     
    911                public override void HandleRequest (HttpListenerRequest _req, HttpListenerResponse _resp, WebConnection _user,
    1012                        int _permissionLevel) {
    11                         int count, firstLine, lastLine;
    12 
    13                         if (_req.QueryString ["count"] == null || !int.TryParse (_req.QueryString ["count"], out count)) {
     13                        if (_req.QueryString ["count"] == null || !int.TryParse (_req.QueryString ["count"], out int count)) {
    1414                                count = 50;
    1515                        }
     
    2727                        }
    2828
    29                         if (_req.QueryString ["firstLine"] == null || !int.TryParse (_req.QueryString ["firstLine"], out firstLine)) {
    30                                 if (count > 0) {
    31                                         firstLine = LogBuffer.Instance.OldestLine;
    32                                 } else {
    33                                         firstLine = LogBuffer.Instance.LatestLine;
    34                                 }
     29                        if (_req.QueryString ["firstLine"] == null || !int.TryParse (_req.QueryString ["firstLine"], out int firstLine)) {
     30                                firstLine = count > 0 ? LogBuffer.Instance.OldestLine : LogBuffer.Instance.LatestLine;
    3531                        }
    3632
    3733                        JSONObject result = new JSONObject ();
    3834
    39                         List<LogBuffer.LogEntry> logEntries = LogBuffer.Instance.GetRange (ref firstLine, count, out lastLine);
     35                        List<LogBuffer.LogEntry> logEntries = LogBuffer.Instance.GetRange (ref firstLine, count, out int lastLine);
    4036
    4137                        JSONArray entries = new JSONArray ();
     
    4440                                entry.Add ("date", new JSONString (logEntry.date));
    4541                                entry.Add ("time", new JSONString (logEntry.time));
    46                                 entry.Add ("uptime", new JSONString (logEntry.uptime));
     42                                entry.Add ("isotime", new JSONString (logEntry.isoTime));
     43                                entry.Add ("uptime", new JSONString (logEntry.uptime.ToString ()));
    4744                                entry.Add ("msg", new JSONString (logEntry.message));
    4845                                entry.Add ("trace", new JSONString (logEntry.trace));
  • binary-improvements2/MapRendering/Web/API/GetPlayerInventories.cs

    r369 r382  
    33using AllocsFixes.JSON;
    44using AllocsFixes.PersistentData;
     5using HttpListenerRequest = SpaceWizards.HttpListener.HttpListenerRequest;
     6using HttpListenerResponse = SpaceWizards.HttpListener.HttpListenerResponse;
    57
    68namespace AllocsFixes.NetConnections.Servers.Web.API {
  • binary-improvements2/MapRendering/Web/API/GetPlayerInventory.cs

    r369 r382  
    33using AllocsFixes.JSON;
    44using AllocsFixes.PersistentData;
     5using HttpListenerRequest = SpaceWizards.HttpListener.HttpListenerRequest;
     6using HttpListenerResponse = SpaceWizards.HttpListener.HttpListenerResponse;
    57
    68namespace AllocsFixes.NetConnections.Servers.Web.API {
    79        public class GetPlayerInventory : WebAPI {
    8                 public override void HandleRequest (HttpListenerRequest _req, HttpListenerResponse _resp, WebConnection _user,
    9                         int _permissionLevel) {
     10                public override void HandleRequest (HttpListenerRequest _req, HttpListenerResponse _resp,
     11                        WebConnection _user, int _permissionLevel) {
    1012                        if (_req.QueryString ["userid"] == null) {
    1113                                _resp.StatusCode = (int) HttpStatusCode.BadRequest;
  • binary-improvements2/MapRendering/Web/API/GetPlayerList.cs

    r369 r382  
    66using AllocsFixes.JSON;
    77using AllocsFixes.PersistentData;
     8using HttpListenerRequest = SpaceWizards.HttpListener.HttpListenerRequest;
     9using HttpListenerResponse = SpaceWizards.HttpListener.HttpListenerResponse;
    810
    911namespace AllocsFixes.NetConnections.Servers.Web.API {
  • binary-improvements2/MapRendering/Web/API/GetPlayersLocation.cs

    r369 r382  
    33using AllocsFixes.JSON;
    44using AllocsFixes.PersistentData;
     5using HttpListenerRequest = SpaceWizards.HttpListener.HttpListenerRequest;
     6using HttpListenerResponse = SpaceWizards.HttpListener.HttpListenerResponse;
    57
    68namespace AllocsFixes.NetConnections.Servers.Web.API {
  • binary-improvements2/MapRendering/Web/API/GetPlayersOnline.cs

    r371 r382  
    33using AllocsFixes.JSON;
    44using AllocsFixes.PersistentData;
     5using HttpListenerRequest = SpaceWizards.HttpListener.HttpListenerRequest;
     6using HttpListenerResponse = SpaceWizards.HttpListener.HttpListenerResponse;
    57
    68namespace AllocsFixes.NetConnections.Servers.Web.API {
  • binary-improvements2/MapRendering/Web/API/GetServerInfo.cs

    r360 r382  
    22using System.Net;
    33using AllocsFixes.JSON;
     4using HttpListenerRequest = SpaceWizards.HttpListener.HttpListenerRequest;
     5using HttpListenerResponse = SpaceWizards.HttpListener.HttpListenerResponse;
    46
    57namespace AllocsFixes.NetConnections.Servers.Web.API {
  • binary-improvements2/MapRendering/Web/API/GetStats.cs

    r351 r382  
    22using AllocsFixes.JSON;
    33using AllocsFixes.LiveData;
     4using HttpListenerRequest = SpaceWizards.HttpListener.HttpListenerRequest;
     5using HttpListenerResponse = SpaceWizards.HttpListener.HttpListenerResponse;
    46
    57namespace AllocsFixes.NetConnections.Servers.Web.API {
  • binary-improvements2/MapRendering/Web/API/GetWebUIUpdates.cs

    r351 r382  
    22using AllocsFixes.JSON;
    33using AllocsFixes.LiveData;
     4using HttpListenerRequest = SpaceWizards.HttpListener.HttpListenerRequest;
     5using HttpListenerResponse = SpaceWizards.HttpListener.HttpListenerResponse;
    46
    57namespace AllocsFixes.NetConnections.Servers.Web.API {
  • binary-improvements2/MapRendering/Web/API/Null.cs

    r367 r382  
    11using System.Net;
    22using System.Text;
     3using HttpListenerRequest = SpaceWizards.HttpListener.HttpListenerRequest;
     4using HttpListenerResponse = SpaceWizards.HttpListener.HttpListenerResponse;
    35
    46namespace AllocsFixes.NetConnections.Servers.Web.API {
  • binary-improvements2/MapRendering/Web/API/WebAPI.cs

    r367 r382  
    1 using System.Net;
    21using System.Text;
    32using AllocsFixes.JSON;
     3using HttpListenerRequest = SpaceWizards.HttpListener.HttpListenerRequest;
     4using HttpListenerResponse = SpaceWizards.HttpListener.HttpListenerResponse;
    45
    56namespace AllocsFixes.NetConnections.Servers.Web.API {
     
    4445                }
    4546
    46                 public abstract void HandleRequest (HttpListenerRequest _req, HttpListenerResponse _resp, WebConnection _user,
    47                         int _permissionLevel);
     47                public abstract void HandleRequest (HttpListenerRequest _req, HttpListenerResponse _resp,
     48                        WebConnection _user, int _permissionLevel);
    4849
    4950                public virtual int DefaultPermissionLevel () {
Note: See TracChangeset for help on using the changeset viewer.