private void CompileCsharp() { string assemblyName = string.Format("DynamicScripts.{0}", "CsScript"); var refAssemblyNames = new List <string>(SettupInfo.ReferencedAssemblyNames.ToArray()); refAssemblyNames.Add(_modelAssemblyPath); string[] sources = _csharpCodeCache.Select(t => { string src = t.Value.Source; t.Value.Source = null; return(SettupInfo.ScriptIsDebug ? t.Value.FileName : src); }).ToArray(); if (sources.Length == 0) { return; } //调试模式使用File编译 var result = SettupInfo.ScriptIsDebug ? ScriptCompiler.Compile(sources, refAssemblyNames.ToArray(), assemblyName, SettupInfo.ScriptIsDebug, false, ScriptCompiler.ScriptAssemblyTemp) : ScriptCompiler.CompileSource(sources, refAssemblyNames.ToArray(), assemblyName, SettupInfo.ScriptIsDebug, false, ScriptCompiler.ScriptAssemblyTemp); if (result != null) { _csharpAssemblyPath = result.PathToAssembly; _csharpAssembly = result.CompiledAssembly; } else { throw new Exception("The csharp script compile error"); } }
private void CompileModel() { string assemblyName = string.Format("DynamicScripts.{0}", "Model"); var refAssemblyNames = SettupInfo.ReferencedAssemblyNames.ToArray(); string[] sources = _modelCodeCache.Select(t => { string src = t.Value.Source; t.Value.Source = null; return(src); }).ToArray(); //加载实体程序集 _modelAssembly = ScriptCompiler.InjectionCompile(SettupInfo.RuntimePrivateBinPath, sources, refAssemblyNames, assemblyName, SettupInfo.ScriptIsDebug, false, out _modelAssemblyPath); }
private void CompileModel() { string assemblyName = string.Format("DynamicScripts.{0}", "Model"); var refAssemblyNames = SettupInfo.ReferencedAssemblyNames.ToArray(); string[] sources = _modelCodeCache.Select(t => { string src = t.Value.Source; t.Value.Source = null; //huhu modify reason: Support for model debugging. return(SettupInfo.ScriptIsDebug ? t.Value.FileName : src); }).ToArray(); if (sources.Length == 0) { return; } //加载实体程序集 _modelAssembly = ScriptCompiler.InjectionCompile(SettupInfo.RuntimePrivateBinPath, sources, refAssemblyNames, assemblyName, SettupInfo.ScriptIsDebug, false, out _modelAssemblyPath); if (_modelAssembly == null) { throw new Exception("The model script compile error"); } }
/// <summary> /// /// </summary> /// <returns></returns> public static IEnumerable <SchemaTable> GetEnumerable() { return(SchemaSet.Select(pair => pair.Value)); }