LibHac/hactoolnet/Program.cs

26 lines
746 B
C#
Raw Normal View History

2018-06-20 19:42:56 +02:00
using System.IO;
2018-06-21 16:25:20 +02:00
using libhac;
2018-06-16 19:11:38 +02:00
2018-06-21 16:25:20 +02:00
namespace hactoolnet
2018-06-16 19:11:38 +02:00
{
2018-06-21 16:25:20 +02:00
public static class Program
2018-06-16 19:11:38 +02:00
{
static void Main(string[] args)
{
2018-06-20 19:42:56 +02:00
var keyset = ExternalKeys.ReadKeyFile(args[0]);
keyset.SetSdSeed(args[1].ToBytes());
var nax0 = new Nax0(keyset, args[2], args[3]);
2018-06-21 16:25:20 +02:00
var nca = new Nca(keyset, nax0.Stream);
2018-06-20 19:42:56 +02:00
using (var output = new FileStream(args[4], FileMode.Create))
using (var progress = new ProgressBar())
{
2018-06-21 16:25:20 +02:00
progress.LogMessage($"Title ID: {nca.TitleId:X8}");
2018-06-20 19:42:56 +02:00
progress.LogMessage($"Writing {args[4]}");
2018-06-21 16:25:20 +02:00
nax0.Stream.CopyStream(output, nax0.Stream.Length, progress);
2018-06-20 19:42:56 +02:00
}
2018-06-16 19:11:38 +02:00
}
}
}