public static void Compress(Output OutArg, string inFolderPathArg, string outFolderPathArg, int bsArg, int ZstdLevel, int MaxDegreeOfParallelismArg) { new CompressFolder(OutArg, inFolderPathArg, outFolderPathArg, bsArg, ZstdLevel, MaxDegreeOfParallelismArg); }
public static void File2Tickets(string inFile, string outDirPath, Keyset keyset, Output Out) { var inFileExtension = Path.GetExtension(inFile).ToLower(); using (var inputFile = new FileStream(inFile, FileMode.Open, FileAccess.Read)) { switch (inFileExtension) { case ".nsp": var pfs = new PartitionFileSystem(inputFile.AsStorage()); ProcessNsp.ExtractTickets(pfs, outDirPath, keyset, Out); break; case ".xci": var xci = new Xci(keyset, inputFile.AsStorage()); ProcessXci.ExtractTickets(xci, outDirPath, keyset, Out); break; case ".nspz": case ".xciz": var pfsz = new PartitionFileSystem(inputFile.AsStorage()); DecompressFs.ExtractTickets(pfsz, outDirPath, keyset, Out); break; default: throw new NotImplementedException(); } } }
public static void ExtractRomFS(string inFile, string outDirPath, Keyset keyset, Output Out) { File2Titlekey(inFile, keyset, Out); var inFileExtension = Path.GetExtension(inFile).ToLower(); switch (inFileExtension) { case ".nsp": ProcessNsp.ExtractRomFS(inFile, outDirPath, keyset, Out); break; case ".xci": ProcessXci.ExtractRomFS(inFile, outDirPath, keyset, Out); break; case ".nspz": case ".xciz": ProcessNsp.ExtractRomFS(inFile, outDirPath, keyset, Out); break; default: throw new NotImplementedException(); } }
public static void ExtractKey(Stream TicketFile, string filename, Keyset keyset, Output Out) { var titleKey = new byte[0x10]; TicketFile.Seek(0x180, SeekOrigin.Begin); TicketFile.Read(titleKey, 0, 0x10); var ticketNameWithoutAnyExtensions = filename.Split('.')[0]; if (!ticketNameWithoutAnyExtensions.TryToBytes(out var rightsId)) { throw new InvalidDataException( $"Invalid rights ID \"{ticketNameWithoutAnyExtensions}\" as ticket file name"); } keyset.TitleKeys[rightsId] = titleKey; Out.Log($"titleKey: {Utils.BytesToString(rightsId)},{Utils.BytesToString(titleKey)}\r\n"); }