5 // Jb Evain (jbevain@novell.com)
7 // Copyright (C) 2008 Novell, Inc (http://www.novell.com)
11 using System.Reflection;
15 namespace Mono.CilStripper {
19 static int Main (string [] args)
26 string file = args [0];
27 string output = args.Length > 1 ? args [1] : file;
28 bool replace = file == output;
31 using (var assembly = AssemblyDefinition.ReadAssembly (file, new ReaderParameters { ReadWrite = replace })) {
32 StripAssembly (assembly, replace ? null : output);
36 Console.WriteLine ("Assembly {0} stripped", file);
38 Console.WriteLine ("Assembly {0} stripped out into {1}", file, output);
40 } catch (TargetInvocationException tie) {
41 Console.WriteLine ("Error: {0}", tie.InnerException);
42 } catch (Exception e) {
43 Console.WriteLine ("Error: {0}", e);
48 static void StripAssembly (AssemblyDefinition assembly, string output)
50 AssemblyStripper.StripAssembly (assembly, output);
55 Console.WriteLine ("Mono CIL Stripper");
61 Console.WriteLine ("Usage: mono-cil-strip file [output]");