public override bool Execute() { var outputPath = this.OutputPath.ItemSpec.Trim(); var debugInformation = string.IsNullOrWhiteSpace(this.DebugInformation) ? DebugInformationOptions.CommentOnly : (DebugInformationOptions)Enum.Parse(typeof(DebugInformationOptions), this.DebugInformation); var tw = new LogWriter(message => this.Log.LogMessage( MessageImportance.High, "{0}", message)); foreach (var assemblyPath in this.AssemblyPaths) { SimpleDriver.Translate( tw, assemblyPath.ItemSpec.Trim(), outputPath, this.ReadSymbols, this.EnableCpp, debugInformation); } return(true); }
public static int Main(string[] args) { var extractor = new CommandLineExtractor <IL2COption>(); try { var option = extractor.Extract(args); var debugInformationOptions = option.DebugFull ? DebugInformationOptions.Full : option.Debug ? DebugInformationOptions.CommentOnly : DebugInformationOptions.None; SimpleDriver.Translate( Console.Out, option.AssemblyPath, option.OutputPath, option.ReadSymbols, option.Cpp, debugInformationOptions); return(0); } catch (CommandLineArgumentException ex) { extractor.WriteUsages(Console.Error); return(Marshal.GetHRForException(ex)); } catch (Exception ex) { Console.Error.WriteLine(ex); return(Marshal.GetHRForException(ex)); } }
public static int Main(string[] args) { if (args.Length < 2) { Console.Error.WriteLine("Usage: IL2C.exe [options] <target assembly> <output path>"); Console.Error.WriteLine(" --cpp : Produce C++ files (apply extension *.cpp instead *.c, body will not changed)"); Console.Error.WriteLine(" --debug : Emit debug informations (contains only comments)"); Console.Error.WriteLine(" --debug-full: Emit debug informations (contains line numbers)"); return(0); } var options = args .Where(arg => arg.StartsWith("--")) .Select(arg => arg.Substring(2)) .ToArray(); var paths = args .Where(arg => !arg.StartsWith("--")) .ToArray(); var enableCpp = options.Contains("cpp"); var debug = options.Contains("debug"); var debugFull = options.Contains("debug-full"); var debugInformationOptions = debugFull ? DebugInformationOptions.Full : debug ? DebugInformationOptions.CommentOnly : DebugInformationOptions.None; var assemblyPath = paths[0]; var outputPath = paths[1]; SimpleDriver.Translate( Console.Out, assemblyPath, outputPath, enableCpp, debugInformationOptions); return(0); }