public int Run() { IAssemblyConverter converter; IAssemblyInput inputData; if (args.Length < 2) { // ui.WriteLine(" Missing Important Arguments."); ui.DrawHelp(); return(128); } ui.Clear(); ui.DrawInterface("Magic is about to happen!"); var clr2Papyrus = !Enumerable.Contains(args, "-clr"); var input = args[0]; if (args.Contains("-i")) { input = args[Array.IndexOf(args, "-i") + 1]; } var output = args[1]; if (args.Contains("-o")) { output = args[Array.IndexOf(args, "-o") + 1]; } var autoClose = args.Contains("x") || args.Contains("X") || args.Contains("-x") || args.Contains("-X"); if (clr2Papyrus) { var targetVersion = Enumerable.Contains(args, "-skyrim") ? PapyrusVersionTargets.Skyrim : PapyrusVersionTargets.Fallout4; var compilerOptions = !Enumerable.Contains(args, "-easy") ? PapyrusCompilerOptions.Strict : PapyrusCompilerOptions.Easy; var readerParameters = new ReaderParameters { ReadSymbols = true }; converter = new Clr2PapyrusConverter(ui, instructorProcessor, compilerOptions); var assemblyDefinition = AssemblyDefinition.ReadAssembly(input, readerParameters); assemblyDefinition.MainModule.ReadSymbols(); inputData = new ClrAssemblyInput(assemblyDefinition, targetVersion); } else { var nsResolver = new NamespaceResolver(); //var camelCaseResolver = new PascalCaseNameResolver(ui, "wordlist-fo4.txt"); // Papyrus2ClrCecilConverter converter = new Papyrus2ClrCecilConverter( ui, nameResolver, nsResolver, new TypeReferenceResolver(nsResolver, new TypeNameResolver(nameResolver))); var pexFiles = Directory.GetFiles(input, "*.pex", SearchOption.AllDirectories); ui.DrawInterface("(1/3) Reading Papyrus Assemblies."); var papyrusAssemblyDefinitions = pexFiles.Select(f => ReadPapyrusAssembly(f, pexFiles.Length)).ToArray(); inputData = new PapyrusAssemblyInput( papyrusAssemblyDefinitions ); } var outputData = converter.Convert(inputData); if (outputData != null) { outputData.Save(output); // Do something... } if (autoClose) { return(0); } while (true) { var openTargetDir = new Hotkeys("Open target directory", ConsoleKey.A, () => { Process.Start(output); }); var exit = new Hotkeys("Exit", ConsoleKey.X, () => { }); ui.DrawHotkeys(openTargetDir, exit); var posx = Console.CursorLeft; var k = Console.ReadKey(); Console.CursorLeft = posx; Console.Write(" "); if (k.Key == exit.Key) { return(0); } if (k.Key == openTargetDir.Key) { openTargetDir.Action(); } } }