Changeset 387 for binary-improvements2/MapRendering/Web/API/GetLog.cs
- Timestamp:
- Aug 6, 2022, 11:32:32 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements2/MapRendering/Web/API/GetLog.cs
r383 r387 1 1 using System.Collections.Generic; 2 2 using AllocsFixes.JSON; 3 using HttpListenerRequest = SpaceWizards.HttpListener.HttpListenerRequest;4 using HttpListenerResponse = SpaceWizards.HttpListener.HttpListenerResponse;5 3 6 4 namespace AllocsFixes.NetConnections.Servers.Web.API { 7 public class GetLog : WebAPI {5 public class GetLog : AbsWebAPI { 8 6 private const int MAX_COUNT = 1000; 9 7 10 public override void HandleRequest (HttpListenerRequest _req, HttpListenerResponse _resp, WebConnection _user, 11 int _permissionLevel) { 12 if (_req.QueryString ["count"] == null || !int.TryParse (_req.QueryString ["count"], out int count)) { 8 public override void HandleRequest (RequestContext _context) { 9 if (_context.Request.QueryString ["count"] == null || !int.TryParse (_context.Request.QueryString ["count"], out int count)) { 13 10 count = 50; 14 11 } … … 26 23 } 27 24 28 if (_ req.QueryString ["firstLine"] == null || !int.TryParse (_req.QueryString ["firstLine"], out int firstLine)) {25 if (_context.Request.QueryString ["firstLine"] == null || !int.TryParse (_context.Request.QueryString ["firstLine"], out int firstLine)) { 29 26 firstLine = count > 0 ? LogBuffer.Instance.OldestLine : LogBuffer.Instance.LatestLine; 30 27 } … … 37 34 foreach (LogBuffer.LogEntry logEntry in logEntries) { 38 35 JSONObject entry = new JSONObject (); 39 entry.Add ("date", new JSONString (logEntry.date));40 entry.Add ("time", new JSONString (logEntry.time));41 36 entry.Add ("isotime", new JSONString (logEntry.isoTime)); 42 37 entry.Add ("uptime", new JSONString (logEntry.uptime.ToString ())); … … 51 46 result.Add ("entries", entries); 52 47 53 W riteJSON (_resp, result);48 WebUtils.WriteJson (_context.Response, result); 54 49 } 55 50 }
Note:
See TracChangeset
for help on using the changeset viewer.