LibHac/hactoolnet/ProcessKip.cs
Alex Barney 3d50085e22
Use Storage throughout the library instead of Stream (#18)
*Create an IStorage interface and Storage abstract class to use instead of Stream

* Improve AES-XTS performance by ~16x

* Double AES-CTR performance: 800 MB/s -> 1600 MB/s on a 6700K

* Add AES-XTS tests

* Add AES benchmark and AES-CTR writing

* Add support for a hashed FAT in save files

* Add option to export decrypted NCA

* Allow opening decrypted package1 and package2

* Make sure romfs disposal can cascade all the way down

* Validate NCA, NPDM and package2 signatures
2018-11-18 23:20:34 -05:00

38 lines
1 KiB
C#

using System.IO;
using LibHac;
using LibHac.IO;
namespace hactoolnet
{
internal static class ProcessKip
{
public static void ProcessKip1(Context ctx)
{
using (var file = new FileStream(ctx.Options.InFile, FileMode.Open, FileAccess.Read))
{
var kip = new Kip(file.AsStorage());
kip.OpenRawFile();
}
}
public static void ProcessIni1(Context ctx)
{
using (var file = new FileStream(ctx.Options.InFile, FileMode.Open, FileAccess.Read))
{
var ini1 = new Ini1(file.AsStorage());
string outDir = ctx.Options.OutDir;
if (outDir != null)
{
Directory.CreateDirectory(outDir);
foreach (Kip kip in ini1.Kips)
{
kip.OpenRawFile().WriteAllBytes(Path.Combine(outDir, $"{kip.Header.Name}.kip1"));
}
}
}
}
}
}