Changeset 351 for binary-improvements/MapRendering/Web/API/GetLandClaims.cs
- Timestamp:
- Jan 19, 2019, 6:12:21 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/MapRendering/Web/API/GetLandClaims.cs
r332 r351 6 6 namespace AllocsFixes.NetConnections.Servers.Web.API { 7 7 public class GetLandClaims : WebAPI { 8 public override void HandleRequest (HttpListenerRequest req, HttpListenerResponse resp, WebConnectionuser,9 int permissionLevel) {8 public override void HandleRequest (HttpListenerRequest _req, HttpListenerResponse _resp, WebConnection _user, 9 int _permissionLevel) { 10 10 string requestedSteamID = string.Empty; 11 11 12 if ( req.QueryString ["steamid"] != null) {12 if (_req.QueryString ["steamid"] != null) { 13 13 ulong lViewersSteamID; 14 requestedSteamID = req.QueryString ["steamid"];14 requestedSteamID = _req.QueryString ["steamid"]; 15 15 if (requestedSteamID.Length != 17 || !ulong.TryParse (requestedSteamID, out lViewersSteamID)) { 16 resp.StatusCode = (int) HttpStatusCode.BadRequest;17 Web.SetResponseTextContent ( resp, "Invalid SteamID given");16 _resp.StatusCode = (int) HttpStatusCode.BadRequest; 17 Web.SetResponseTextContent (_resp, "Invalid SteamID given"); 18 18 return; 19 19 } … … 21 21 22 22 // default user, cheap way to avoid 'null reference exception' 23 user =user ?? new WebConnection ("", IPAddress.None, 0L);23 _user = _user ?? new WebConnection ("", IPAddress.None, 0L); 24 24 25 bool bViewAll = WebConnection.CanViewAllClaims ( permissionLevel);25 bool bViewAll = WebConnection.CanViewAllClaims (_permissionLevel); 26 26 27 27 JSONObject result = new JSONObject (); 28 result.Add ("claimsize", new JSONNumber (GamePrefs.GetInt (Enum GamePrefs.LandClaimSize)));28 result.Add ("claimsize", new JSONNumber (GamePrefs.GetInt (EnumUtils.Parse<EnumGamePrefs> ("LandClaimSize")))); 29 29 30 30 JSONArray claimOwners = new JSONArray (); … … 35 35 if (!string.IsNullOrEmpty (requestedSteamID) && !bViewAll) { 36 36 ownerFilters = new[] { 37 LandClaimList.SteamIdFilter ( user.SteamID.ToString ()),37 LandClaimList.SteamIdFilter (_user.SteamID.ToString ()), 38 38 LandClaimList.SteamIdFilter (requestedSteamID) 39 39 }; 40 40 } else if (!bViewAll) { 41 ownerFilters = new[] {LandClaimList.SteamIdFilter ( user.SteamID.ToString ())};41 ownerFilters = new[] {LandClaimList.SteamIdFilter (_user.SteamID.ToString ())}; 42 42 } else { 43 43 ownerFilters = new[] {LandClaimList.SteamIdFilter (requestedSteamID)}; … … 78 78 } 79 79 80 WriteJSON ( resp, result);80 WriteJSON (_resp, result); 81 81 } 82 82 }
Note:
See TracChangeset
for help on using the changeset viewer.