From bebf897e31eb7b8b5775e2e6150e87430b2f9c51 Mon Sep 17 00:00:00 2001 From: zc <2650838+Wack0@users.noreply.github.com> Date: Sun, 7 Aug 2022 15:48:50 +0100 Subject: [PATCH] ifpsdasm: Add some usage and confirmation text. Use only a single argument, not all arguments. --- ifpsdasm/Program.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/ifpsdasm/Program.cs b/ifpsdasm/Program.cs index e562b6f..2d76177 100644 --- a/ifpsdasm/Program.cs +++ b/ifpsdasm/Program.cs @@ -13,13 +13,20 @@ namespace ifpsdasm { static void Main(string[] args) { - foreach (var arg in args) + if (args.Length == 0) { - var ext = Path.GetExtension(arg); - var dis = arg.Substring(0, arg.Length - ext.Length) + ".txt"; - using (var stream = File.OpenRead(arg)) - File.WriteAllText(dis, Script.Load(stream).Disassemble()); + Console.WriteLine("Usage: {0} ", Path.GetFileName(System.Reflection.Assembly.GetEntryAssembly().Location)); + Console.WriteLine(); + Console.WriteLine("RemObjects PascalScript disassembler."); + Console.WriteLine("Writes the output to the *.txt file in the same directory as the passed in script bytecode."); + return; } + var arg = args[0]; + var ext = Path.GetExtension(arg); + var dis = arg.Substring(0, arg.Length - ext.Length) + ".txt"; + using (var stream = File.OpenRead(arg)) + File.WriteAllText(dis, Script.Load(stream).Disassemble()); + Console.WriteLine("Disassembled script to {0}", dis); } } }