[SabreTools, README, DatFiles] Add prefix/postfix everywhere

This commit is contained in:
Matt Nadareski
2018-02-24 13:14:58 -08:00
parent 8b9ac5dca5
commit b92cfd8455
14 changed files with 68 additions and 11 deletions

View File

@@ -896,6 +896,11 @@ namespace SabreTools.Library.DatFiles
try try
{ {
string state = ""; string state = "";
// Pre-process the item name
rom.Name = CreatePrefixPostfix(rom, true) + rom.Name + CreatePrefixPostfix(rom, false);
rom.Name = rom.Name.Replace("\"", ""); // Quotes are not needed here
switch (rom.Type) switch (rom.Type)
{ {
case ItemType.Archive: case ItemType.Archive:

View File

@@ -5962,6 +5962,8 @@ namespace SabreTools.Library.DatFiles
.Replace("%sha512%", sha512) .Replace("%sha512%", sha512)
.Replace("%size%", size); .Replace("%size%", size);
// TODO: Add GameName logic here too?
return fix; return fix;
} }

View File

@@ -269,6 +269,11 @@ namespace SabreTools.Library.DatFiles
try try
{ {
string state = ""; string state = "";
// Pre-process the item name
rom.Name = CreatePrefixPostfix(rom, true) + rom.Name + CreatePrefixPostfix(rom, false);
rom.Name = rom.Name.Replace("\"", ""); // Quotes are not needed here
switch (rom.Type) switch (rom.Type)
{ {
case ItemType.Archive: case ItemType.Archive:

View File

@@ -199,6 +199,11 @@ namespace SabreTools.Library.DatFiles
try try
{ {
string state = ""; string state = "";
// Pre-process the item name
rom.Name = CreatePrefixPostfix(rom, true) + rom.Name + CreatePrefixPostfix(rom, false);
rom.Name = rom.Name.Replace("\"", ""); // Quotes are not needed here
switch (_hash) switch (_hash)
{ {
case Hash.MD5: case Hash.MD5:

View File

@@ -408,6 +408,11 @@ namespace SabreTools.Library.DatFiles
try try
{ {
string state = ""; string state = "";
// Pre-process the item name
rom.Name = CreatePrefixPostfix(rom, true) + rom.Name + CreatePrefixPostfix(rom, false);
rom.Name = rom.Name.Replace("\"", ""); // Quotes are not needed here
switch (rom.Type) switch (rom.Type)
{ {
case ItemType.Archive: case ItemType.Archive:

View File

@@ -781,6 +781,11 @@ namespace SabreTools.Library.DatFiles
try try
{ {
string state = ""; string state = "";
// Pre-process the item name
rom.Name = CreatePrefixPostfix(rom, true) + rom.Name + CreatePrefixPostfix(rom, false);
rom.Name = rom.Name.Replace("\"", ""); // Quotes are not needed here
switch (rom.Type) switch (rom.Type)
{ {
case ItemType.Archive: case ItemType.Archive:

View File

@@ -890,6 +890,11 @@ namespace SabreTools.Library.DatFiles
try try
{ {
string state = ""; string state = "";
// Pre-process the item name
rom.Name = CreatePrefixPostfix(rom, true) + rom.Name + CreatePrefixPostfix(rom, false);
rom.Name = rom.Name.Replace("\"", ""); // Quotes are not needed here
switch (rom.Type) switch (rom.Type)
{ {
case ItemType.Archive: case ItemType.Archive:

View File

@@ -155,6 +155,7 @@ namespace SabreTools.Library.DatFiles
try try
{ {
string state = "", name = "", pre = "", post = ""; string state = "", name = "", pre = "", post = "";
pre = CreatePrefixPostfix(rom, true); pre = CreatePrefixPostfix(rom, true);
post = CreatePrefixPostfix(rom, false); post = CreatePrefixPostfix(rom, false);

View File

@@ -954,6 +954,11 @@ namespace SabreTools.Library.DatFiles
try try
{ {
string state = ""; string state = "";
// Pre-process the item name
rom.Name = CreatePrefixPostfix(rom, true) + rom.Name + CreatePrefixPostfix(rom, false);
rom.Name = rom.Name.Replace("\"", ""); // Quotes are not needed here
state += "\t\t<game>\n" state += "\t\t<game>\n"
+ "\t\t\t<imageNumber>1</imageNumber>\n" + "\t\t\t<imageNumber>1</imageNumber>\n"
+ "\t\t\t<releaseNumber>1</releaseNumber>\n" + "\t\t\t<releaseNumber>1</releaseNumber>\n"

View File

@@ -339,6 +339,11 @@ namespace SabreTools.Library.DatFiles
try try
{ {
string state = ""; string state = "";
// Pre-process the item name
rom.Name = CreatePrefixPostfix(rom, true) + rom.Name + CreatePrefixPostfix(rom, false);
rom.Name = rom.Name.Replace("\"", ""); // Quotes are not needed here
if (rom.Type == ItemType.Rom) if (rom.Type == ItemType.Rom)
{ {
state += "¬" + (String.IsNullOrWhiteSpace(rom.CloneOf) ? "" : HttpUtility.HtmlEncode(rom.CloneOf)) + state += "¬" + (String.IsNullOrWhiteSpace(rom.CloneOf) ? "" : HttpUtility.HtmlEncode(rom.CloneOf)) +

View File

@@ -829,6 +829,11 @@ namespace SabreTools.Library.DatFiles
try try
{ {
string state = "", prefix = ""; string state = "", prefix = "";
// Pre-process the item name
rom.Name = CreatePrefixPostfix(rom, true) + rom.Name + CreatePrefixPostfix(rom, false);
rom.Name = rom.Name.Replace("\"", ""); // Quotes are not needed here
for (int i = 0; i < depth; i++) for (int i = 0; i < depth; i++)
{ {
prefix += "\t"; prefix += "\t";

View File

@@ -785,6 +785,11 @@ namespace SabreTools.Library.DatFiles
try try
{ {
string state = ""; string state = "";
// Pre-process the item name
rom.Name = CreatePrefixPostfix(rom, true) + rom.Name + CreatePrefixPostfix(rom, false);
rom.Name = rom.Name.Replace("\"", ""); // Quotes are not needed here
state += "\t\t<part name=\"" + rom.PartName + "\" interface=\"" + rom.PartInterface + "\">\n"; state += "\t\t<part name=\"" + rom.PartName + "\" interface=\"" + rom.PartInterface + "\">\n";
foreach (Tuple<string, string> kvp in rom.Features) foreach (Tuple<string, string> kvp in rom.Features)

View File

@@ -707,15 +707,15 @@ Options:
-pre, --prefix Set prefix for all lines -pre, --prefix Set prefix for all lines
Set a generic prefix to be prepended to all outputted lines. Set a generic prefix to be prepended to all outputted lines.
[*SV, Missfile only]
-post, --postfix Set postfix for all lines -post, --postfix Set postfix for all lines
Set a generic postfix to be appended to all outputted lines. Set a generic postfix to be appended to all outputted lines.
[*SV, Missfile only]
Some special strings that can be used for both prefix and postfix: Some special strings that can be used for both prefix and postfix:
- %game% - Replaced with the Game/Machine name - %game% / %machine% - Replaced with the Game/Machine name
- %name% - Replaced with the Rom name - %name% - Replaced with the Rom name
- %%manufacturer%% - Replaced with game Manufacturer
- %publisher% - Replaced with game Publisher
- %crc% - Replaced with the CRC - %crc% - Replaced with the CRC
- %md5% - Replaced with the MD5 - %md5% - Replaced with the MD5
- %sha1% - Replaced with the SHA-1 - %sha1% - Replaced with the SHA-1
@@ -726,7 +726,7 @@ Options:
-q, --quotes Double-quote each item -q, --quotes Double-quote each item
This flag surrounds the item by double-quotes, not including the This flag surrounds the item by double-quotes, not including the
prefix or postfix. [*SV, Missfile only] prefix or postfix.
-r, --roms Output roms to miss instead of sets -r, --roms Output roms to miss instead of sets
By default, the outputted file will include the name of the game By default, the outputted file will include the name of the game
@@ -735,7 +735,7 @@ Options:
-gp, --game-prefix Add game name as a prefix -gp, --game-prefix Add game name as a prefix
This flag allows for the name of the game to be used as a prefix This flag allows for the name of the game to be used as a prefix
to each file. [Missfile, MD5, SFV, SHA* only] to each file.
-ae, --add-extension Add an extension to each item -ae, --add-extension Add an extension to each item
Add a postfix extension to each full item name. [Missfile only] Add a postfix extension to each full item name. [Missfile only]

View File

@@ -390,7 +390,7 @@ namespace SabreTools
new List<string>() { "-gp", "--game-prefix" }, new List<string>() { "-gp", "--game-prefix" },
"Add game name as a prefix", "Add game name as a prefix",
FeatureType.Flag, FeatureType.Flag,
longDescription: "This flag allows for the name of the game to be used as a prefix to each file. [Missfile, MD5, SFV, SHA* only]"); longDescription: "This flag allows for the name of the game to be used as a prefix to each file.");
} }
} }
private static Feature hashFlag private static Feature hashFlag
@@ -846,7 +846,7 @@ namespace SabreTools
new List<string>() { "-q", "--quotes" }, new List<string>() { "-q", "--quotes" },
"Double-quote each item", "Double-quote each item",
FeatureType.Flag, FeatureType.Flag,
longDescription: "This flag surrounds the item by double-quotes, not including the prefix or postfix. [*SV, Missfile only]"); longDescription: "This flag surrounds the item by double-quotes, not including the prefix or postfix.");
} }
} }
private static Feature removeExtensionsFlag private static Feature removeExtensionsFlag
@@ -2097,11 +2097,13 @@ Possible values are: None, Zip, Unzip");
new List<string>() { "-post", "--postfix" }, new List<string>() { "-post", "--postfix" },
"Set postfix for all lines", "Set postfix for all lines",
FeatureType.String, FeatureType.String,
longDescription: @"Set a generic postfix to be appended to all outputted lines. [*SV, Missfile only] longDescription: @"Set a generic postfix to be appended to all outputted lines.
Some special strings that can be used: Some special strings that can be used:
- %game% - Replaced with the Game/Machine name - %game% / %machine% - Replaced with the Game/Machine name
- %name% - Replaced with the Rom name - %name% - Replaced with the Rom name
- %%manufacturer%% - Replaced with game Manufacturer
- %publisher% - Replaced with game Publisher
- %crc% - Replaced with the CRC - %crc% - Replaced with the CRC
- %md5% - Replaced with the MD5 - %md5% - Replaced with the MD5
- %sha1% - Replaced with the SHA-1 - %sha1% - Replaced with the SHA-1
@@ -2120,11 +2122,13 @@ Some special strings that can be used:
new List<string>() { "-pre", "--prefix" }, new List<string>() { "-pre", "--prefix" },
"Set prefix for all lines", "Set prefix for all lines",
FeatureType.String, FeatureType.String,
longDescription: @"Set a generic prefix to be prepended to all outputted lines. [*SV, Missfile only] longDescription: @"Set a generic prefix to be prepended to all outputted lines.
Some special strings that can be used: Some special strings that can be used:
- %game% - Replaced with the Game/Machine name - %game% / %machine% - Replaced with the Game/Machine name
- %name% - Replaced with the Rom name - %name% - Replaced with the Rom name
- %%manufacturer%% - Replaced with game Manufacturer
- %publisher% - Replaced with game Publisher
- %crc% - Replaced with the CRC - %crc% - Replaced with the CRC
- %md5% - Replaced with the MD5 - %md5% - Replaced with the MD5
- %sha1% - Replaced with the SHA-1 - %sha1% - Replaced with the SHA-1