Skip to content

Commit 0ef06c3

Browse files
committed
Fix rename functionality, mention in reademe
1 parent c1c25b5 commit 0ef06c3

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

IRDKit/IRDKit.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<LangVersion>latest</LangVersion>
1212
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
1313
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
14-
<Version>0.9.0</Version>
14+
<Version>0.9.1</Version>
1515

1616
<!-- Package Properties -->
1717
<Authors>Deterous</Authors>

IRDKit/Program.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ public class RenameOptions
9797
[Option('s', "serial", HelpText = "Appends disc serial to new IRD filename")]
9898
public bool Serial { get; set; }
9999

100+
[Option('e', "version", HelpText = "Appends disc version to new IRD filename")]
101+
public bool Ver { get; set; }
102+
100103
[Option('c', "crc", HelpText = "Appends ISO CRC to new IRD filename")]
101104
public bool CRC { get; set; }
102105

@@ -414,7 +417,7 @@ private static void Run(object args)
414417
{
415418
try
416419
{
417-
RenameIRD(file, datfile, serial: opt.Serial, crc: opt.CRC, verbose: opt.Verbose);
420+
RenameIRD(file, datfile, serial: opt.Serial, ver: opt.Ver, crc: opt.CRC, verbose: opt.Verbose);
418421
}
419422
catch (Exception e)
420423
{
@@ -435,7 +438,7 @@ private static void Run(object args)
435438
// Rename provided IRD path
436439
try
437440
{
438-
RenameIRD(irdPath, datfile, serial: opt.Serial, crc: opt.CRC, verbose: opt.Verbose);
441+
RenameIRD(irdPath, datfile, serial: opt.Serial, ver: opt.Ver, crc: opt.CRC, verbose: opt.Verbose);
439442
}
440443
catch (Exception e)
441444
{
@@ -1034,7 +1037,7 @@ public static string GetDatFilename(IRD ird, XDocument datfile)
10341037
return node.Attribute("name").Value;
10351038
}
10361039

1037-
public static void RenameIRD(string irdPath, XDocument datfile, bool serial = false, bool crc = false, bool verbose = false)
1040+
public static void RenameIRD(string irdPath, XDocument datfile, bool serial = false, bool ver = false, bool crc = false, bool verbose = false)
10381041
{
10391042
IRD ird = IRD.Read(irdPath);
10401043

@@ -1043,7 +1046,9 @@ public static void RenameIRD(string irdPath, XDocument datfile, bool serial = fa
10431046

10441047
string filename = GetDatFilename(ird, datfile) ?? throw new ArgumentException($"Cannot determine DAT filename for {irdPath}");
10451048
if (serial)
1046-
filename += $" [{ird.TitleID.Substring(0, 4)}-{ird.TitleID.Substring(5, 5)}]";
1049+
filename += $" [{ird.TitleID.Substring(0, 4).Replace('\0', ' ')}-{ird.TitleID.Substring(4, 5).Replace('\0', ' ')}]";
1050+
if (ver)
1051+
filename += $" [{ird.DiscVersion.Replace('\0', ' ')}]";
10471052
if (crc)
10481053
filename += $" [{ird.UID:X8}]";
10491054

IRDKit/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,9 @@ For all options, run `irdkit help diff`
3939

4040
To compare two IRDs, run `irdkit diff game1.ird game2.ird`
4141
The comparison can be printed to a file, e.g. `-o out.txt` or `--output=`
42+
43+
## Renaming IRDs
44+
45+
For all options, run `irdkit help rename`
46+
47+
To rename an IRD (or folder of IRDs) according to a redump DAT, run `irdkit rename -d redump.dat game.ird`

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ IRDKit is a tool that allows direct use of LibIRD functionality from a command l
1313
- Printing info about all ISOs and IRDs in a folder: `irdkit info .`
1414
- Creating an IRD from an ISO: `irdkit create game.iso`
1515
- Finding differences between two IRDs: `irdkit diff game1.ird game2.ird`
16-
- Renaming a folder of IRDs using a redump DAT: `irdkit rename -d redump.dat IRDs\`
16+
- Renaming an IRD or folder of IRDs using a redump DAT: `irdkit rename -d redump.dat game.ird`
1717

1818
For detailed usage, read more [here](IRDKit).
1919

0 commit comments

Comments
 (0)