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