diff --git a/de4dot.cui/CommandLineParser.cs b/de4dot.cui/CommandLineParser.cs index 2e4c9d6d..eb69e710 100644 --- a/de4dot.cui/CommandLineParser.cs +++ b/de4dot.cui/CommandLineParser.cs @@ -175,9 +175,13 @@ void AddAllOptions() { filesOptions.AssemblyClientFactory = new NewProcessAssemblyClientFactory(); })); miscOptions.Add(new NoArgOption(null, "keep-types", "Keep obfuscator types, fields, methods", () => { + if (newFileOptions == null) + ExitError("Please specify --keep-types after the input file name."); newFileOptions.KeepObfuscatorTypes = true; })); miscOptions.Add(new NoArgOption(null, "preserve-tokens", "Preserve important tokens, #US, #Blob, extra sig data", () => { + if (newFileOptions == null) + ExitError("Please specify --preserve-tokens after the input file name."); newFileOptions.MetadataFlags |= MetadataFlags.PreserveRids | MetadataFlags.PreserveUSOffsets | MetadataFlags.PreserveBlobOffsets | diff --git a/de4dot.cui/Program.cs b/de4dot.cui/Program.cs index 85a89308..8cf87c98 100644 --- a/de4dot.cui/Program.cs +++ b/de4dot.cui/Program.cs @@ -131,14 +131,7 @@ public static int Main(string[] args) { exitCode = 1; } catch (Exception ex) { - if (PrintFullStackTrace()) { - PrintStackTrace(ex); - Logger.Instance.LogErrorDontIgnore("\nTry the latest version!"); - } - else { - Logger.Instance.LogErrorDontIgnore("\n\n"); - Logger.Instance.LogErrorDontIgnore("Hmmmm... something didn't work. Try the latest version."); - } + PrintStackTrace(ex); exitCode = 1; } @@ -162,15 +155,6 @@ public static int Main(string[] args) { return exitCode; } - static bool PrintFullStackTrace() { - if (!Logger.Instance.IgnoresEvent(LoggerEvent.Verbose)) - return true; - if (HasEnv("STACKTRACE")) - return true; - - return false; - } - static bool HasEnv(string name) { foreach (var tmp in Environment.GetEnvironmentVariables().Keys) { var env = tmp as string;