using System.Net; using System.Text; using AllocsFixes.JSON; using Webserver; using HttpListenerResponse = SpaceWizards.HttpListener.HttpListenerResponse; namespace AllocsFixes { public static class LegacyApiHelper { public static void WriteJSON (HttpListenerResponse _resp, JSONNode _root) { #if ENABLE_PROFILER jsonSerializeSampler.Begin (); #endif StringBuilder sb = new StringBuilder (); _root.ToString (sb); #if ENABLE_PROFILER jsonSerializeSampler.End (); netWriteSampler.Begin (); #endif WebUtils.WriteText (_resp, sb.ToString(), HttpStatusCode.OK, WebUtils.MimeJson); #if ENABLE_PROFILER netWriteSampler.End (); #endif } } }