Commands a child process to perform some action.
コード例 #1
0
ファイル: WorkerProcess.cs プロジェクト: paulbartrum/jurassic
        /// <summary>
        /// Processes worker process requests.
        /// </summary>
        public static WorkerProcessResponse ProcessRequest(WorkerProcessRequest request)
        {
            var engine = new ScriptEngine();

            var response = new WorkerProcessResponse();
            try
            {
                // Execute the provided script.
                object result = engine.Evaluate(request.Script);
                response.JsonResult = JSONObject.Stringify(engine, result);
            }
            catch (Exception e)
            {
                // There was an error.
                response.ErrorType = e.GetType().Name;
                response.ErrorMessage = e.Message;
            }

            return response;
        }
コード例 #2
0
        /// <summary>
        /// Processes worker process requests.
        /// </summary>
        public static WorkerProcessResponse ProcessRequest(WorkerProcessRequest request)
        {
            var engine = new ScriptEngine();

            var response = new WorkerProcessResponse();

            try
            {
                // Execute the provided script.
                object result = engine.Evaluate(request.Script);
                response.JsonResult = JSONObject.Stringify(engine, result);
            }
            catch (Exception e)
            {
                // There was an error.
                response.ErrorType    = e.GetType().Name;
                response.ErrorMessage = e.Message;
            }

            return(response);
        }