コード例 #1
0
        private void Init(string code)
        {
            var compiler = new DynamicCodeCompiler();

            compiler.SourceCode = code;

            foreach (string line in code.Replace(Environment.NewLine, "\n").Split('\n'))
            {
                if (line.StartsWith(@"//@Ref:"))
                {
                    compiler.CompilerParameters.ReferencedAssemblies.Add(line.Split(':')[1]);
                }
            }

            try
            {
                _netWrapper = new NetWrapper(compiler.Compile());
            }
            catch (Exception e)
            {
                _hasError = true;
                KryptonMessageBox.Show(e.Message);
            }
        }
コード例 #2
0
        private void Init(string code)
        {
            var compiler = new DynamicCodeCompiler();
            compiler.SourceCode = code;

            foreach (string line in code.Replace(Environment.NewLine, "\n").Split('\n'))
            {
                if (line.StartsWith(@"//@Ref:"))
                    compiler.CompilerParameters.ReferencedAssemblies.Add(line.Split(':')[1]);
            }

            try
            {
                _netWrapper = new NetWrapper(compiler.Compile());
            }
            catch (Exception e)
            {
                _hasError = true;
                KryptonMessageBox.Show(e.Message);
            }
        }