summaryrefslogtreecommitdiff
path: root/ConsoleApp
diff options
context:
space:
mode:
Diffstat (limited to 'ConsoleApp')
-rw-r--r--ConsoleApp/Main.cs1
-rw-r--r--ConsoleApp/ResFileCommands.cs28
2 files changed, 29 insertions, 0 deletions
diff --git a/ConsoleApp/Main.cs b/ConsoleApp/Main.cs
index 322d277..9a180f6 100644
--- a/ConsoleApp/Main.cs
+++ b/ConsoleApp/Main.cs
@@ -10,6 +10,7 @@ namespace ConsoleApp {
CommandLookup.Add("init", new InitCommand());
CommandLookup.Add("list", new ListCommand());
+ CommandLookup.Add("list-offsets", new ListOffsetsCommand());
CommandLookup.Add("import-obj", new ImportObjCommand());
CommandLookup.Add("export-obj", new ExportObjCommand());
CommandLookup.Add("export-collada", new ExportColladaCommand());
diff --git a/ConsoleApp/ResFileCommands.cs b/ConsoleApp/ResFileCommands.cs
index ac734e4..83c28b2 100644
--- a/ConsoleApp/ResFileCommands.cs
+++ b/ConsoleApp/ResFileCommands.cs
@@ -85,5 +85,33 @@ namespace ConsoleApp {
return "syntax: list <filename> -- lists the contents of a .brres file";
}
}
+
+
+ public class ListOffsetsCommand : Command {
+ // this class also doesn't inherit from ResFileCommand, because I want to
+ // keep the OffsetMap
+
+ public ListOffsetsCommand() : base("list offsets of data within a .brres file") {
+ }
+
+
+ public override void Execute(string[] args) {
+ if (args.Length == 0) {
+ Console.WriteLine("No path entered");
+ return;
+ }
+
+ SortedDictionary<int, string> offsetMap;
+ var rf = BrresReader.LoadFile(System.IO.File.ReadAllBytes(args[0]), false, out offsetMap);
+
+ foreach (var e in offsetMap) {
+ Console.WriteLine("0x{0:X} : {1}", e.Key, e.Value);
+ }
+ }
+
+ public override string GetHelp(string[] args) {
+ return "syntax: init <filename> -- creates an empty .brres file";
+ }
+ }
}