public static Assembly CompileScriptsToAssembly(IEnumerable <string> scripts, string writeToDllOptional)
        {
#if !NO_EMIT
            string script = ScriptCodeGenerator.GenerateWrappedScript(scripts, CSharpScriptUsingNamespaces, null);              //, ContextType );
            return(ScriptCompiler.CompileCode(script, writeToDllOptional));
#else
            return(null);
#endif
        }
        public static void WriteCharpScriptsCsFile()
        {
            try
            {
                //get scripts to compile
                var scriptsToCompile = scriptCache.GetScriptsToCompile();

                //generate code
                string script = "";
                if (scriptsToCompile.Count != 0)
                {
                    script  = "#if DEPLOY\r\n";
                    script += "namespace Scripts {\r\n";
                    script += ScriptCodeGenerator.GenerateWrappedScript(scriptsToCompile, CSharpScriptUsingNamespaces, null);                      //, ContextType );
                    script += "\r\n}\r\n";
                    script += "#endif";
                }

                var path = scriptCache.GeneratedCSFileName;

                //create folder
                var directory = Path.GetDirectoryName(path);
                if (!Directory.Exists(directory))
                {
                    Directory.CreateDirectory(directory);
                }

                //write file
                if (!File.Exists(path) || File.ReadAllText(path, Encoding.UTF8) != script)
                {
                    File.WriteAllText(path, script, Encoding.UTF8);
                }
            }
            catch (Exception e)
            {
                Log.Warning($"Unable to write \'{scriptCache.GeneratedCSFileName}\'. " + e.Message);
            }
        }
        public static void CheckForSyntaxErrors(string code)
        {
#if !NO_EMIT
            ScriptCodeGenerator.CheckForSyntaxErrors(code);
#endif
        }