public static string WhoIsResponse(HttpListenerRequest request) { try { string p = request.QueryString.Get("name"); if (p == null || p == "") { return("Error"); } WhoWas data = new WhoWas(p); Group grp = Group.Find(data.rank); data.banned = grp != null && grp.Permission == LevelPermission.Banned; if (data.banned) { string[] bandata = Ban.GetBanData(p); data.banned_by = bandata[0]; data.ban_reason = bandata[1]; data.banned_time = bandata[2]; } return(JsonConvert.SerializeObject(data, Formatting.Indented)); } catch (Exception e) { Logger.WriteError(e); } return("Error"); }
public static string WhoIsResponse(HttpListenerRequest request) { try { string p = request.QueryString.Get("name"); if (p == null || p == "") return "Error"; var whois = new WhoWas(p); if (whois.rank.Contains("banned")) whois.banned = true; else whois.banned = Ban.Isbanned(p); string[] bandata; if (whois.banned) { bandata = Ban.Getbandata(p); whois.banned_by = bandata[0]; whois.ban_reason = bandata[1].Replace("%20", " "); whois.banned_time = bandata[2].Replace("%20", " "); } return JsonConvert.SerializeObject(whois, Formatting.Indented); } catch(Exception e) { Logger.WriteError(e); } return "Error"; }