Ignore:
Timestamp:
Aug 6, 2022, 11:32:32 PM (2 years ago)
Author:
alloc
Message:

Big refactoring in Web to pass around a Context instead of a bunch of individual arguments all the time

File:
1 edited

Legend:

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

    r383 r387  
    11using AllocsFixes.JSON;
    22using AllocsFixes.LiveData;
    3 using HttpListenerRequest = SpaceWizards.HttpListener.HttpListenerRequest;
    4 using HttpListenerResponse = SpaceWizards.HttpListener.HttpListenerResponse;
    53
    64namespace AllocsFixes.NetConnections.Servers.Web.API {
    7         public class GetWebUIUpdates : WebAPI {
    8                 public override void HandleRequest (HttpListenerRequest _req, HttpListenerResponse _resp, WebConnection _user,
    9                         int _permissionLevel) {
     5        public class GetWebUIUpdates : AbsWebAPI {
     6                public override void HandleRequest (RequestContext _context) {
    107                        int latestLine;
    11                         if (_req.QueryString ["latestLine"] == null ||
    12                             !int.TryParse (_req.QueryString ["latestLine"], out latestLine)) {
     8                        if (_context.Request.QueryString ["latestLine"] == null ||
     9                            !int.TryParse (_context.Request.QueryString ["latestLine"], out latestLine)) {
    1310                                latestLine = 0;
    1411                        }
     
    2825                        result.Add ("newlogs", new JSONNumber (LogBuffer.Instance.LatestLine - latestLine));
    2926
    30                         WriteJSON (_resp, result);
     27                        WebUtils.WriteJson (_context.Response, result);
    3128                }
    3229
Note: See TracChangeset for help on using the changeset viewer.