Last change
on this file since 382 was 382, checked in by alloc, 2 years ago |
Switched to use SpaceWizards.HttpListener
|
File size:
1.0 KB
|
Line | |
---|
1 | using System.Collections.Generic;
|
---|
2 | using System.Net;
|
---|
3 | using AllocsFixes.JSON;
|
---|
4 | using AllocsFixes.PersistentData;
|
---|
5 | using HttpListenerRequest = SpaceWizards.HttpListener.HttpListenerRequest;
|
---|
6 | using HttpListenerResponse = SpaceWizards.HttpListener.HttpListenerResponse;
|
---|
7 |
|
---|
8 | namespace AllocsFixes.NetConnections.Servers.Web.API {
|
---|
9 | public class GetPlayerInventories : WebAPI {
|
---|
10 | public override void HandleRequest (HttpListenerRequest _req, HttpListenerResponse _resp, WebConnection _user,
|
---|
11 | int _permissionLevel) {
|
---|
12 | GetPlayerInventory.GetInventoryArguments (_req, out bool showIconColor, out bool showIconName);
|
---|
13 |
|
---|
14 | JSONArray AllInventoriesResult = new JSONArray ();
|
---|
15 |
|
---|
16 | foreach (KeyValuePair<PlatformUserIdentifierAbs, Player> kvp in PersistentContainer.Instance.Players.Dict) {
|
---|
17 | Player p = kvp.Value;
|
---|
18 |
|
---|
19 | if (p == null) {
|
---|
20 | continue;
|
---|
21 | }
|
---|
22 |
|
---|
23 | if (p.IsOnline) {
|
---|
24 | AllInventoriesResult.Add (GetPlayerInventory.DoPlayer (kvp.Key.CombinedString, p, showIconColor, showIconName));
|
---|
25 | }
|
---|
26 | }
|
---|
27 |
|
---|
28 | WriteJSON (_resp, AllInventoriesResult);
|
---|
29 | }
|
---|
30 | }
|
---|
31 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.