Fix key printing

This commit is contained in:
Alex Barney 2018-10-05 12:29:52 -05:00
parent db00267ef4
commit 47a3eda0ed
2 changed files with 4 additions and 5 deletions

View file

@ -396,6 +396,8 @@ namespace LibHac
public static string PrintKeys(Keyset keyset, Dictionary<string, KeyValue> dict)
{
if(dict.Count == 0) return string.Empty;
var sb = new StringBuilder();
int maxNameLength = dict.Values.Max(x => x.Name.Length);
@ -429,13 +431,10 @@ namespace LibHac
public static string PrintTitleKeys(Keyset keyset)
{
var sb = new StringBuilder();
int maxNameLength = keyset.TitleKeys.Values.Max(x => x.Length);
foreach (KeyValuePair<byte[], byte[]> kv in keyset.TitleKeys)
{
byte[] key = kv.Key;
byte[] value = kv.Value;
string line = $"{key.ToHexString().PadRight(maxNameLength)} = {value.ToHexString()}";
string line = $"{kv.Key.ToHexString()} = {kv.Value.ToHexString()}";
sb.AppendLine(line);
}

View file

@ -100,7 +100,7 @@ namespace hactoolnet
ctx.Keyset.SetSdSeed(ctx.Options.SdSeed.ToBytes());
}
if (ctx.Options.OutDir != null)
if (ctx.Options.InFileType == FileType.Keygen && ctx.Options.OutDir != null)
{
string dir = ctx.Options.OutDir;
Directory.CreateDirectory(dir);