Beispiel #1
0
        private static string MakeScript(string functionName, bool serializeParams, object[] args)
        {
            IEnumerable <string> values = from a in args
                                          select JavascriptExecutor.Serialize(a, serializeParams);

            return(functionName + "(" + string.Join(",", values) + ")");
        }
Beispiel #2
0
 private static string Serialize(object value, bool serializeValue)
 {
     if (value == null)
     {
         return("null");
     }
     if (serializeValue)
     {
         string value2;
         if ((value2 = (value as string)) != null)
         {
             return(HttpUtility.JavaScriptStringEncode(value2, true));
         }
         IEnumerable source;
         if ((source = (value as IEnumerable)) != null)
         {
             return("[" + string.Join(",", from object v in source
                                      select JavascriptExecutor.Serialize(v, serializeValue)) + "]");
         }
     }
     return(value.ToString());
 }