diff --git a/DATabase/Partials/DATabase_Inits.cs b/DATabase/Partials/DATabase_Inits.cs index f2bfd71a..670404a0 100644 --- a/DATabase/Partials/DATabase_Inits.cs +++ b/DATabase/Partials/DATabase_Inits.cs @@ -617,138 +617,5 @@ namespace SabreTools } #endregion - - #region OBSOLETE - - /// - /// Wrap converting DAT file from any format to any format - /// - /// - /// - /// Optional param for output directory - /// True to clean the game names to WoD standard, false otherwise (default) - 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; - } - - /// - /// Wrap converting a DAT to missfile - /// - /// File to be converted - /// True if games are to be used in output, false if roms are - /// Generic prefix to be added to each line - /// Generic postfix to be added to each line - /// Add quotes to each item - /// Replace all extensions with another - /// Add an extension to all items - /// Add the dat name as a directory prefix - /// Output files in romba format - /// Output files in TSV format - 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 } } diff --git a/DATabase/Partials/DATabase_Menus.cs b/DATabase/Partials/DATabase_Menus.cs index ec852793..cff3cc13 100644 --- a/DATabase/Partials/DATabase_Menus.cs +++ b/DATabase/Partials/DATabase_Menus.cs @@ -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 = "";