Changeset 325 for binary-improvements/MapRendering/Web/API/GetLandClaims.cs
- Timestamp:
- Sep 4, 2018, 1:00:48 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/MapRendering/Web/API/GetLandClaims.cs
r253 r325 1 using System.Collections.Generic; 2 using System.Net; 1 3 using AllocsFixes.JSON; 2 4 using AllocsFixes.PersistentData; 3 using System;4 using System.Collections.Generic;5 using System.Net;6 5 7 namespace AllocsFixes.NetConnections.Servers.Web.API 8 { 6 namespace AllocsFixes.NetConnections.Servers.Web.API { 9 7 public class GetLandClaims : WebAPI { 10 public override void HandleRequest (HttpListenerRequest req, HttpListenerResponse resp, WebConnection user, int permissionLevel) { 8 public override void HandleRequest (HttpListenerRequest req, HttpListenerResponse resp, WebConnection user, 9 int permissionLevel) { 11 10 string requestedSteamID = string.Empty; 12 11 … … 15 14 requestedSteamID = req.QueryString ["steamid"]; 16 15 if (requestedSteamID.Length != 17 || !ulong.TryParse (requestedSteamID, out lViewersSteamID)) { 17 resp.StatusCode = (int) HttpStatusCode.BadRequest;16 resp.StatusCode = (int) HttpStatusCode.BadRequest; 18 17 Web.SetResponseTextContent (resp, "Invalid SteamID given"); 19 18 return; … … 25 24 26 25 bool bViewAll = WebConnection.CanViewAllClaims (permissionLevel); 27 26 28 27 JSONObject result = new JSONObject (); 29 28 result.Add ("claimsize", new JSONNumber (GamePrefs.GetInt (EnumGamePrefs.LandClaimSize))); … … 35 34 if (!string.IsNullOrEmpty (requestedSteamID) || !bViewAll) { 36 35 if (!string.IsNullOrEmpty (requestedSteamID) && !bViewAll) { 37 ownerFilters = new LandClaimList.OwnerFilter[] {36 ownerFilters = new[] { 38 37 LandClaimList.SteamIdFilter (user.SteamID.ToString ()), 39 38 LandClaimList.SteamIdFilter (requestedSteamID) 40 39 }; 41 40 } else if (!bViewAll) { 42 ownerFilters = new LandClaimList.OwnerFilter[] { LandClaimList.SteamIdFilter (user.SteamID.ToString ())};41 ownerFilters = new[] {LandClaimList.SteamIdFilter (user.SteamID.ToString ())}; 43 42 } else { 44 ownerFilters = new LandClaimList.OwnerFilter[] { LandClaimList.SteamIdFilter (requestedSteamID)};43 ownerFilters = new[] {LandClaimList.SteamIdFilter (requestedSteamID)}; 45 44 } 46 45 } 46 47 47 LandClaimList.PositionFilter[] posFilters = null; 48 48 49 Dictionary<P ersistentData.Player, List<Vector3i>> claims = LandClaimList.GetLandClaims (ownerFilters, posFilters);49 Dictionary<Player, List<Vector3i>> claims = LandClaimList.GetLandClaims (ownerFilters, posFilters); 50 50 51 foreach (KeyValuePair<PersistentData.Player, List<Vector3i>> kvp in claims) { 52 51 foreach (KeyValuePair<Player, List<Vector3i>> kvp in claims) { 53 52 try { 54 53 JSONObject owner = new JSONObject (); … … 83 82 } 84 83 } 85
Note:
See TracChangeset
for help on using the changeset viewer.