From 5ad9a83b63a21052cf410fac6e1d5e5476516dc3 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Mon, 9 May 2016 09:35:07 -0700 Subject: [PATCH] Fix issues with game naming and renaming --- DATabaseTwo/DATabaseTwo.cs | 4 ++-- SabreHelper/Output.cs | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/DATabaseTwo/DATabaseTwo.cs b/DATabaseTwo/DATabaseTwo.cs index a173eca3..095e378f 100644 --- a/DATabaseTwo/DATabaseTwo.cs +++ b/DATabaseTwo/DATabaseTwo.cs @@ -455,7 +455,7 @@ Make a selection: rom.Game = Style.NormalizeChars(rom.Game); rom.Game = Style.RussianToLatin(rom.Game); rom.Game = Style.SearchPattern(rom.Game); - rom.Game = rom.Game.Replace("\n", "").Replace("\r", ""); + rom.Game = rom.Game.TrimEnd().TrimStart(); if (!norename) { @@ -467,7 +467,7 @@ Make a selection: } // Then write out the file - Output.WriteToDatFromDict(name, description, "", date, "SabreTools", "SabreTools", false, old, true, _outroot, roms, _logger); + Output.WriteToDatFromDict(name, description, "", date, "SabreTools", "SabreTools", false, old, true, _outroot, roms, _logger, norename); } /// diff --git a/SabreHelper/Output.cs b/SabreHelper/Output.cs index a9dd8d65..3886eb1e 100644 --- a/SabreHelper/Output.cs +++ b/SabreHelper/Output.cs @@ -153,9 +153,10 @@ namespace SabreTools.Helper /// Set the output directory /// Dictionary containing all the roms to be written /// Logger object for console and/or file output + /// True if games should only be compared on game and file name (default), false if system and source are counted /// True if the DAT was written correctly, false otherwise public static bool WriteToDatFromDict(string name, string description, string version, string date, string category, string author, - bool forceunpack, bool old, bool merge, string outDir, Dictionary> dict, Logger logger) + bool forceunpack, bool old, bool merge, string outDir, Dictionary> dict, Logger logger, bool norename = true) { // Get all values in the dictionary and write out SortedDictionary> sortable = new SortedDictionary>(); @@ -171,7 +172,7 @@ namespace SabreTools.Helper foreach (RomData rom in newroms) { count++; - string key = rom.SystemID + "-" + rom.SourceID + "-" + rom.Game + "-" + rom.Name; + string key = (norename ? "" : rom.SystemID + "-" + rom.SourceID + "-" ) + rom.Game + "-" + rom.Name; if (sortable.ContainsKey(key)) { sortable[key].Add(rom);