@@ -1561,7 +1561,9 @@ public static IRD Read(string irdPath)
15611561 /// Prints IRD fields to console
15621562 /// </summary>
15631563 /// <param name="printPath">Optional path to save file to</param>
1564- public void Print ( string printPath = null , string irdName = null )
1564+ /// <param name="printAll">Optionally print IRD name in output header</param>
1565+ /// <param name="printAll">Optionally print all IRD data</param>
1566+ public void Print ( string printPath = null , string irdName = null , bool printAll = false )
15651567 {
15661568 // Build string from parameters
15671569 StringBuilder printText = new ( ) ;
@@ -1579,11 +1581,38 @@ public void Print(string printPath = null, string irdName = null)
15791581 printText . AppendLine ( $ "PUP Version: { SystemVersion } ") ;
15801582 printText . AppendLine ( $ "Disc Version: { DiscVersion } ") ;
15811583 printText . AppendLine ( $ "App Version: { AppVersion } ") ;
1584+ if ( printAll )
1585+ {
1586+ printText . AppendLine ( $ "Header: { ByteArrayToHexString ( Header ) } ") ;
1587+ printText . AppendLine ( $ "Footer: { ByteArrayToHexString ( Footer ) } ") ;
1588+ }
15821589 printText . AppendLine ( $ "Regions: { RegionCount } ") ;
1590+ if ( printAll )
1591+ {
1592+ for ( int i = 0 ; i < RegionCount ; i ++ )
1593+ {
1594+ printText . Append ( $ " Region { i } : ") ;
1595+ if ( RegionHashes [ i ] == null )
1596+ printText . AppendLine ( $ "{ ByteArrayToHexString ( NullMD5 ) } ") ;
1597+ else
1598+ printText . AppendLine ( $ "{ ByteArrayToHexString ( RegionHashes [ i ] ) } ") ;
1599+ }
1600+ }
15831601 printText . AppendLine ( $ "Files: { FileCount } ") ;
1584- if ( ExtraConfig != 0x0000 )
1602+ if ( printAll )
1603+ {
1604+ for ( int i = 0 ; i < FileCount ; i ++ )
1605+ {
1606+ printText . Append ( $ " { FileKeys [ i ] : X7} : ") ;
1607+ if ( FileHashes [ i ] == null )
1608+ printText . AppendLine ( $ "{ ByteArrayToHexString ( NullMD5 ) } ") ;
1609+ else
1610+ printText . AppendLine ( $ "{ ByteArrayToHexString ( FileHashes [ i ] ) } ") ;
1611+ }
1612+ }
1613+ if ( printAll || ExtraConfig != 0x0000 )
15851614 printText . AppendLine ( $ "Extra Config: { ExtraConfig : X4} ") ;
1586- if ( Attachments != 0x0000 )
1615+ if ( printAll || Attachments != 0x0000 )
15871616 printText . AppendLine ( $ "Attachments: { Attachments : X4} ") ;
15881617 printText . AppendLine ( $ "Unique ID: { UID : X8} ") ;
15891618 printText . AppendLine ( $ "Data 1 Key: { ByteArrayToHexString ( Data1Key ) } ") ;
@@ -1610,7 +1639,9 @@ public void Print(string printPath = null, string irdName = null)
16101639 /// Prints IRD fields to a json object
16111640 /// </summary>
16121641 /// <param name="jsonPath">Optionally print to json file</param>
1613- public void PrintJson ( string jsonPath = null , bool single = true )
1642+ /// <param name="single">Optionally print single object (no trailing comma)</param>
1643+ /// <param name="printAll">Optionally print all IRD data</param>
1644+ public void PrintJson ( string jsonPath = null , bool single = true , bool printAll = false )
16141645 {
16151646 // Build string from parameters
16161647 StringBuilder json = new ( ) ;
@@ -1624,11 +1655,58 @@ public void PrintJson(string jsonPath = null, bool single = true)
16241655 json . AppendLine ( $ " \" PUP Version\" : \" { SystemVersion } \" ,") ;
16251656 json . AppendLine ( $ " \" Disc Version\" : \" { DiscVersion } \" ,") ;
16261657 json . AppendLine ( $ " \" App Version\" : \" { AppVersion } \" ,") ;
1627- json . AppendLine ( $ " \" Regions\" : \" { RegionCount } \" ,") ;
1628- json . AppendLine ( $ " \" Files\" : \" { FileCount } \" ,") ;
1629- if ( ExtraConfig != 0x0000 )
1658+ if ( printAll )
1659+ {
1660+ json . AppendLine ( $ " \" Header\" : \" { ByteArrayToHexString ( Header ) } \" ,") ;
1661+ json . AppendLine ( $ " \" Footer\" : \" { ByteArrayToHexString ( Footer ) } \" ,") ;
1662+ }
1663+ if ( ! printAll )
1664+ json . AppendLine ( $ " \" Regions\" : \" { RegionCount } \" ,") ;
1665+ else
1666+ {
1667+ json . Append ( $ " \" Regions\" : [ ") ;
1668+ for ( int i = 0 ; i < RegionCount - 1 ; i ++ )
1669+ {
1670+ if ( RegionHashes [ i ] == null )
1671+ json . Append ( $ "\" { ByteArrayToHexString ( NullMD5 ) } \" , ") ;
1672+ else
1673+ json . Append ( $ "\" { ByteArrayToHexString ( RegionHashes [ i ] ) } \" , ") ;
1674+ }
1675+ if ( RegionCount > 0 )
1676+ {
1677+ if ( RegionHashes [ RegionCount - 1 ] == null )
1678+ json . Append ( $ "\" { ByteArrayToHexString ( NullMD5 ) } \" ") ;
1679+ else
1680+ json . Append ( $ "\" { ByteArrayToHexString ( RegionHashes [ RegionCount - 1 ] ) } \" ") ;
1681+ }
1682+ json . AppendLine ( " ]," ) ;
1683+ }
1684+ if ( ! printAll )
1685+ json . AppendLine ( $ " \" Files\" : \" { FileCount } \" ,") ;
1686+ else
1687+ {
1688+ json . Append ( $ " \" Files\" : [ ") ;
1689+ for ( int i = 0 ; i < RegionCount - 1 ; i ++ )
1690+ {
1691+ json . Append ( $ " \" { FileKeys [ i ] } \" : ") ;
1692+ if ( RegionHashes [ i ] == null )
1693+ json . Append ( $ "\" { ByteArrayToHexString ( NullMD5 ) } \" , ") ;
1694+ else
1695+ json . Append ( $ "\" { ByteArrayToHexString ( FileHashes [ i ] ) } \" , ") ;
1696+ }
1697+ if ( FileCount > 0 )
1698+ {
1699+ json . Append ( $ " \" { FileKeys [ FileCount - 1 ] } \" : ") ;
1700+ if ( FileHashes [ FileCount - 1 ] == null )
1701+ json . Append ( $ "\" { ByteArrayToHexString ( NullMD5 ) } \" ") ;
1702+ else
1703+ json . Append ( $ "\" { ByteArrayToHexString ( FileHashes [ FileCount - 1 ] ) } \" ") ;
1704+ }
1705+ json . AppendLine ( " ]," ) ;
1706+ }
1707+ if ( printAll || ExtraConfig != 0x0000 )
16301708 json . AppendLine ( $ " \" Extra Config\" : \" { ExtraConfig : X4} \" ,") ;
1631- if ( Attachments != 0x0000 )
1709+ if ( printAll || Attachments != 0x0000 )
16321710 json . AppendLine ( $ " \" Attachments\" : \" { Attachments : X4} \" ,") ;
16331711 json . AppendLine ( $ " \" Unique ID\" : \" { UID : X8} \" ,") ;
16341712 json . AppendLine ( $ " \" Data 1 Key\" : \" { ByteArrayToHexString ( Data1Key ) } \" ,") ;
0 commit comments