public static void expandString(HttpImplementation impl, String format, Object[] args) { if (args != null && args.Length != 0) { byte[] bytes = Encoding.UTF8.GetBytes(format); int start = 0; for (int i = 0; i < args.Length; i++) { String tag = "{" + i + "}"; int stop = format.IndexOf(tag); if (stop != -1) { impl.BinaryWrite(bytes, start, stop - start); start = stop + tag.Length; if (args[i] != null) impl.Write(args[i].ToString()); if (i == args.Length - 1) { // Write the tail impl.BinaryWrite(bytes, start, bytes.Length - start); } } } } else // No formatting impl.Write(format); }
/// <summary> Specify how the JS lib makes the requests </summary> public JsGenerator UseHttpImplementation(HttpImplementation imp) { switch (imp) { case HttpImplementation.Xhr: JavascriptHttpImplementation = XhrBoilerplate; break; } return(this); }
public HttpResponse(HttpImplementation impl) { this.impl = impl; }
public Program() { webServer = new HttpSocketImpl(processResponse); webServer.Listen(); }