diff --git a/IRDKit/IRDKit.csproj b/IRDKit/IRDKit.csproj index 89bb46c..6d834b1 100644 --- a/IRDKit/IRDKit.csproj +++ b/IRDKit/IRDKit.csproj @@ -11,7 +11,7 @@ latest true true - 0.9.0 + 0.9.1 Deterous diff --git a/IRDKit/Program.cs b/IRDKit/Program.cs index af415db..6aaa3a0 100644 --- a/IRDKit/Program.cs +++ b/IRDKit/Program.cs @@ -97,6 +97,9 @@ namespace IRDKit [Option('s', "serial", HelpText = "Appends disc serial to new IRD filename")] public bool Serial { get; set; } + [Option('e', "version", HelpText = "Appends disc version to new IRD filename")] + public bool Ver { get; set; } + [Option('c', "crc", HelpText = "Appends ISO CRC to new IRD filename")] public bool CRC { get; set; } @@ -414,7 +417,7 @@ namespace IRDKit { try { - RenameIRD(file, datfile, serial: opt.Serial, crc: opt.CRC, verbose: opt.Verbose); + RenameIRD(file, datfile, serial: opt.Serial, ver: opt.Ver, crc: opt.CRC, verbose: opt.Verbose); } catch (Exception e) { @@ -435,7 +438,7 @@ namespace IRDKit // Rename provided IRD path try { - RenameIRD(irdPath, datfile, serial: opt.Serial, crc: opt.CRC, verbose: opt.Verbose); + RenameIRD(irdPath, datfile, serial: opt.Serial, ver: opt.Ver, crc: opt.CRC, verbose: opt.Verbose); } catch (Exception e) { @@ -1034,7 +1037,7 @@ namespace IRDKit return node.Attribute("name").Value; } - public static void RenameIRD(string irdPath, XDocument datfile, bool serial = false, bool crc = false, bool verbose = false) + public static void RenameIRD(string irdPath, XDocument datfile, bool serial = false, bool ver = false, bool crc = false, bool verbose = false) { IRD ird = IRD.Read(irdPath); @@ -1043,7 +1046,9 @@ namespace IRDKit string filename = GetDatFilename(ird, datfile) ?? throw new ArgumentException($"Cannot determine DAT filename for {irdPath}"); if (serial) - filename += $" [{ird.TitleID.Substring(0, 4)}-{ird.TitleID.Substring(5, 5)}]"; + filename += $" [{ird.TitleID.Substring(0, 4).Replace('\0', ' ')}-{ird.TitleID.Substring(4, 5).Replace('\0', ' ')}]"; + if (ver) + filename += $" [{ird.DiscVersion.Replace('\0', ' ')}]"; if (crc) filename += $" [{ird.UID:X8}]"; diff --git a/IRDKit/README.md b/IRDKit/README.md index d20b73b..e536c4c 100644 --- a/IRDKit/README.md +++ b/IRDKit/README.md @@ -39,3 +39,9 @@ For all options, run `irdkit help diff` To compare two IRDs, run `irdkit diff game1.ird game2.ird` The comparison can be printed to a file, e.g. `-o out.txt` or `--output=` + +## Renaming IRDs + +For all options, run `irdkit help rename` + +To rename an IRD (or folder of IRDs) according to a redump DAT, run `irdkit rename -d redump.dat game.ird` diff --git a/README.md b/README.md index d923333..3f8f7d8 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ IRDKit is a tool that allows direct use of LibIRD functionality from a command l - Printing info about all ISOs and IRDs in a folder: `irdkit info .` - Creating an IRD from an ISO: `irdkit create game.iso` - Finding differences between two IRDs: `irdkit diff game1.ird game2.ird` -- Renaming a folder of IRDs using a redump DAT: `irdkit rename -d redump.dat IRDs\` +- Renaming an IRD or folder of IRDs using a redump DAT: `irdkit rename -d redump.dat game.ird` For detailed usage, read more [here](IRDKit).