/// <summary> /// 将源码编译成js代码 /// </summary> /// <param name="source">源码</param> /// <param name="filename">文件名称</param> /// <param name="isCreateFile">是否产生编译后的js文件,如果产生文件,则文件产生的目录为运行时库所在的路径,默认为Host的根路径下的Compiled/Logic/</param> /// <param name="outfilepath">产生编译后的js文件的存放路径,只有在isCreateFile=true的时候有效</param> /// <returns></returns> public Dictionary <string, string> Compile(string filename, string source, bool isCreateFile) { var p = new TagParameter(); var d = new TagData(); p.RootPath = _context.RootPath; p.CommonLibPath = _context.CommonLibPath; p.RunTimeLibPath = _context.RunTimeLibPath; p.Text = source; p.SetValue("__tags__", _context.AllTags); ModuleProxyManager.Call <HostLogicProxy, TagParameter, TagData>(p, d); Dictionary <string, string> contents = (Dictionary <string, string>)d.ExtentionObj.result; if (isCreateFile) { if (!Directory.Exists(p.RunTimeLibPath)) { Directory.CreateDirectory(p.RunTimeLibPath); } if (!Directory.Exists(p.RunTimeLibPath + HostJsConstants.LOGIC_PATH)) { Directory.CreateDirectory(p.RunTimeLibPath + HostJsConstants.LOGIC_PATH); } foreach (var item in contents) { var path = p.RunTimeLibPath + HostJsConstants.LOGIC_PATH + filename + (item.Key != "" ? "." + item.Key : "") + ".hjs"; File.WriteAllText(path, item.Value, Encoding.UTF8); } } return(contents); }
public static bool CallSingletonFLowLogic(this FlowBaseLogic.LogicCallHelper helper, string logicname, string logicaction) { var copyp = helper.Parameter.Clone <FlowParameter>(); copyp.CalledLogicName = logicname; copyp.SetValue(ParameterKey.ACTION, logicaction); return(ModuleProxyManager.Call <FlowBusinessSingletonProxy, FlowParameter, FlowData>(copyp, helper.Data)); }
public static bool CallSingletonLogic(this ConsoleLogic.LogicCallHelper helper, string logicname, string logicaction) { var copyp = helper.Parameter.Clone <ConsoleParameter>(); copyp.SetValue(ParameterKey.LOGIC, logicname); copyp.SetValue(ParameterKey.ACTION, logicaction); return(ModuleProxyManager.Call <ConsoleBusinessSingletonProxy, ConsoleParameter, DataCollection>(copyp, helper.Data)); }
protected void CallLogicSingleton(string logic, string action, params KeyValuePair <string, object>[] param) { var copyp = _p.Clone <FlowParameter>(); copyp.CalledLogicName = logic; copyp.SetValue(ParameterKey.ACTION, action); if (param != null) { foreach (var val in param) { copyp.SetValue(DomainKey.CUSTOMER_PARAMETER, val.Key, val.Value); } } ModuleProxyManager.Call <FlowBusinessSingletonProxy, FlowParameter, FlowData>(copyp, _d); }
/// <summary> /// 将源码编译成js代码 /// </summary> /// <param name="filename">文件名称</param> /// <param name="source">源码</param> /// <param name="isCreateFile">是否产生编译后的文件,如果产生文件,则文件产生的目录为Host的根路径下的Compiled/View/</param> /// <param name="outfilepath">产生编译后的js文件的存放路径,只有在isCreateFile=true的时候有效</param> /// <returns></returns> public string Compile(string filename, string source, bool isCreateFile) { var rtn = ""; var p = new TagParameter(); var d = new TagData(); p.RootPath = _context.RootPath; p.CommonLibPath = _context.CommonLibPath; p.RunTimeLibPath = _context.RunTimeLibPath; p.Text = source; p.SetValue("__tags__", _context.AllTags); ModuleProxyManager.Call <HostViewProxy, TagParameter, TagData>(p, d); rtn = d.ParsedText; if (isCreateFile) { if (!Directory.Exists(p.RunTimeLibPath + HostJsConstants.VIEW_PATH)) { Directory.CreateDirectory(p.RunTimeLibPath + HostJsConstants.VIEW_PATH); } var path = p.RunTimeLibPath + HostJsConstants.VIEW_PATH + filename + ".hjs"; File.WriteAllText(path, rtn, Encoding.UTF8); } return(rtn); }
protected void CallLogic() { ModuleProxyManager <WebParameter, WebFormData> .Call <WebFormBusinessProxy>(_wp, _d); }