5 // Rodrigo Kumpera (rkumpera@novell.com)
7 // Copyright (C) 2008 Novell, Inc (http://www.novell.com)
9 // Licensed under the MIT license. See LICENSE file in the project root for full license information.
12 using System.Reflection;
16 public class BatchCompiler : MarshalByRefObject {
17 static AppDomain current;
19 static BatchCompiler NewBatchCompiler () {
21 AppDomain.Unload (current);
23 current = AppDomain.CreateDomain ("test");
24 BatchCompiler compiler = (BatchCompiler) current.CreateInstanceAndUnwrap(
25 Assembly.GetExecutingAssembly().FullName,
26 "Verifier.BatchCompiler");
30 public static void Main (String[] args) {
32 BatchCompiler bc = NewBatchCompiler ();
34 foreach (string src in Directory.GetFiles (".", "*.il")) {
37 bc = NewBatchCompiler ();
39 Console.WriteLine ("Total compiled successfully {0}", total);
42 public bool Compile (String src) {
44 Mono.ILASM.Driver.Main (new string[] { src });
45 string binary = src.Substring (0, src.Length - 3) + ".exe";
46 return File.Exists (binary);
47 } catch (Exception e) {
48 Console.WriteLine ("Error compiling {0}", e);