コード例 #1
0
        /// <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);
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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));
        }
コード例 #4
0
        protected void WaitCallLogicAsync(dynamic callresult)
        {
            if (callresult == null || callresult.callproxy == null || callresult.callparameter == null)
            {
                return;
            }
            var proxy = (IModularAsyncProxy <FlowParameter, FlowData>)callresult.callproxy;
            var callp = (FlowParameter)callresult.callparameter;

            ModuleProxyManager.EndCall <IModularAsyncProxy <FlowParameter, FlowData>, FlowParameter, FlowData>(proxy, callp, _d);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        protected FrameDLRObject CallLogicSingletonAsync(string logic, string action, Action <FlowParameter, FlowData> callback, params KeyValuePair <string, object>[] param)
        {
            dynamic rtn   = FrameDLRObject.CreateInstance();
            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);
                }
            }
            var proxy = ModuleProxyManager.BeginCall <FlowBusinessSingletonProxy, FlowParameter, FlowData>(copyp, _d, callback);

            rtn.callproxy     = proxy;
            rtn.callparameter = copyp;

            return(rtn);
        }
コード例 #7
0
ファイル: HostJsView.cs プロジェクト: redwolf0817/EFFC3.0
        /// <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);
        }
コード例 #8
0
ファイル: PageBase.cs プロジェクト: redwolf0817/EFFC3.0
 protected void CallLogic()
 {
     ModuleProxyManager <WebParameter, WebFormData> .Call <WebFormBusinessProxy>(_wp, _d);
 }