Ignore:
Timestamp:
Jan 27, 2023, 7:28:00 PM (22 months ago)
Author:
alloc
Message:
  • Major refactoring
  • Using Utf8Json for (de)serialization
  • Moving APIs to REST
  • Removing dependencies from WebServer and MapRenderer to ServerFixes
Location:
binary-improvements2/WebServer/src/WebAPI/APIs
Files:
1 added
1 moved

Legend:

Unmodified
Added
Removed
  • binary-improvements2/WebServer/src/WebAPI/APIs/GetPlayerInventories.cs

    r401 r402  
    1 using System.Collections.Generic;
    2 using AllocsFixes.JSON;
    3 using AllocsFixes.PersistentData;
    4 using JetBrains.Annotations;
    5 
    6 namespace Webserver.WebAPI {
    7         [UsedImplicitly]
    8         public class GetPlayerInventories : AbsWebAPI {
    9                 public override void HandleRequest (RequestContext _context) {
    10                         GetPlayerInventory.GetInventoryArguments (_context.Request, out bool showIconColor, out bool showIconName);
    11 
    12                         JsonArray allInventoriesResult = new JsonArray ();
    13 
    14                         foreach ((PlatformUserIdentifierAbs userId, Player player) in PersistentContainer.Instance.Players.Dict) {
    15                                 if (player == null) {
    16                                         continue;
    17                                 }
    18 
    19                                 if (player.IsOnline) {
    20                                         allInventoriesResult.Add (GetPlayerInventory.DoPlayer (userId.CombinedString, player, showIconColor, showIconName));
    21                                 }
    22                         }
    23 
    24                         WebUtils.WriteJson (_context.Response, allInventoriesResult);
    25                 }
    26         }
    27 }
     1// using AllocsFixes.PersistentData;
     2// using JetBrains.Annotations;
     3//
     4// namespace Webserver.WebAPI.APIs {
     5//      [UsedImplicitly]
     6//      public class GetPlayerInventories : AbsWebAPI {
     7//              public override void HandleRequest (RequestContext _context) {
     8//                      GetPlayerInventory.GetInventoryArguments (_context.Request, out bool showIconColor, out bool showIconName);
     9//
     10//                      JsonArray allInventoriesResult = new JsonArray ();
     11//
     12//                      foreach ((PlatformUserIdentifierAbs userId, Player player) in PersistentContainer.Instance.Players.Dict) {
     13//                              if (player == null) {
     14//                                      continue;
     15//                              }
     16//
     17//                              if (player.IsOnline) {
     18//                                      allInventoriesResult.Add (GetPlayerInventory.DoPlayer (userId.CombinedString, player, showIconColor, showIconName));
     19//                              }
     20//                      }
     21//
     22//                      WebUtils.WriteJson (_context.Response, allInventoriesResult);
     23//              }
     24//      }
     25// }
Note: See TracChangeset for help on using the changeset viewer.