5 // Jb Evain (jbevain@novell.com)
7 // Copyright (C) 2008 Novell, Inc (http://www.novell.com)
15 namespace Mono.CilStripper {
19 static void Main (string [] args)
26 string file = args [0];
27 string output = args.Length > 1 ? args [1] : file;
30 AssemblyDefinition assembly = AssemblyFactory.GetAssembly (file);
31 StripAssembly (assembly, output);
34 Console.WriteLine ("Assembly {0} stripped out into {1}", file, output);
36 Console.WriteLine ("Assembly {0} stripped", file);
37 } catch (Exception e) {
38 Console.WriteLine ("Error: {0}", e);
42 static void StripAssembly (AssemblyDefinition assembly, string output)
44 Type stripper = typeof (AssemblyDefinition).Assembly.GetType ("Mono.Cecil.AssemblyStripper");
46 throw new NotSupportedException ("Cecil doesn't have support for mono-cil-strip");
48 stripper.GetMethod ("StripAssembly").Invoke (null, new object [] { assembly, output });
53 Console.WriteLine ("Mono CIL Stripper");
59 Console.WriteLine ("Usage: mono-cil-strip file [output]");