[DATabase] Remove obsolete methods

This commit is contained in:
Matt Nadareski
2016-06-11 20:28:34 -07:00
parent 0fc2538508
commit 6ea7108f17
2 changed files with 7 additions and 135 deletions

View File

@@ -617,138 +617,5 @@ namespace SabreTools
}
#endregion
#region OBSOLETE
/// <summary>
/// Wrap converting DAT file from any format to any format
/// </summary>
/// <param name="filename"></param>
/// <param name="outputFormat"></param>
/// <param name="outdir">Optional param for output directory</param>
/// <param name="clean">True to clean the game names to WoD standard, false otherwise (default)</param>
private static void InitConvert(string filename, OutputFormat outputFormat, string outdir, bool clean)
{
// Clean the input strings
outdir = outdir.Replace("\"", "");
if (outdir != "")
{
outdir = Path.GetFullPath(outdir) + Path.DirectorySeparatorChar;
}
filename = filename.Replace("\"", "");
if (File.Exists(filename))
{
_logger.User("Converting \"" + Path.GetFileName(filename) + "\"");
DatData datdata = new DatData
{
OutputFormat = outputFormat,
MergeRoms = false,
};
datdata = DatTools.Parse(filename, 0, 0, datdata, _logger, true, clean);
// If the extension matches, append ".new" to the filename
string extension = (datdata.OutputFormat == OutputFormat.Xml || datdata.OutputFormat == OutputFormat.SabreDat ? ".xml" : ".dat");
if (outdir == "" && Path.GetExtension(filename) == extension)
{
datdata.FileName += ".new";
}
Output.WriteDatfile(datdata, (outdir == "" ? Path.GetDirectoryName(filename) : outdir), _logger);
}
else if (Directory.Exists(filename))
{
filename = Path.GetFullPath(filename) + Path.DirectorySeparatorChar;
foreach (string file in Directory.EnumerateFiles(filename, "*", SearchOption.AllDirectories))
{
_logger.User("Converting \"" + Path.GetFullPath(file).Remove(0, filename.Length) + "\"");
DatData datdata = new DatData
{
OutputFormat = outputFormat,
MergeRoms = false,
};
datdata = DatTools.Parse(file, 0, 0, datdata, _logger, true, clean);
// If the extension matches, append ".new" to the filename
string extension = (datdata.OutputFormat == OutputFormat.Xml || datdata.OutputFormat == OutputFormat.SabreDat ? ".xml" : ".dat");
if (outdir == "" && Path.GetExtension(file) == extension)
{
datdata.FileName += ".new";
}
Output.WriteDatfile(datdata, (outdir == "" ? Path.GetDirectoryName(file) : outdir + Path.GetDirectoryName(file).Remove(0, filename.Length - 1)), _logger);
}
}
else
{
_logger.Error("I'm sorry but " + filename + " doesn't exist!");
}
return;
}
/// <summary>
/// Wrap converting a DAT to missfile
/// </summary>
/// <param name="input">File to be converted</param>
/// <param name="usegame">True if games are to be used in output, false if roms are</param>
/// <param name="prefix">Generic prefix to be added to each line</param>
/// <param name="postfix">Generic postfix to be added to each line</param>
/// <param name="quotes">Add quotes to each item</param>
/// <param name="repext">Replace all extensions with another</param>
/// <param name="addext">Add an extension to all items</param>
/// <param name="gamename">Add the dat name as a directory prefix</param>
/// <param name="romba">Output files in romba format</param>
/// <param name="tsv">Output files in TSV format</param>
private static void InitConvertMiss(string input, bool usegame, string prefix, string postfix, bool quotes,
string repext, string addext, bool gamename, bool romba, bool tsv)
{
// Strip any quotations from the name
input = input.Replace("\"", "");
if (input != "" && File.Exists(input))
{
// Get the full input name
input = Path.GetFullPath(input);
// Get the output name
string name = Path.GetFileNameWithoutExtension(input) + "-miss";
// Read in the roms from the DAT and then write them to the file
_logger.User("Converting " + input);
DatData datdata = new DatData
{
OutputFormat = OutputFormat.MissFile,
UseGame = usegame,
Prefix = prefix,
Postfix = postfix,
AddExt = addext,
RepExt = repext,
Quotes = quotes,
GameName = gamename,
Romba = romba,
TSV = tsv,
};
datdata = DatTools.Parse(input, 0, 0, datdata, _logger);
datdata.FileName += "-miss";
datdata.Name += "-miss";
datdata.Description += "-miss";
// Normalize the extensions
addext = (addext == "" || addext.StartsWith(".") ? addext : "." + addext);
repext = (repext == "" || repext.StartsWith(".") ? repext : "." + repext);
Output.WriteDatfile(datdata, Path.GetDirectoryName(input), _logger);
_logger.User(input + " converted to: " + name);
return;
}
else
{
_logger.Error("I'm sorry but " + input + "doesn't exist!");
}
}
#endregion
}
}

View File

@@ -307,7 +307,10 @@ Make a selection:
break;
case "4":
Console.Clear();
InitConvert(input, outputFormat, outdir, false);
InitUpdate(input, "", "", "", "", "", "", "", "", "", "", "", "", false, "", "", "",
(outputFormat == OutputFormat.ClrMamePro), (outputFormat == OutputFormat.MissFile), (outputFormat == OutputFormat.RomCenter),
(outputFormat == OutputFormat.SabreDat), (outputFormat == OutputFormat.Xml), false, "", "", false, "", "", false, false, false,
"", "", "", -1, -1, -1, "", "", "", null, outdir, false, false);
Console.Write("\nPress any key to continue...");
Console.ReadKey();
input = ""; outdir = "";
@@ -395,7 +398,9 @@ Make a selection:
break;
case "12":
Console.Clear();
InitConvertMiss(input, usegame, prefix, postfix, quotes, repext, addext, gamename, romba, tsv);
InitUpdate(input, "", "", "", "", "", "", "", "", "", "", "", "", false, "", "", "",
false, true, false, false, false, usegame, prefix, postfix, quotes, repext, addext,
gamename, romba, tsv, "", "", "", -1, -1, -1, "", "", "", null, "", false, false);
Console.Write("\nPress any key to continue...");
Console.ReadKey();
input = ""; prefix = ""; postfix = ""; addext = ""; repext = "";