コード例 #1
0
        public Server(string[] args)
        {
            CsScriptShell <ScriptObject> css = new CsScriptShell <ScriptObject>();

            {
                DynamicScriptProvider <ScriptObject> dsp = new DynamicScriptProvider <ScriptObject>();
                css.DSP = dsp;
            }
            Add("CsScriptShell", css);
            css.DSP.AddNamespace("Server");
            css.DSP.AddAssembly(System.Reflection.Assembly.GetExecutingAssembly().Location);

            // 执行启动脚本
            foreach (string cfg in args)
            {
                css.RunScript(cfg, "init", this);
            }
        }
コード例 #2
0
ファイル: ServerBuilder.cs プロジェクト: radtek/SCM2
        // 通用基础模块
        public static void BuildBaseComponents()
        {
            BC <NetCore>();  // 网络
            BC <UserPort>(); // 消息端口
            UserConnectionExt.ClientMessageHandler = "ServerPort";

            // 动态编译组件
            var css = new CsScriptShell <ScriptObject>();
            var dsp = new DynamicScriptProvider <ScriptObject>();

            dsp.AddNamespace("SCM");
            dsp.AddNamespace("Server");
            dsp.AddAssembly(System.Reflection.Assembly.GetExecutingAssembly().Location);
            dsp.AddNamespace("MySql");
            dsp.AddNamespace("MySql.Data");
            dsp.AddNamespace("MySql.Data.MySqlClient");
            dsp.AddAssembly(System.Reflection.Assembly.GetAssembly(typeof(MySql.Data.MySqlClient.MySqlConnection)).Location);
            dsp.AddNamespace("System.Data");
            dsp.AddAssembly(System.Reflection.Assembly.GetAssembly(typeof(System.Data.IDbConnection)).Location);
            dsp.CsScriptShell = css;
            css.DSP           = dsp;
            srv.Add("CsScriptShell", css);
        }