同步操作将从 车江毅/NScript 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
using BSF.BaseService.NScript.Compiler;using BSF.BaseService.NScript.Core;using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace BSF.BaseService.NScript{public partial class FrDebug : Form{public FrDebug(){InitializeComponent();this.cbCompilerMode.SelectedIndex = 0;}// public BSF.BaseService.NScript.FrCodeEdit.FileInfoItem MainFileInfoItem = null;public FrCodeEdit FrParent;private void btnCall_Click(object sender, EventArgs e){try{//删除临时文件FrParent.DeleteCompilerTempFiles();//保存FrParent.SaveFileCode();//编译EnumCompilerMode compilerMode = (EnumCompilerMode)Enum.Parse(typeof(EnumCompilerMode), this.cbCompilerMode.Text.Trim(), true);FrParent.RunCompiler(compilerMode);//调试string compilertempMainFilePath = FrParent.GetMainCompilerTempFile();if (compilerMode == EnumCompilerMode.Main){//var result = NScriptHelper.RunCompiler(new CompilerParams()//{// EnumSourceType = EnumSourceType.File,// CodeOrFileName = compilertempMainFilePath,// EnumCompilerMode = compilerMode//});System.Diagnostics.Process p = new System.Diagnostics.Process();p.StartInfo.FileName = "cmd.exe";//要执行的程序名称p.StartInfo.UseShellExecute = false;p.StartInfo.RedirectStandardInput = true;//可能接受来自调用程序的输入信息p.StartInfo.RedirectStandardOutput = true;//由调用程序获取输出信息p.StartInfo.CreateNoWindow = true;//不显示程序窗口p.Start();//启动程序p.StandardInput.WriteLine(System.Windows.Forms.Application.ExecutablePath + " /run " + compilertempMainFilePath);this.BeginInvoke(new Action(()=>{System.Threading.Thread.Sleep(1000);FrParent.DeleteCompilerTempFiles();}), null);//AppDomain.CurrentDomain.ExecuteAssembly(result.Assembly.Location, new string[]{});}else{CompilerResult result = null;var obj = NScriptHelper.Run<Object>(new CompilerParams(){EnumSourceType = EnumSourceType.File,CodeOrFileName = compilertempMainFilePath,EnumCompilerMode = compilerMode}, this.tbClassPath.Text.Trim(), this.tbMethodName.Text.Trim(),new Object[] { }, out result);FrParent.DeleteCompilerTempFiles();MessageBox.Show(obj == null ? "" : obj.ToString());}}catch(Exception exp){FrParent.DeleteCompilerTempFiles();if (exp is NScript.Compiler.NScriptException)MessageBox.Show("调用出错:" + (exp as NScriptException).MessageDetail);elseMessageBox.Show("调用出错:" + exp.Message);}}private void FrDebug_FormClosing(object sender, FormClosingEventArgs e){this.Hide();e.Cancel = true;}}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。