Fix rename functionality, mention in reademe

This commit is contained in:
Deterous
2024-03-25 13:27:56 +09:00
parent c1c25b5f5e
commit 0ef06c36e9
4 changed files with 17 additions and 6 deletions
+1 -1
View File
@@ -11,7 +11,7 @@
<LangVersion>latest</LangVersion>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Version>0.9.0</Version>
<Version>0.9.1</Version>
<!-- Package Properties -->
<Authors>Deterous</Authors>
+9 -4
View File
@@ -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}]";
+6
View File
@@ -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`
+1 -1
View File
@@ -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).