public override object[] GetResult(params object[] p) { var url = p[0].ToString(); var func = ExtractFunction(url); if (func == null) { return new string[] { url } } ; var code = FormatCode(func); var addrs = new List <string>(); var results = JITCompile.CompileCode(code); var reg = new Regex(@"\{#(.*?)#\}"); foreach (var r in results) { var addr = reg.Replace(url, r.ToString(), 1); var cs = GetResult(addr).Select(m => m.ToString()).ToList(); addrs.AddRange(cs); } return(addrs.ToArray()); }
public override object[] Test(string sample, string code) { var s = "{# " + sample + " #}"; var func = ExtractFunction(s); if (func == null) { return new string[] { sample } } ; code = string.Format(code, func.Args); var addrs = new List <string>(); var results = JITCompile.CompileCode(code); var reg = new Regex(@"\{#(.*?)#\}"); foreach (var r in results) { var addr = reg.Replace(s, r.ToString(), 1); var cs = GetResult(addr).Select(m => m.ToString()).ToList(); addrs.AddRange(cs); } return(addrs.ToArray()); }
/// <summary> /// execute function from url /// </summary> /// <param name="url">url</param> /// <returns>execute result</returns> public override object[] GetResult(params object[] p) { var name = p[0].ToString(); var content = p[1].ToString(); var code = GetCode(name); if (string.IsNullOrEmpty(code)) { return new string[] { content } } ; return(JITCompile.CompileCode(code).ToArray()); }
public override object[] Test(string sample, string code) { code = "var content = \"" + sample + "\";\r\n" + code; return(JITCompile.CompileCode(code).ToArray()); }