예제 #1
0
        public NUSTitle loadNusTitle(NUSTitleConfig config)
        {
            NUSTitle result = new NUSTitle();

            NUSDataProvider dataProvider = getDataProvider(result, config);

            result.dataProvider = (dataProvider);

            TMD tmd = TMD.parseTMD(dataProvider.getRawTMD());

            result.TMD = (tmd);

            if (tmd == null)
            {
                //MessageBox.Show("TMD not found.");
                throw new Exception();
            }

            Ticket ticket = config.ticket;

            if (ticket == null)
            {
                ticket = Ticket.parseTicket(dataProvider.getRawTicket());
            }
            result.ticket = ticket;
            // System.out.println(ticket);

            Content fstContent = tmd.getContentByIndex(0);

            MemoryStream fstContentEncryptedStream = dataProvider.getInputStreamFromContent(fstContent, 0);

            if (fstContentEncryptedStream == null)
            {
                return(null);
            }

            byte[] fstBytes = fstContentEncryptedStream.ToArray();// StreamUtils.getBytesFromStream(fstContentEncryptedStream, (int)fstContent.getEncryptedFileSize());

            if (fstContent.isEncrypted())
            {
                AESDecryption aesDecryption = new AESDecryption(ticket.decryptedKey, new byte[0x10]);
                fstBytes = aesDecryption.decrypt(fstBytes);
            }

            Dictionary <int, Content> contents = tmd.getAllContents();

            FST fst = FST.parseFST(fstBytes, contents);

            result.FST = (fst);

            return(result);
        }
예제 #2
0
        public static NUSTitle loadNUSTitle(String WUDPath, byte[] titleKey)
        {
            NUSTitleLoader loader = new NUSTitleLoaderWUD();
            NUSTitleConfig config = new NUSTitleConfig();

            byte[]   usedTitleKey = titleKey;
            FileInfo wudFile      = new FileInfo(WUDPath);

            if (!wudFile.Exists)
            {
                //MessageBox.Show(WUDPath + " does not exist.");
                //System.exit(1);
            }

            WUDImage image = new WUDImage(wudFile);

            if (usedTitleKey == null)
            {
                FileInfo keyFile = new FileInfo(Path.GetDirectoryName(wudFile.FullName) + Path.DirectorySeparatorChar + Settings.WUD_KEY_FILENAME);
                if (!keyFile.Exists)
                {
                    //MessageBox.Show(keyFile.FullName + " does not exist and no title key was provided.");
                    return(null);
                }
                usedTitleKey = File.ReadAllBytes(keyFile.FullName);
            }
            WUDInfo wudInfo = WUDInfoParser.createAndLoad(image.WUDDiscReader, usedTitleKey);

            if (wudInfo == null)
            {
                return(null);
            }

            config.WUDInfo = (wudInfo);

            return(loader.loadNusTitle(config));
        }
예제 #3
0
 protected abstract NUSDataProvider getDataProvider(NUSTitle title, NUSTitleConfig config);
예제 #4
0
 protected override NUSDataProvider getDataProvider(NUSTitle title, NUSTitleConfig config)
 {
     return(new NUSDataProviderWUD(title, config.WUDInfo));
 }