コード例 #1
0
 /// <summary>
 /// 使用脚本代码初始化ScriptEngine对象实例。
 /// </summary>
 /// <param name="sourceFromFile">脚本代码文件。</param>
 /// <param name="ignoreErrors">忽略编译错误。</param>
 public ScriptEngine(string sourceFromFile, bool ignoreErrors)
 {
     m_Struct = new CodeStruct(sourceFromFile);
     try
     {
         this.m_Assembly = this.CreateAssembly();
     }
     catch (ScriptCompileException sce)
     {
         if (ignoreErrors)
         {
             this.CompileException = sce;
         }
         else
         {
             throw sce;
         }
     }
 }
コード例 #2
0
 public ScriptEngine(bool ignoreErrors, string sourcecode, List <string> references)
 {
     m_Struct            = new CodeStruct();
     m_Struct.References = references;
     m_Struct.SourceCode = sourcecode;
     try
     {
         this.m_Assembly = this.CreateAssembly();
     }
     catch (ScriptCompileException sce)
     {
         if (ignoreErrors)
         {
             this.CompileException = sce;
         }
         else
         {
             throw sce;
         }
     }
 }