Exemplo n.º 1
0
                protected int OnExecute(CommandLineApplication app)
                {
                    using var stream = File.OpenRead(InputIso);

                    var firstBlock = IsoUtility.GetFileOffset(stream, "SYSTEM.CNF;1");

                    if (firstBlock == -1)
                    {
                        throw new IOException("The file specified seems to not be a valid PlayStation 2 ISO.");
                    }

                    var kingdomIdxBlock = IsoUtility.GetFileOffset(stream, "KINGDOM.IDX;1");

                    if (kingdomIdxBlock == -1)
                    {
                        throw new IOException("The file specified seems to not be a Kingdom Hearts 1 ISO");
                    }

                    var idx = Idx1.Read(stream.SetPosition(kingdomIdxBlock * IsoBlockAlign));

                    foreach (var entry in idx.OrderBy(x => x.IsoBlock))
                    {
                        Console.WriteLine(Idx1Name.Lookup(entry) ?? $"@{entry.Hash:X08}");
                    }

                    return(0);
                }
Exemplo n.º 2
0
 public Img1(Stream stream, IEnumerable <Idx1> idxEntries, int firstBlock)
 {
     _stream     = stream;
     _firstBlock = firstBlock;
     Entries     = Idx1Name.Lookup(idxEntries).ToDictionary(x => x.Name ?? $"@noname/{x.Entry.Hash:X08}", x => x.Entry);
 }