mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Quotes are for my friends
This commit is contained in:
@@ -34,7 +34,7 @@ namespace SabreTools
|
|||||||
Build.Start("DatToMiss");
|
Build.Start("DatToMiss");
|
||||||
|
|
||||||
string prefix = "", postfix = "", input = "";
|
string prefix = "", postfix = "", input = "";
|
||||||
bool tofile = false, help = false, usegame = true;
|
bool tofile = false, help = false, usegame = true, quotes = false;
|
||||||
foreach (string arg in args)
|
foreach (string arg in args)
|
||||||
{
|
{
|
||||||
switch (arg)
|
switch (arg)
|
||||||
@@ -52,6 +52,10 @@ namespace SabreTools
|
|||||||
case "--roms":
|
case "--roms":
|
||||||
usegame = false;
|
usegame = false;
|
||||||
break;
|
break;
|
||||||
|
case "-q":
|
||||||
|
case "--quotes":
|
||||||
|
quotes = true;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if ((arg.StartsWith("-pre=") || arg.StartsWith("--prefix=")) && prefix == "")
|
if ((arg.StartsWith("-pre=") || arg.StartsWith("--prefix=")) && prefix == "")
|
||||||
{
|
{
|
||||||
@@ -89,7 +93,7 @@ namespace SabreTools
|
|||||||
name += Path.GetFileNameWithoutExtension(input) + "-miss.txt";
|
name += Path.GetFileNameWithoutExtension(input) + "-miss.txt";
|
||||||
|
|
||||||
// Read in the roms from the DAT and then write them to the file
|
// Read in the roms from the DAT and then write them to the file
|
||||||
Output.WriteToText(name, Path.GetDirectoryName(input), RomManipulation.Parse(input, 0, 0, logger), logger, usegame, prefix, postfix);
|
Output.WriteToText(name, Path.GetDirectoryName(input), RomManipulation.Parse(input, 0, 0, logger), logger, usegame, prefix, postfix, quotes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,8 +136,9 @@ namespace SabreTools.Helper
|
|||||||
/// <param name="useGame">True if only games are written to text file (default), false for files only</param>
|
/// <param name="useGame">True if only games are written to text file (default), false for files only</param>
|
||||||
/// <param name="prefix">Arbitrary string to prefix each line</param>
|
/// <param name="prefix">Arbitrary string to prefix each line</param>
|
||||||
/// <param name="postfix">Arbitrary string to postfix each line</param>
|
/// <param name="postfix">Arbitrary string to postfix each line</param>
|
||||||
|
/// <param name="quotes">True if quotes should be put around the item, false otherwise (default)</param>
|
||||||
/// <returns>True if the file was written, false otherwise</returns>
|
/// <returns>True if the file was written, false otherwise</returns>
|
||||||
public static bool WriteToText(string textfile, string outdir, List<RomData> roms, Logger logger, bool useGame = true, string prefix = "", string postfix = "")
|
public static bool WriteToText(string textfile, string outdir, List<RomData> roms, Logger logger, bool useGame = true, string prefix = "", string postfix = "", bool quotes = false)
|
||||||
{
|
{
|
||||||
// Normalize the output directory
|
// Normalize the output directory
|
||||||
if (outdir == "")
|
if (outdir == "")
|
||||||
@@ -167,12 +168,12 @@ namespace SabreTools.Helper
|
|||||||
{
|
{
|
||||||
if (useGame && rom.Game != lastgame)
|
if (useGame && rom.Game != lastgame)
|
||||||
{
|
{
|
||||||
sw.WriteLine(prefix + rom.Game + postfix);
|
sw.WriteLine(prefix + (quotes ? "\"" : "") + rom.Game + (quotes ? "\"" : "") + postfix);
|
||||||
lastgame = rom.Game;
|
lastgame = rom.Game;
|
||||||
}
|
}
|
||||||
else if (!useGame)
|
else if (!useGame)
|
||||||
{
|
{
|
||||||
sw.WriteLine(prefix + rom.Name + postfix);
|
sw.WriteLine(prefix + (quotes ? "\"" : "") + rom.Name + (quotes ? "\"" : "")+ postfix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user