Example #1
0
 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);
 }
Example #2
0
 /// <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);
 }
Example #3
0
 public HttpResponse(HttpImplementation impl)
 {
     this.impl = impl;
 }
Example #4
0
 public Program()
 {
     webServer = new HttpSocketImpl(processResponse);
     webServer.Listen();
 }