Esempio n. 1
0
        /// <summary>
        /// Compiles script into assembly with CSExecutor and loads it in current AppDomain
        /// </summary>
        /// <param name="scriptFile">The name of script file to be compiled.</param>
        /// <param name="assemblyFile">The name of compiled assembly. If set to null a temnporary file name will be used.</param>
        /// <param name="debugBuild">true if debug information should be included in assembly; otherwise, false.</param>
        /// <returns></returns>
        public static Assembly Load(string scriptFile, string assemblyFile, bool debugBuild)
        {
            CSExecutor exec = new CSExecutor();
            exec.Rethrow = true;
            string outputFile = exec.Compile(scriptFile, assemblyFile, debugBuild);

            AssemblyName asmName = AssemblyName.GetAssemblyName(outputFile);
            return AppDomain.CurrentDomain.Load(asmName);
        }
Esempio n. 2
0
 /// <summary>
 /// Invokes CSExecutor (C# script engine)
 /// </summary>
 public void Execute(GSharp.Scripting.CSScript.PrintDelegate print, string[] args, bool rethrow)
 {
     csscript.AppInfo.appName = new FileInfo(Application.ExecutablePath).Name;
     CSExecutor exec = new CSExecutor();
     exec.Rethrow = rethrow;
     exec.Execute(args, new PrintDelegate(print != null ? print : new GSharp.Scripting.CSScript.PrintDelegate(DefaultPrint)));
 }
Esempio n. 3
0
 /// <summary>
 /// Compiles script into assembly with CSExecutor
 /// </summary>
 /// <param name="scriptFile">The name of script file to be compiled.</param>
 /// <param name="assemblyFile">The name of compiled assembly. If set to null a temnporary file name will be used.</param>
 /// <param name="debugBuild">true if debug information should be included in assembly; otherwise, false.</param>
 /// <returns></returns>
 public static string Compile(string scriptFile, string assemblyFile, bool debugBuild)
 {
     CSExecutor exec = new CSExecutor();
     exec.Rethrow = true;
     return exec.Compile(scriptFile, assemblyFile, debugBuild);
 }