diff --git a/SabreTools.Library/Dats/DatItem.cs b/SabreTools.Library/Dats/DatItem.cs index 75c05f90..4d863b85 100644 --- a/SabreTools.Library/Dats/DatItem.cs +++ b/SabreTools.Library/Dats/DatItem.cs @@ -25,7 +25,7 @@ namespace SabreTools.Library.Dats protected DupeType _dupeType; // Machine information - protected Machine _machine; + protected Machine _machine = new Machine(); // Software list information protected bool? _supported; @@ -70,10 +70,299 @@ namespace SabreTools.Library.Dats } // Machine information - public Machine Machine + public string MachineName { - get { return _machine; } - set { _machine = value; } + get + { + if (_machine == null) + { + _machine = new Machine(); + } + + return _machine.Name; + } + set + { + if (_machine == null) + { + _machine = new Machine(); + } + + _machine.Name = value; + } + } + public string Comment + { + get + { + if (_machine == null) + { + _machine = new Machine(); + } + + return _machine.Comment; + } + set + { + if (_machine == null) + { + _machine = new Machine(); + } + + _machine.Comment = value; + } + } + public string Description + { + get + { + if (_machine == null) + { + _machine = new Machine(); + } + + return _machine.Description; + } + set + { + if (_machine == null) + { + _machine = new Machine(); + } + + _machine.Description = value; + } + } + public string Year + { + get + { + if (_machine == null) + { + _machine = new Machine(); + } + + return _machine.Year; + } + set + { + if (_machine == null) + { + _machine = new Machine(); + } + + _machine.Year = value; + } + } + public string Manufacturer + { + get + { + if (_machine == null) + { + _machine = new Machine(); + } + + return _machine.Manufacturer; + } + set + { + if (_machine == null) + { + _machine = new Machine(); + } + + _machine.Manufacturer = value; + } + } + public string RomOf + { + get + { + if (_machine == null) + { + _machine = new Machine(); + } + + return _machine.RomOf; + } + set + { + if (_machine == null) + { + _machine = new Machine(); + } + + _machine.RomOf = value; + } + } + public string CloneOf + { + get + { + if (_machine == null) + { + _machine = new Machine(); + } + + return _machine.CloneOf; + } + set + { + if (_machine == null) + { + _machine = new Machine(); + } + + _machine.CloneOf = value; + } + } + public string SampleOf + { + get + { + if (_machine == null) + { + _machine = new Machine(); + } + + return _machine.SampleOf; + } + set + { + if (_machine == null) + { + _machine = new Machine(); + } + + _machine.SampleOf = value; + } + } + public string SourceFile + { + get + { + if (_machine == null) + { + _machine = new Machine(); + } + + return _machine.SourceFile; + } + set + { + if (_machine == null) + { + _machine = new Machine(); + } + + _machine.SourceFile = value; + } + } + public bool? Runnable + { + get + { + if (_machine == null) + { + _machine = new Machine(); + } + + return _machine.Runnable; + } + set + { + if (_machine == null) + { + _machine = new Machine(); + } + + _machine.Runnable = value; + } + } + public string Board + { + get + { + if (_machine == null) + { + _machine = new Machine(); + } + + return _machine.Board; + } + set + { + if (_machine == null) + { + _machine = new Machine(); + } + + _machine.Board = value; + } + } + public string RebuildTo + { + get + { + if (_machine == null) + { + _machine = new Machine(); + } + + return _machine.RebuildTo; + } + set + { + if (_machine == null) + { + _machine = new Machine(); + } + + _machine.RebuildTo = value; + } + } + public List Devices + { + get + { + if (_machine == null) + { + _machine = new Machine(); + } + + return _machine.Devices; + } + set + { + if (_machine == null) + { + _machine = new Machine(); + } + + _machine.Devices = value; + } + } + public MachineType MachineType + { + get + { + if (_machine == null) + { + _machine = new Machine(); + } + + return _machine.MachineType; + } + set + { + if (_machine == null) + { + _machine = new Machine(); + } + + _machine.MachineType = value; + } } // Software list information @@ -167,6 +456,24 @@ namespace SabreTools.Library.Dats return null; } + /// + /// Copy all machine information over in one shot + /// + /// Existing item to copy information from + public void CopyMachineInformation(DatItem item) + { + _machine = (Machine)item._machine.Clone(); + } + + /// + /// Copy all machine information over in one shot + /// + /// Existing machine to copy information from + public void CopyMachineInformation(Machine machine) + { + _machine = (Machine)machine.Clone(); + } + #endregion #region Comparision Methods @@ -216,7 +523,7 @@ namespace SabreTools.Library.Dats // If the duplicate is external already or should be, set it if ((lastItem.Dupe & DupeType.External) != 0 || lastItem.SystemID != this.SystemID || lastItem.SourceID != this.SourceID) { - if (lastItem.Machine.Name == this.Machine.Name && lastItem.Name == this.Name) + if (lastItem.MachineName == this.MachineName && lastItem.Name == this.Name) { output = DupeType.External | DupeType.All; } @@ -229,7 +536,7 @@ namespace SabreTools.Library.Dats // Otherwise, it's considered an internal dupe else { - if (lastItem.Machine.Name == this.Machine.Name && lastItem.Name == this.Name) + if (lastItem.MachineName == this.MachineName && lastItem.Name == this.Name) { output = DupeType.Internal | DupeType.All; } @@ -475,7 +782,7 @@ namespace SabreTools.Library.Dats } break; case SortedBy.Game: - key = this.Machine.Name; + key = this.MachineName; break; case SortedBy.Size: if (_itemType == ItemType.Rom) @@ -609,7 +916,7 @@ namespace SabreTools.Library.Dats { saveditem.SystemID = file.SystemID; saveditem.System = file.System; - saveditem.Machine = (Machine)file.Machine.Clone(); + saveditem.CopyMachineInformation(file); saveditem.Name = file.Name; } @@ -618,7 +925,7 @@ namespace SabreTools.Library.Dats { saveditem.SourceID = file.SourceID; saveditem.Source = file.Source; - saveditem.Machine = (Machine)file.Machine.Clone(); + saveditem.CopyMachineInformation(file); saveditem.Name = file.Name; } @@ -764,7 +1071,7 @@ namespace SabreTools.Library.Dats { if (x.SourceID == y.SourceID) { - if (x.Machine != null && y.Machine != null && x.Machine.Name == y.Machine.Name) + if (x.MachineName == y.MachineName) { if ((x.Type == ItemType.Rom || x.Type == ItemType.Disk) && (y.Type == ItemType.Rom || y.Type == ItemType.Disk)) { @@ -791,11 +1098,11 @@ namespace SabreTools.Library.Dats return nc.Compare(Path.GetDirectoryName(x.Name), Path.GetDirectoryName(y.Name)); } } - return nc.Compare(x.Machine.Name, y.Machine.Name); + return nc.Compare(x.MachineName, y.MachineName); } - return (norename ? nc.Compare(x.Machine.Name, y.Machine.Name) : x.SourceID - y.SourceID); + return (norename ? nc.Compare(x.MachineName, y.MachineName) : x.SourceID - y.SourceID); } - return (norename ? nc.Compare(x.Machine.Name, y.Machine.Name) : x.SystemID - y.SystemID); + return (norename ? nc.Compare(x.MachineName, y.MachineName) : x.SystemID - y.SystemID); } catch (Exception) { diff --git a/SabreTools.Library/Dats/Filter.cs b/SabreTools.Library/Dats/Filter.cs index a8bf7785..444c13ee 100644 --- a/SabreTools.Library/Dats/Filter.cs +++ b/SabreTools.Library/Dats/Filter.cs @@ -266,24 +266,18 @@ namespace SabreTools.Library.Dats return false; } - // If the item's machine is null, we automatically fail it - if (item.Machine == null) - { - return false; - } - // Filter on machine type - if (_machineTypes != MachineType.NULL && (item.Machine.MachineType & _machineTypes) == 0) + if (_machineTypes != MachineType.NULL && (item.MachineType & _machineTypes) == 0) { return false; } - if (_machineNotTypes != MachineType.NULL && (item.Machine.MachineType & _machineNotTypes) != 0) + if (_machineNotTypes != MachineType.NULL && (item.MachineType & _machineNotTypes) != 0) { return false; } // Filter on machine runability - if (_runnable != null && item.Machine.Runnable != _runnable) + if (_runnable != null && item.Runnable != _runnable) { return false; } @@ -536,13 +530,13 @@ namespace SabreTools.Library.Dats // Filter on game name if (_gameNames.Count > 0) { - bool found = FindValueInList(_gameNames, item.Machine.Name); + bool found = FindValueInList(_gameNames, item.MachineName); // If we are checking CloneOf and RomOf, add them in as well if (_includeOfInGame) { - found |= FindValueInList(_gameNames, item.Machine.CloneOf); - found |= FindValueInList(_gameNames, item.Machine.RomOf); + found |= FindValueInList(_gameNames, item.CloneOf); + found |= FindValueInList(_gameNames, item.RomOf); } // If the game name was not found in the list, return false @@ -553,13 +547,13 @@ namespace SabreTools.Library.Dats } if (_notGameNames.Count > 0) { - bool found = FindValueInList(_gameNames, item.Machine.Name); + bool found = FindValueInList(_gameNames, item.MachineName); // If we are checking CloneOf and RomOf, add them in as well if (_includeOfInGame) { - found |= FindValueInList(_gameNames, item.Machine.CloneOf); - found |= FindValueInList(_gameNames, item.Machine.RomOf); + found |= FindValueInList(_gameNames, item.CloneOf); + found |= FindValueInList(_gameNames, item.RomOf); } // If the game name was found in the list, return false diff --git a/SabreTools.Library/Dats/Machine.cs b/SabreTools.Library/Dats/Machine.cs index 2207efe1..6fb22b65 100644 --- a/SabreTools.Library/Dats/Machine.cs +++ b/SabreTools.Library/Dats/Machine.cs @@ -151,44 +151,5 @@ namespace SabreTools.Library.Dats } #endregion - - #region Property updaters - - public void AppendName(string append) - { - Name += append; - } - - public void AppendDescription(string append) - { - Description += append; - } - - public void UpdateName(string update) - { - Name = update; - } - - public void UpdateDescription(string update) - { - Description = update; - } - - public void UpdateCloneOf(string update) - { - CloneOf = update; - } - - public void UpdateRomOf(string update) - { - RomOf = update; - } - - public void UpdateSampleOf(string update) - { - SampleOf = update; - } - - #endregion } } diff --git a/SabreTools.Library/Dats/Partials/DatFile.ConvertUpdate.cs b/SabreTools.Library/Dats/Partials/DatFile.ConvertUpdate.cs index a9144115..2f98055b 100644 --- a/SabreTools.Library/Dats/Partials/DatFile.ConvertUpdate.cs +++ b/SabreTools.Library/Dats/Partials/DatFile.ConvertUpdate.cs @@ -449,7 +449,7 @@ namespace SabreTools.Library.Dats if ((diff & DiffMode.NoDupes) != 0) { DatItem newrom = item.Clone() as DatItem; - newrom.Machine.AppendName(" (" + Path.GetFileNameWithoutExtension(inputs[newrom.SystemID].Split('¬')[0]) + ")"); + newrom.MachineName += " (" + Path.GetFileNameWithoutExtension(inputs[newrom.SystemID].Split('¬')[0]) + ")"; outerDiffData.Add(key, newrom); } @@ -462,7 +462,7 @@ namespace SabreTools.Library.Dats if ((item.Dupe & DupeType.External) != 0) { DatItem newrom = item.Clone() as DatItem; - newrom.Machine.AppendName(" (" + Path.GetFileNameWithoutExtension(inputs[newrom.SystemID].Split('¬')[0]) + ")"); + newrom.MachineName += " (" + Path.GetFileNameWithoutExtension(inputs[newrom.SystemID].Split('¬')[0]) + ")"; dupeData.Add(key, newrom); } @@ -531,9 +531,9 @@ namespace SabreTools.Library.Dats rootpath += (rootpath == "" ? "" : Path.DirectorySeparatorChar.ToString()); filename = filename.Remove(0, rootpath.Length); - newItem.Machine.UpdateName(Path.GetDirectoryName(filename) + Path.DirectorySeparatorChar + newItem.MachineName = Path.GetDirectoryName(filename) + Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension(filename) + Path.DirectorySeparatorChar - + newItem.Machine.Name); + + newItem.MachineName; newItems.Add(newItem); } diff --git a/SabreTools.Library/Dats/Partials/DatFile.Manipulate.cs b/SabreTools.Library/Dats/Partials/DatFile.Manipulate.cs index fc59f607..01fdac75 100644 --- a/SabreTools.Library/Dats/Partials/DatFile.Manipulate.cs +++ b/SabreTools.Library/Dats/Partials/DatFile.Manipulate.cs @@ -112,9 +112,9 @@ namespace SabreTools.Library.Dats : item.SystemID.ToString().PadLeft(10, '0') + "-" + item.SourceID.ToString().PadLeft(10, '0') + "-") - + (String.IsNullOrEmpty(item.Machine.Name) + + (String.IsNullOrEmpty(item.MachineName) ? "Default" - : item.Machine.Name); + : item.MachineName); if (lower) { key = key.ToLowerInvariant(); @@ -202,14 +202,14 @@ namespace SabreTools.Library.Dats // If we are in single game mode, rename all games if (single) { - item.Machine.UpdateName("!"); + item.MachineName = "!"; } // If we are in NTFS trim mode, trim the game name if (trim) { // Windows max name length is 260 - int usableLength = 260 - item.Machine.Name.Length - root.Length; + int usableLength = 260 - item.MachineName.Length - root.Length; if (item.Name.Length > usableLength) { string ext = Path.GetExtension(item.Name); @@ -252,9 +252,9 @@ namespace SabreTools.Library.Dats foreach (DatItem item in items) { // If the key mapping doesn't exist, add it - if (!mapping.ContainsKey(item.Machine.Name)) + if (!mapping.ContainsKey(item.MachineName)) { - mapping.TryAdd(item.Machine.Name, item.Machine.Description.Replace('/', '_').Replace("\"", "''")); + mapping.TryAdd(item.MachineName, item.Description.Replace('/', '_').Replace("\"", "''")); } } }); @@ -268,27 +268,27 @@ namespace SabreTools.Library.Dats foreach (DatItem item in items) { // Update machine name - if (!String.IsNullOrEmpty(item.Machine.Name) && mapping.ContainsKey(item.Machine.Name)) + if (!String.IsNullOrEmpty(item.MachineName) && mapping.ContainsKey(item.MachineName)) { - item.Machine.UpdateName(mapping[item.Machine.Name]); + item.MachineName = mapping[item.MachineName]; } // Update cloneof - if (!String.IsNullOrEmpty(item.Machine.CloneOf) && mapping.ContainsKey(item.Machine.CloneOf)) + if (!String.IsNullOrEmpty(item.CloneOf) && mapping.ContainsKey(item.CloneOf)) { - item.Machine.UpdateCloneOf(mapping[item.Machine.CloneOf]); + item.CloneOf = mapping[item.CloneOf]; } // Update romof - if (!String.IsNullOrEmpty(item.Machine.RomOf) && mapping.ContainsKey(item.Machine.RomOf)) + if (!String.IsNullOrEmpty(item.RomOf) && mapping.ContainsKey(item.RomOf)) { - item.Machine.UpdateRomOf(mapping[item.Machine.RomOf]); + item.RomOf = mapping[item.RomOf]; } // Update sampleof - if (!String.IsNullOrEmpty(item.Machine.SampleOf) && mapping.ContainsKey(item.Machine.SampleOf)) + if (!String.IsNullOrEmpty(item.SampleOf) && mapping.ContainsKey(item.SampleOf)) { - item.Machine.UpdateSampleOf(mapping[item.Machine.SampleOf]); + item.SampleOf = mapping[item.SampleOf]; } // Add the new item to the output list @@ -519,9 +519,9 @@ namespace SabreTools.Library.Dats // Determine if the game has a parent or not string parent = null; - if (!String.IsNullOrEmpty(this[game][0].Machine.RomOf)) + if (!String.IsNullOrEmpty(this[game][0].RomOf)) { - parent = this[game][0].Machine.RomOf; + parent = this[game][0].RomOf; } // If the parent doesnt exist, we want to continue @@ -537,7 +537,7 @@ namespace SabreTools.Library.Dats } // If the parent exists and has items, we copy the items from the parent to the current game - Machine currentMachine = this[game][0].Machine; + DatItem copyFrom = this[game][0]; List parentItems = this[parent]; foreach (DatItem item in parentItems) { @@ -546,7 +546,7 @@ namespace SabreTools.Library.Dats { case ItemType.Archive: Archive archive = ((Archive)item).Clone() as Archive; - archive.Machine = (Machine)currentMachine.Clone(); + archive.CopyMachineInformation(copyFrom); if (this[game].Where(i => i.Name == archive.Name).Count() == 0 && !this[game].Contains(archive)) { Add(game, archive); @@ -555,7 +555,7 @@ namespace SabreTools.Library.Dats break; case ItemType.BiosSet: BiosSet biosSet = ((BiosSet)item).Clone() as BiosSet; - biosSet.Machine = (Machine)currentMachine.Clone(); + biosSet.CopyMachineInformation(copyFrom); if (this[game].Where(i => i.Name == biosSet.Name).Count() == 0 && !this[game].Contains(biosSet)) { Add(game, biosSet); @@ -564,7 +564,7 @@ namespace SabreTools.Library.Dats break; case ItemType.Disk: Disk disk = ((Disk)item).Clone() as Disk; - disk.Machine = (Machine)currentMachine.Clone(); + disk.CopyMachineInformation(copyFrom); if (this[game].Where(i => i.Name == disk.Name).Count() == 0 && !this[game].Contains(disk)) { Add(game, disk); @@ -573,7 +573,7 @@ namespace SabreTools.Library.Dats break; case ItemType.Release: Release release = ((Release)item).Clone() as Release; - release.Machine = (Machine)currentMachine.Clone(); + release.CopyMachineInformation(copyFrom); if (this[game].Where(i => i.Name == release.Name).Count() == 0 && !this[game].Contains(release)) { Add(game, release); @@ -582,7 +582,7 @@ namespace SabreTools.Library.Dats break; case ItemType.Rom: Rom rom = ((Rom)item).Clone() as Rom; - rom.Machine = (Machine)currentMachine.Clone(); + rom.CopyMachineInformation(copyFrom); if (this[game].Where(i => i.Name == rom.Name).Count() == 0 && !this[game].Contains(rom)) { Add(game, rom); @@ -591,7 +591,7 @@ namespace SabreTools.Library.Dats break; case ItemType.Sample: Sample sample = ((Sample)item).Clone() as Sample; - sample.Machine = (Machine)currentMachine.Clone(); + sample.CopyMachineInformation(copyFrom); if (this[game].Where(i => i.Name == sample.Name).Count() == 0 && !this[game].Contains(sample)) { Add(game, sample); @@ -612,13 +612,13 @@ namespace SabreTools.Library.Dats foreach (string game in games) { // If the game has no devices, we continue - if (this[game][0].Machine.Devices == null || this[game][0].Machine.Devices.Count == 0) + if (this[game][0].Devices == null || this[game][0].Devices.Count == 0) { continue; } // Determine if the game has any devices or not - List devices = this[game][0].Machine.Devices; + List devices = this[game][0].Devices; foreach (string device in devices) { // If the device doesn't exist then we continue @@ -628,7 +628,7 @@ namespace SabreTools.Library.Dats } // Otherwise, copy the items from the device to the current game - Machine musheen = this[game][0].Machine; + DatItem copyFrom = this[game][0]; List devItems = this[device]; foreach (DatItem item in devItems) { @@ -637,7 +637,7 @@ namespace SabreTools.Library.Dats { case ItemType.Archive: Archive archive = ((Archive)item).Clone() as Archive; - archive.Machine = (Machine)musheen.Clone(); + archive.CopyMachineInformation(copyFrom); if (this[game].Where(i => i.Name == archive.Name).Count() == 0 && !this[game].Contains(archive)) { Add(game, archive); @@ -646,7 +646,7 @@ namespace SabreTools.Library.Dats break; case ItemType.BiosSet: BiosSet biosSet = ((BiosSet)item).Clone() as BiosSet; - biosSet.Machine = (Machine)musheen.Clone(); + biosSet.CopyMachineInformation(copyFrom); if (this[game].Where(i => i.Name == biosSet.Name).Count() == 0 && !this[game].Contains(biosSet)) { Add(game, biosSet); @@ -655,7 +655,7 @@ namespace SabreTools.Library.Dats break; case ItemType.Disk: Disk disk = ((Disk)item).Clone() as Disk; - disk.Machine = (Machine)musheen.Clone(); + disk.CopyMachineInformation(copyFrom); if (this[game].Where(i => i.Name == disk.Name).Count() == 0 && !this[game].Contains(disk)) { Add(game, disk); @@ -664,7 +664,7 @@ namespace SabreTools.Library.Dats break; case ItemType.Release: Release release = ((Release)item).Clone() as Release; - release.Machine = (Machine)musheen.Clone(); + release.CopyMachineInformation(copyFrom); if (this[game].Where(i => i.Name == release.Name).Count() == 0 && !this[game].Contains(release)) { Add(game, release); @@ -673,7 +673,7 @@ namespace SabreTools.Library.Dats break; case ItemType.Rom: Rom rom = ((Rom)item).Clone() as Rom; - rom.Machine = (Machine)musheen.Clone(); + rom.CopyMachineInformation(copyFrom); if (this[game].Where(i => i.Name == rom.Name).Count() == 0 && !this[game].Contains(rom)) { Add(game, rom); @@ -682,7 +682,7 @@ namespace SabreTools.Library.Dats break; case ItemType.Sample: Sample sample = ((Sample)item).Clone() as Sample; - sample.Machine = (Machine)musheen.Clone(); + sample.CopyMachineInformation(copyFrom); if (this[game].Where(i => i.Name == sample.Name).Count() == 0 && !this[game].Contains(sample)) { Add(game, sample); @@ -711,9 +711,9 @@ namespace SabreTools.Library.Dats // Determine if the game has a parent or not string parent = null; - if (!String.IsNullOrEmpty(this[game][0].Machine.CloneOf)) + if (!String.IsNullOrEmpty(this[game][0].CloneOf)) { - parent = this[game][0].Machine.CloneOf; + parent = this[game][0].CloneOf; } // If the parent doesnt exist, we want to continue @@ -729,7 +729,7 @@ namespace SabreTools.Library.Dats } // If the parent exists and has items, we copy the items from the parent to the current game - Machine currentMachine = this[game][0].Machine; + DatItem copyFrom = this[game][0]; List parentItems = this[parent]; foreach (DatItem item in parentItems) { @@ -738,7 +738,7 @@ namespace SabreTools.Library.Dats { case ItemType.Archive: Archive archive = ((Archive)item).Clone() as Archive; - archive.Machine = (Machine)currentMachine.Clone(); + archive.CopyMachineInformation(copyFrom); if (this[game].Where(i => i.Name == archive.Name).Count() == 0 && !this[game].Contains(archive)) { Add(game, archive); @@ -747,7 +747,7 @@ namespace SabreTools.Library.Dats break; case ItemType.BiosSet: BiosSet biosSet = ((BiosSet)item).Clone() as BiosSet; - biosSet.Machine = (Machine)currentMachine.Clone(); + biosSet.CopyMachineInformation(copyFrom); if (this[game].Where(i => i.Name == biosSet.Name).Count() == 0 && !this[game].Contains(biosSet)) { Add(game, biosSet); @@ -756,7 +756,7 @@ namespace SabreTools.Library.Dats break; case ItemType.Disk: Disk disk = ((Disk)item).Clone() as Disk; - disk.Machine = (Machine)currentMachine.Clone(); + disk.CopyMachineInformation(copyFrom); if (this[game].Where(i => i.Name == disk.Name).Count() == 0 && !this[game].Contains(disk)) { Add(game, disk); @@ -765,7 +765,7 @@ namespace SabreTools.Library.Dats break; case ItemType.Release: Release release = ((Release)item).Clone() as Release; - release.Machine = (Machine)currentMachine.Clone(); + release.CopyMachineInformation(copyFrom); if (this[game].Where(i => i.Name == release.Name).Count() == 0 && !this[game].Contains(release)) { Add(game, release); @@ -774,7 +774,7 @@ namespace SabreTools.Library.Dats break; case ItemType.Rom: Rom rom = ((Rom)item).Clone() as Rom; - rom.Machine = (Machine)currentMachine.Clone(); + rom.CopyMachineInformation(copyFrom); if (this[game].Where(i => i.Name == rom.Name).Count() == 0 && !this[game].Contains(rom)) { Add(game, rom); @@ -783,7 +783,7 @@ namespace SabreTools.Library.Dats break; case ItemType.Sample: Sample sample = ((Sample)item).Clone() as Sample; - sample.Machine = (Machine)currentMachine.Clone(); + sample.CopyMachineInformation(copyFrom); if (this[game].Where(i => i.Name == sample.Name).Count() == 0 && !this[game].Contains(sample)) { Add(game, sample); @@ -795,10 +795,10 @@ namespace SabreTools.Library.Dats // Now we want to get the parent romof tag and put it in each of the items List items = this[game]; - string romof = this[parent][0].Machine.RomOf; + string romof = this[parent][0].RomOf; foreach (DatItem item in items) { - item.Machine.UpdateRomOf(romof); + item.RomOf = romof; } } } @@ -813,9 +813,9 @@ namespace SabreTools.Library.Dats { // Determine if the game has a parent or not string parent = null; - if (!String.IsNullOrEmpty(this[game][0].Machine.CloneOf)) + if (!String.IsNullOrEmpty(this[game][0].CloneOf)) { - parent = this[game][0].Machine.CloneOf; + parent = this[game][0].CloneOf; } // If there is no parent, then we continue @@ -825,14 +825,14 @@ namespace SabreTools.Library.Dats } // Otherwise, move the items from the current game to a subfolder of the parent game - Machine parentMachine = this[parent].Count == 0 ? new Machine { Name = parent, Description = parent } : this[parent][0].Machine; + DatItem copyFrom = this[parent].Count == 0 ? new Rom { MachineName = parent, Description = parent } : this[parent][0]; List items = this[game]; foreach (DatItem item in items) { // If the disk doesn't have a valid merge tag OR the merged file doesn't exist in the parent, then add it if (item.Type == ItemType.Disk && (item.MergeTag == null || !this[parent].Select(i => i.Name).Contains(item.MergeTag))) { - item.Machine = (Machine)parentMachine.Clone(); + item.CopyMachineInformation(copyFrom); Add(parent, item); } @@ -840,10 +840,10 @@ namespace SabreTools.Library.Dats else if (item.Type != ItemType.Disk && !this[parent].Contains(item)) { // Rename the child so it's in a subfolder - item.Name = item.Machine.Name + "\\" + item.Name; + item.Name = item.Name + "\\" + item.Name; // Update the machine to be the new parent - item.Machine = (Machine)parentMachine.Clone(); + item.CopyMachineInformation(copyFrom); // Add the rom to the parent set Add(parent, item); @@ -864,8 +864,8 @@ namespace SabreTools.Library.Dats foreach (string game in games) { if (this[game].Count > 0 - && (this[game][0].Machine.MachineType == MachineType.Bios - || this[game][0].Machine.MachineType == MachineType.Device)) + && (this[game][0].MachineType == MachineType.Bios + || this[game][0].MachineType == MachineType.Device)) { Remove(game); } @@ -889,9 +889,9 @@ namespace SabreTools.Library.Dats // Determine if the game has a parent or not string parent = null; - if (!String.IsNullOrEmpty(this[game][0].Machine.RomOf)) + if (!String.IsNullOrEmpty(this[game][0].RomOf)) { - parent = this[game][0].Machine.RomOf; + parent = this[game][0].RomOf; } // If the parent doesnt exist, we want to continue @@ -907,7 +907,6 @@ namespace SabreTools.Library.Dats } // If the parent exists and has items, we remove the items that are in the parent from the current game - Machine currentMachine = this[game][0].Machine; List parentItems = this[parent]; foreach (DatItem item in parentItems) { @@ -959,9 +958,9 @@ namespace SabreTools.Library.Dats // Determine if the game has a parent or not string parent = null; - if (!String.IsNullOrEmpty(this[game][0].Machine.CloneOf)) + if (!String.IsNullOrEmpty(this[game][0].CloneOf)) { - parent = this[game][0].Machine.CloneOf; + parent = this[game][0].CloneOf; } // If the parent doesnt exist, we want to continue @@ -977,7 +976,6 @@ namespace SabreTools.Library.Dats } // If the parent exists and has items, we copy the items from the parent to the current game - Machine currentMachine = this[game][0].Machine; List parentItems = this[parent]; foreach (DatItem item in parentItems) { @@ -1013,10 +1011,10 @@ namespace SabreTools.Library.Dats // Now we want to get the parent romof tag and put it in each of the items List items = this[game]; - string romof = this[parent][0].Machine.RomOf; + string romof = this[parent][0].RomOf; foreach (DatItem item in items) { - item.Machine.UpdateRomOf(romof); + item.RomOf = romof; } } } @@ -1032,8 +1030,8 @@ namespace SabreTools.Library.Dats List items = this[game]; foreach (DatItem item in items) { - item.Machine.UpdateCloneOf(null); - item.Machine.UpdateRomOf(null); + item.CloneOf = null; + item.RomOf = null; } } } diff --git a/SabreTools.Library/Dats/Partials/DatFile.Parsers.cs b/SabreTools.Library/Dats/Partials/DatFile.Parsers.cs index 0ff04874..266eccf8 100644 --- a/SabreTools.Library/Dats/Partials/DatFile.Parsers.cs +++ b/SabreTools.Library/Dats/Partials/DatFile.Parsers.cs @@ -262,15 +262,12 @@ namespace SabreTools.Library.Dats SHA1 = Constants.SHA1Zero, ItemStatus = ItemStatus.None, - Machine = new Machine - { - Name = gameinfo[0], - Description = gameinfo[1], - CloneOf = gameinfo[3], - Year = gameinfo[4], - Manufacturer = gameinfo[5], - Comment = gameinfo[15], - } + MachineName = gameinfo[0], + Description = gameinfo[1], + CloneOf = gameinfo[3], + Year = gameinfo[4], + Manufacturer = gameinfo[5], + Comment = gameinfo[15], }; // Now process and add the rom @@ -381,16 +378,13 @@ namespace SabreTools.Library.Dats } // Then populate it with information - item.Machine = new Machine - { - Name = tempgamename, - Description = gamedesc, - CloneOf = cloneof, - RomOf = romof, - SampleOf = sampleof, - Manufacturer = manufacturer, - Year = year, - }; + item.MachineName = tempgamename; + item.Description = gamedesc; + item.CloneOf = cloneof; + item.RomOf = romof; + item.SampleOf = sampleof; + item.Manufacturer = manufacturer; + item.Year = year; item.SystemID = sysid; item.SourceID = srcid; @@ -930,10 +924,7 @@ namespace SabreTools.Library.Dats SHA512 = ((hashtype & Hash.SHA512) != 0 ? hash : null), ItemStatus = ItemStatus.None, - Machine = new Machine - { - Name = Path.GetFileNameWithoutExtension(filename), - }, + MachineName = Path.GetFileNameWithoutExtension(filename), SystemID = sysid, SourceID = srcid, @@ -1042,10 +1033,7 @@ namespace SabreTools.Library.Dats Name = romname, SHA1 = Style.CleanListromHashData(split[0]), - Machine = new Machine() - { - Name = gamename, - }, + MachineName = gamename, }; ParseAddHelper(disk, clean, remUnicode); @@ -1060,10 +1048,7 @@ namespace SabreTools.Library.Dats SHA1 = Style.CleanListromHashData(split[1]), ItemStatus = ItemStatus.BadDump, - Machine = new Machine() - { - Name = gamename, - }, + MachineName = gamename, }; ParseAddHelper(disk, clean, remUnicode); @@ -1084,10 +1069,7 @@ namespace SabreTools.Library.Dats CRC = Style.CleanListromHashData(split[1]), SHA1 = Style.CleanListromHashData(split[2]), - Machine = new Machine() - { - Name = gamename, - }, + MachineName = gamename, }; ParseAddHelper(rom, clean, remUnicode); @@ -1101,10 +1083,7 @@ namespace SabreTools.Library.Dats Name = romname, ItemStatus = ItemStatus.Nodump, - Machine = new Machine() - { - Name = gamename, - }, + MachineName = gamename, }; ParseAddHelper(disk, clean, remUnicode); @@ -1126,10 +1105,7 @@ namespace SabreTools.Library.Dats SHA1 = Style.CleanListromHashData(split[3]), ItemStatus = ItemStatus.BadDump, - Machine = new Machine() - { - Name = gamename, - }, + MachineName = gamename, }; ParseAddHelper(rom, clean, remUnicode); @@ -1149,10 +1125,7 @@ namespace SabreTools.Library.Dats Size = size, ItemStatus = ItemStatus.Nodump, - Machine = new Machine() - { - Name = gamename, - }, + MachineName = gamename, }; ParseAddHelper(rom, clean, remUnicode); @@ -1308,13 +1281,10 @@ namespace SabreTools.Library.Dats CRC = rominfo[6], ItemStatus = ItemStatus.None, - Machine = new Machine - { - Name = rominfo[3], - Description = rominfo[4], - CloneOf = rominfo[1], - RomOf = rominfo[8], - }, + MachineName = rominfo[3], + Description = rominfo[4], + CloneOf = rominfo[1], + RomOf = rominfo[8], SystemID = sysid, SourceID = srcid, @@ -1390,7 +1360,7 @@ namespace SabreTools.Library.Dats columns.Add("Machine.Name"); break; case "game description": - columns.Add("Machine.Description"); + columns.Add("Description"); break; case "type": columns.Add("DatItem.Type"); @@ -1491,7 +1461,7 @@ namespace SabreTools.Library.Dats case "Machine.Name": machineName = value; break; - case "Machine.Description": + case "Description": machineDesc = value; break; case "DatItem.Type": @@ -1578,11 +1548,8 @@ namespace SabreTools.Library.Dats { Name = name, - Machine = new Machine() - { - Name = machineName, - Description = machineDesc, - }, + MachineName = machineName, + Description = machineDesc, }; ParseAddHelper(archive, clean, remUnicode); @@ -1592,11 +1559,8 @@ namespace SabreTools.Library.Dats { Name = name, - Machine = new Machine() - { - Name = machineName, - Description = machineDesc, - }, + MachineName = machineName, + Description = machineDesc, }; ParseAddHelper(biosset, clean, remUnicode); @@ -1611,11 +1575,8 @@ namespace SabreTools.Library.Dats SHA384 = sha384, SHA512 = sha512, - Machine = new Machine() - { - Name = machineName, - Description = machineDesc, - }, + MachineName = machineName, + Description = machineDesc, ItemStatus = status, }; @@ -1627,11 +1588,8 @@ namespace SabreTools.Library.Dats { Name = name, - Machine = new Machine() - { - Name = machineName, - Description = machineDesc, - }, + MachineName = machineName, + Description = machineDesc, }; ParseAddHelper(release, clean, remUnicode); @@ -1648,11 +1606,8 @@ namespace SabreTools.Library.Dats SHA384 = sha384, SHA512 = sha512, - Machine = new Machine() - { - Name = machineName, - Description = machineDesc, - }, + MachineName = machineName, + Description = machineDesc, ItemStatus = status, }; @@ -1664,11 +1619,8 @@ namespace SabreTools.Library.Dats { Name = name, - Machine = new Machine() - { - Name = machineName, - Description = machineDesc, - }, + MachineName = machineName, + Description = machineDesc, }; ParseAddHelper(sample, clean, remUnicode); @@ -2275,10 +2227,10 @@ namespace SabreTools.Library.Dats Size = size, CRC = subreader.ReadElementContentAsString(), ItemStatus = ItemStatus.None, - - Machine = (Machine)machine.Clone(), }; + olrom.CopyMachineInformation(machine); + // Now process and add the rom key = ParseAddHelper(olrom, clean, remUnicode); break; @@ -2363,8 +2315,6 @@ namespace SabreTools.Library.Dats Date = date, Default = defaultrel, - Machine = (Machine)machine.Clone(), - Supported = supported, Publisher = publisher, Infos = infos, @@ -2375,6 +2325,8 @@ namespace SabreTools.Library.Dats AreaSize = areasize, }; + relrom.CopyMachineInformation(machine); + // Now process and add the rom key = ParseAddHelper(relrom, clean, remUnicode); @@ -2402,8 +2354,6 @@ namespace SabreTools.Library.Dats Description = subreader.GetAttribute("description"), Default = defaultbios, - Machine = (Machine)machine.Clone(), - Supported = supported, Publisher = publisher, Infos = infos, @@ -2418,6 +2368,8 @@ namespace SabreTools.Library.Dats SourceID = srcid, }; + biosrom.CopyMachineInformation(machine); + // Now process and add the rom key = ParseAddHelper(biosrom, clean, remUnicode); @@ -2430,8 +2382,6 @@ namespace SabreTools.Library.Dats { Name = subreader.GetAttribute("name"), - Machine = (Machine)machine.Clone(), - Supported = supported, Publisher = publisher, Infos = infos, @@ -2446,6 +2396,8 @@ namespace SabreTools.Library.Dats SourceID = srcid, }; + archiverom.CopyMachineInformation(machine); + // Now process and add the rom key = ParseAddHelper(archiverom, clean, remUnicode); @@ -2458,8 +2410,6 @@ namespace SabreTools.Library.Dats { Name = subreader.GetAttribute("name"), - Machine = (Machine)machine.Clone(), - Supported = supported, Publisher = publisher, Infos = infos, @@ -2474,6 +2424,8 @@ namespace SabreTools.Library.Dats SourceID = srcid, }; + samplerom.CopyMachineInformation(machine); + // Now process and add the rom key = ParseAddHelper(samplerom, clean, remUnicode); @@ -2567,8 +2519,6 @@ namespace SabreTools.Library.Dats MergeTag = merge, ItemStatus = its, - Machine = (Machine)machine.Clone(), - Supported = supported, Publisher = publisher, Infos = infos, @@ -2599,8 +2549,6 @@ namespace SabreTools.Library.Dats MergeTag = merge, Date = date, - Machine = (Machine)machine.Clone(), - Supported = supported, Publisher = publisher, Infos = infos, @@ -2617,6 +2565,8 @@ namespace SabreTools.Library.Dats break; } + inrom.CopyMachineInformation(machine); + // Now process and add the rom key = ParseAddHelper(inrom, clean, remUnicode); @@ -2761,8 +2711,6 @@ namespace SabreTools.Library.Dats SHA512 = xtr.GetAttribute("sha512")?.ToLowerInvariant(), ItemStatus = its, - Machine = (Machine)dir.Clone(), - SystemID = sysid, System = filename, SourceID = srcid, @@ -2783,8 +2731,6 @@ namespace SabreTools.Library.Dats ItemStatus = its, Date = date, - Machine = (Machine)dir.Clone(), - SystemID = sysid, System = filename, SourceID = srcid, @@ -2792,6 +2738,8 @@ namespace SabreTools.Library.Dats break; } + rom.CopyMachineInformation(dir); + // Now process and add the rom key = ParseAddHelper(rom, clean, remUnicode); @@ -2840,14 +2788,14 @@ namespace SabreTools.Library.Dats } // If we're in cleaning mode, sanitize the game name - item.Machine.UpdateName((clean ? Style.CleanGameName(item.Machine.Name) : item.Machine.Name)); + item.MachineName = (clean ? Style.CleanGameName(item.MachineName) : item.MachineName); // If we're stripping unicode characters, do so from all relevant things if (remUnicode) { item.Name = Style.RemoveUnicodeCharacters(item.Name); - item.Machine.UpdateName(Style.RemoveUnicodeCharacters(item.Machine.Name)); - item.Machine.UpdateDescription(Style.RemoveUnicodeCharacters(item.Machine.Description)); + item.MachineName = Style.RemoveUnicodeCharacters(item.MachineName); + item.Description = Style.RemoveUnicodeCharacters(item.Description); } // If we have a Rom or a Disk, clean the hash data diff --git a/SabreTools.Library/Dats/Partials/DatFile.Rebuild.cs b/SabreTools.Library/Dats/Partials/DatFile.Rebuild.cs index df58d464..2151075d 100644 --- a/SabreTools.Library/Dats/Partials/DatFile.Rebuild.cs +++ b/SabreTools.Library/Dats/Partials/DatFile.Rebuild.cs @@ -640,17 +640,14 @@ namespace SabreTools.Library.Dats // Get the item from the current file Rom item = FileTools.GetStreamInfo(fileStream, fileStream.Length, keepReadOpen: true); - item.Machine = new Machine() - { - Name = Style.GetFileNameWithoutExtension(item.Name), - Description = Style.GetFileNameWithoutExtension(item.Name), - }; + item.MachineName = Style.GetFileNameWithoutExtension(item.Name); + item.Description = Style.GetFileNameWithoutExtension(item.Name); // If we are coming from an archive, set the correct machine name if (machinename != null) { - item.Machine.UpdateName(machinename); - item.Machine.UpdateDescription(machinename); + item.MachineName = machinename; + item.Description = machinename; } Globals.Logger.User("No matches found for '{0}', rebuilding accordingly from inverse flag...", Style.GetFileName(rom.Name)); @@ -659,7 +656,7 @@ namespace SabreTools.Library.Dats switch (outputFormat) { case OutputFormat.Folder: - string outfile = Path.Combine(outDir, Style.RemovePathUnsafeCharacters(item.Machine.Name), item.Name); + string outfile = Path.Combine(outDir, Style.RemovePathUnsafeCharacters(item.MachineName), item.Name); // Make sure the output folder is created Directory.CreateDirectory(Path.GetDirectoryName(outfile)); @@ -777,7 +774,7 @@ namespace SabreTools.Library.Dats foreach (Rom item in dupes) { // Create a headered item to use as well - rom.Machine = (Machine)item.Machine.Clone(); + rom.CopyMachineInformation(item); rom.Name += "_" + rom.CRC; // If either copy succeeds, then we want to set rebuilt to true diff --git a/SabreTools.Library/Dats/Partials/DatFile.Splitters.cs b/SabreTools.Library/Dats/Partials/DatFile.Splitters.cs index 84b30f8e..99d622e6 100644 --- a/SabreTools.Library/Dats/Partials/DatFile.Splitters.cs +++ b/SabreTools.Library/Dats/Partials/DatFile.Splitters.cs @@ -435,8 +435,8 @@ namespace SabreTools.Library.Dats // Clean the input list and set all games to be pathless List items = this[key]; - items.ForEach(item => item.Machine.UpdateName(Style.GetFileName(item.Machine.Name))); - items.ForEach(item => item.Machine.UpdateDescription(Style.GetFileName(item.Machine.Description))); + items.ForEach(item => item.MachineName = Style.GetFileName(item.MachineName)); + items.ForEach(item => item.Description = Style.GetFileName(item.Description)); // Now add the game to the output DAT tempDat.AddRange(key, items); diff --git a/SabreTools.Library/Dats/Partials/DatFile.Writers.cs b/SabreTools.Library/Dats/Partials/DatFile.Writers.cs index a66b4b4e..95a1e2b3 100644 --- a/SabreTools.Library/Dats/Partials/DatFile.Writers.cs +++ b/SabreTools.Library/Dats/Partials/DatFile.Writers.cs @@ -176,22 +176,22 @@ namespace SabreTools.Library.Dats DatItem rom = roms[index]; // There are apparently times when a null rom can skip by, skip them - if (rom.Name == null || rom.Machine.Name == null) + if (rom.Name == null || rom.MachineName == null) { Globals.Logger.Warning("Null rom found!"); continue; } - List newsplit = rom.Machine.Name.Split('\\').ToList(); + List newsplit = rom.MachineName.Split('\\').ToList(); // If we have a different game and we're not at the start of the list, output the end of last item - if (lastgame != null && lastgame.ToLowerInvariant() != rom.Machine.Name.ToLowerInvariant()) + if (lastgame != null && lastgame.ToLowerInvariant() != rom.MachineName.ToLowerInvariant()) { depth = WriteEndGame(sw, datFormat, rom, splitpath, newsplit, lastgame, depth, out last); } // If we have a new game, output the beginning of the new item - if (lastgame == null || lastgame.ToLowerInvariant() != rom.Machine.Name.ToLowerInvariant()) + if (lastgame == null || lastgame.ToLowerInvariant() != rom.MachineName.ToLowerInvariant()) { depth = WriteStartGame(sw, datFormat, rom, newsplit, lastgame, depth, last); } @@ -201,7 +201,7 @@ namespace SabreTools.Library.Dats && ((Rom)rom).Size == -1 && ((Rom)rom).CRC == "null") { - Globals.Logger.Verbose("Empty folder found: {0}", rom.Machine.Name); + Globals.Logger.Verbose("Empty folder found: {0}", rom.MachineName); // If we're in a mode that doesn't allow for actual empty folders, add the blank info if (datFormat != DatFormat.CSV @@ -223,7 +223,7 @@ namespace SabreTools.Library.Dats else { splitpath = newsplit; - lastgame = rom.Machine.Name; + lastgame = rom.MachineName; continue; } } @@ -233,7 +233,7 @@ namespace SabreTools.Library.Dats // Set the new data to compare against splitpath = newsplit; - lastgame = rom.Machine.Name; + lastgame = rom.MachineName; } } @@ -476,73 +476,73 @@ namespace SabreTools.Library.Dats try { // No game should start with a path separator - if (rom.Machine.Name.StartsWith(Path.DirectorySeparatorChar.ToString())) + if (rom.MachineName.StartsWith(Path.DirectorySeparatorChar.ToString())) { - rom.Machine.UpdateName(rom.Machine.Name.Substring(1)); + rom.MachineName = rom.MachineName.Substring(1); } string state = ""; switch (datFormat) { case DatFormat.AttractMode: - state += rom.Machine.Name + ";" - + rom.Machine.Description + ";" + state += rom.MachineName + ";" + + rom.Description + ";" + FileName + ";" - + rom.Machine.CloneOf + ";" - + rom.Machine.Year + ";" - + rom.Machine.Manufacturer + ";" - /* + rom.Machine.Category */ + ";" - /* + rom.Machine.Players */ + ";" - /* + rom.Machine.Rotation */ + ";" - /* + rom.Machine.Control */ + ";" - /* + rom.Machine.Status */ + ";" - /* + rom.Machine.DisplayCount */ + ";" - /* + rom.Machine.DisplayType */ + ";" - /* + rom.Machine.AltRomname */ + ";" - /* + rom.Machine.AltTitle */ + ";" - + rom.Machine.Comment + ";" - /* + rom.Machine.Buttons */ + "\n"; + + rom.CloneOf + ";" + + rom.Year + ";" + + rom.Manufacturer + ";" + /* + rom.Category */ + ";" + /* + rom.Players */ + ";" + /* + rom.Rotation */ + ";" + /* + rom.Control */ + ";" + /* + rom.Status */ + ";" + /* + rom.DisplayCount */ + ";" + /* + rom.DisplayType */ + ";" + /* + rom.AltRomname */ + ";" + /* + rom.AltTitle */ + ";" + + rom.Comment + ";" + /* + rom.Buttons */ + "\n"; break; case DatFormat.ClrMamePro: - state += "game (\n\tname \"" + rom.Machine.Name + "\"\n" + + state += "game (\n\tname \"" + rom.MachineName + "\"\n" + (ExcludeOf ? "" : - (String.IsNullOrEmpty(rom.Machine.RomOf) ? "" : "\tromof \"" + rom.Machine.RomOf + "\"\n") + - (String.IsNullOrEmpty(rom.Machine.CloneOf) ? "" : "\tcloneof \"" + rom.Machine.CloneOf + "\"\n") + - (String.IsNullOrEmpty(rom.Machine.SampleOf) ? "" : "\tsampleof \"" + rom.Machine.SampleOf + "\"\n") + (String.IsNullOrEmpty(rom.RomOf) ? "" : "\tromof \"" + rom.RomOf + "\"\n") + + (String.IsNullOrEmpty(rom.CloneOf) ? "" : "\tcloneof \"" + rom.CloneOf + "\"\n") + + (String.IsNullOrEmpty(rom.SampleOf) ? "" : "\tsampleof \"" + rom.SampleOf + "\"\n") ) + - "\tdescription \"" + (String.IsNullOrEmpty(rom.Machine.Description) ? rom.Machine.Name : rom.Machine.Description) + "\"\n" + - (String.IsNullOrEmpty(rom.Machine.Year) ? "" : "\tyear " + rom.Machine.Year + "\n") + - (String.IsNullOrEmpty(rom.Machine.Manufacturer) ? "" : "\tmanufacturer \"" + rom.Machine.Manufacturer + "\"\n"); + "\tdescription \"" + (String.IsNullOrEmpty(rom.Description) ? rom.MachineName : rom.Description) + "\"\n" + + (String.IsNullOrEmpty(rom.Year) ? "" : "\tyear " + rom.Year + "\n") + + (String.IsNullOrEmpty(rom.Manufacturer) ? "" : "\tmanufacturer \"" + rom.Manufacturer + "\"\n"); break; case DatFormat.DOSCenter: - state += "game (\n\tname \"" + rom.Machine.Name + ".zip\"\n"; + state += "game (\n\tname \"" + rom.MachineName + ".zip\"\n"; break; case DatFormat.Listroms: - state += "ROMs required for driver \"" + rom.Machine.Name + "\".\n" + + state += "ROMs required for driver \"" + rom.MachineName + "\".\n" + "Name Size Checksum\n"; break; case DatFormat.Logiqx: - state += "\t\n" + - (String.IsNullOrEmpty(rom.Machine.Comment) ? "" : "\t\t" + HttpUtility.HtmlEncode(rom.Machine.Comment) + "\n") + - "\t\t" + HttpUtility.HtmlEncode((String.IsNullOrEmpty(rom.Machine.Description) ? rom.Machine.Name : rom.Machine.Description)) + "\n" + - (String.IsNullOrEmpty(rom.Machine.Year) ? "" : "\t\t" + HttpUtility.HtmlEncode(rom.Machine.Year) + "\n") + - (String.IsNullOrEmpty(rom.Machine.Manufacturer) ? "" : "\t\t" + HttpUtility.HtmlEncode(rom.Machine.Manufacturer) + "\n"); + (String.IsNullOrEmpty(rom.Comment) ? "" : "\t\t" + HttpUtility.HtmlEncode(rom.Comment) + "\n") + + "\t\t" + HttpUtility.HtmlEncode((String.IsNullOrEmpty(rom.Description) ? rom.MachineName : rom.Description)) + "\n" + + (String.IsNullOrEmpty(rom.Year) ? "" : "\t\t" + HttpUtility.HtmlEncode(rom.Year) + "\n") + + (String.IsNullOrEmpty(rom.Manufacturer) ? "" : "\t\t" + HttpUtility.HtmlEncode(rom.Manufacturer) + "\n"); break; case DatFormat.SabreDat: for (int i = (last == -1 ? 0 : last); i < newsplit.Count; i++) @@ -557,21 +557,21 @@ namespace SabreTools.Library.Dats depth = depth - (last == -1 ? 0 : last) + newsplit.Count; break; case DatFormat.SoftwareList: - state += "\t\n" - + "\t\t" + HttpUtility.HtmlEncode(rom.Machine.Description) + "\n" - + (rom.Machine.Year != null ? "\t\t" + HttpUtility.HtmlEncode(rom.Machine.Year) + "\n" : "") + + "\t\t" + HttpUtility.HtmlEncode(rom.Description) + "\n" + + (rom.Year != null ? "\t\t" + HttpUtility.HtmlEncode(rom.Year) + "\n" : "") + (rom.Publisher != null ? "\t\t" + HttpUtility.HtmlEncode(rom.Publisher) + "\n" : ""); foreach (Tuple kvp in rom.Infos) @@ -617,7 +617,7 @@ namespace SabreTools.Library.Dats { case DatFormat.ClrMamePro: case DatFormat.DOSCenter: - state += (String.IsNullOrEmpty(rom.Machine.SampleOf) ? "" : "\tsampleof \"" + rom.Machine.SampleOf + "\"\n") + ")\n"; + state += (String.IsNullOrEmpty(rom.SampleOf) ? "" : "\tsampleof \"" + rom.SampleOf + "\"\n") + ")\n"; break; case DatFormat.Listroms: state += "\n"; @@ -769,7 +769,7 @@ namespace SabreTools.Library.Dats { // Check for special strings in prefix and postfix pre = pre - .Replace("%game%", rom.Machine.Name) + .Replace("%game%", rom.MachineName) .Replace("%name%", rom.Name) .Replace("%crc%", ((Rom)rom).CRC) .Replace("%md5%", ((Rom)rom).MD5) @@ -779,7 +779,7 @@ namespace SabreTools.Library.Dats .Replace("%sha512%", ((Rom)rom).SHA512) .Replace("%size%", ((Rom)rom).Size.ToString()); post = post - .Replace("%game%", rom.Machine.Name) + .Replace("%game%", rom.MachineName) .Replace("%name%", rom.Name) .Replace("%crc%", ((Rom)rom).CRC) .Replace("%md5%", ((Rom)rom).MD5) @@ -793,7 +793,7 @@ namespace SabreTools.Library.Dats { // Check for special strings in prefix and postfix pre = pre - .Replace("%game%", rom.Machine.Name) + .Replace("%game%", rom.MachineName) .Replace("%name%", rom.Name) .Replace("%crc%", string.Empty) .Replace("%md5%", ((Disk)rom).MD5) @@ -803,7 +803,7 @@ namespace SabreTools.Library.Dats .Replace("%sha512%", ((Disk)rom).SHA512) .Replace("%size%", string.Empty);; post = post - .Replace("%game%", rom.Machine.Name) + .Replace("%game%", rom.MachineName) .Replace("%name%", rom.Name) .Replace("%crc%", string.Empty) .Replace("%md5%", ((Disk)rom).MD5) @@ -817,14 +817,14 @@ namespace SabreTools.Library.Dats { // Check for special strings in prefix and postfix pre = pre - .Replace("%game%", rom.Machine.Name) + .Replace("%game%", rom.MachineName) .Replace("%name%", rom.Name) .Replace("%crc%", string.Empty) .Replace("%md5%", string.Empty) .Replace("%sha1%", string.Empty) .Replace("%size%", string.Empty); post = post - .Replace("%game%", rom.Machine.Name) + .Replace("%game%", rom.MachineName) .Replace("%name%", rom.Name) .Replace("%crc%", string.Empty) .Replace("%md5%", string.Empty) @@ -837,8 +837,8 @@ namespace SabreTools.Library.Dats string inline = "\"" + FileName + "\"" + ",\"" + Name + "\"" + ",\"" + Description + "\"" - + ",\"" + rom.Machine.Name + "\"" - + ",\"" + rom.Machine.Description + "\"" + + ",\"" + rom.MachineName + "\"" + + ",\"" + rom.Description + "\"" + "," + "\"rom\"" + ",\"" + rom.Name + "\"" + "," + "\"\"" @@ -857,8 +857,8 @@ namespace SabreTools.Library.Dats string inline = "\"" + FileName + "\"" + ",\"" + Name + "\"" + ",\"" + Description + "\"" - + ",\"" + rom.Machine.Name + "\"" - + ",\"" + rom.Machine.Description + "\"" + + ",\"" + rom.MachineName + "\"" + + ",\"" + rom.Description + "\"" + "," + "\"disk\"" + "," + "\"\"" + ",\"" + rom.Name + "\"" @@ -1044,7 +1044,7 @@ namespace SabreTools.Library.Dats { // Check for special strings in prefix and postfix pre = pre - .Replace("%game%", rom.Machine.Name) + .Replace("%game%", rom.MachineName) .Replace("%name%", rom.Name) .Replace("%crc%", ((Rom)rom).CRC) .Replace("%md5%", ((Rom)rom).MD5) @@ -1054,7 +1054,7 @@ namespace SabreTools.Library.Dats .Replace("%sha512%", ((Rom)rom).SHA512) .Replace("%size%", ((Rom)rom).Size.ToString()); post = post - .Replace("%game%", rom.Machine.Name) + .Replace("%game%", rom.MachineName) .Replace("%name%", rom.Name) .Replace("%crc%", ((Rom)rom).CRC) .Replace("%md5%", ((Rom)rom).MD5) @@ -1068,7 +1068,7 @@ namespace SabreTools.Library.Dats { // Check for special strings in prefix and postfix pre = pre - .Replace("%game%", rom.Machine.Name) + .Replace("%game%", rom.MachineName) .Replace("%name%", rom.Name) .Replace("%crc%", string.Empty) .Replace("%md5%", ((Disk)rom).MD5) @@ -1078,7 +1078,7 @@ namespace SabreTools.Library.Dats .Replace("%sha512%", ((Disk)rom).SHA512) .Replace("%size%", string.Empty); post = post - .Replace("%game%", rom.Machine.Name) + .Replace("%game%", rom.MachineName) .Replace("%name%", rom.Name) .Replace("%crc%", string.Empty) .Replace("%md5%", ((Disk)rom).MD5) @@ -1092,7 +1092,7 @@ namespace SabreTools.Library.Dats { // Check for special strings in prefix and postfix pre = pre - .Replace("%game%", rom.Machine.Name) + .Replace("%game%", rom.MachineName) .Replace("%name%", rom.Name) .Replace("%crc%", string.Empty) .Replace("%md5%", string.Empty) @@ -1102,7 +1102,7 @@ namespace SabreTools.Library.Dats .Replace("%sha512%", string.Empty) .Replace("%size%", string.Empty); post = post - .Replace("%game%", rom.Machine.Name) + .Replace("%game%", rom.MachineName) .Replace("%name%", rom.Name) .Replace("%crc%", string.Empty) .Replace("%md5%", string.Empty) @@ -1147,7 +1147,7 @@ namespace SabreTools.Library.Dats // Otherwise, use any flags else { - name = (UseGame ? rom.Machine.Name : rom.Name); + name = (UseGame ? rom.MachineName : rom.Name); if (RepExt != "" || RemExt) { if (RemExt) @@ -1165,13 +1165,13 @@ namespace SabreTools.Library.Dats } if (!UseGame && GameName) { - name = Path.Combine(rom.Machine.Name, name); + name = Path.Combine(rom.MachineName, name); } - if (UseGame && rom.Machine.Name != lastgame) + if (UseGame && rom.MachineName != lastgame) { state += pre + name + post + "\n"; - lastgame = rom.Machine.Name; + lastgame = rom.MachineName; } else if (!UseGame) { @@ -1231,76 +1231,76 @@ namespace SabreTools.Library.Dats case DatFormat.RedumpMD5: if (rom.Type == ItemType.Rom) { - state += ((Rom)rom).MD5 + " *" + (GameName ? rom.Machine.Name + Path.DirectorySeparatorChar : "") + rom.Name + "\n"; + state += ((Rom)rom).MD5 + " *" + (GameName ? rom.MachineName + Path.DirectorySeparatorChar : "") + rom.Name + "\n"; } else if (rom.Type == ItemType.Disk) { - state += ((Disk)rom).MD5 + " *" + (GameName ? rom.Machine.Name + Path.DirectorySeparatorChar : "") + rom.Name + "\n"; + state += ((Disk)rom).MD5 + " *" + (GameName ? rom.MachineName + Path.DirectorySeparatorChar : "") + rom.Name + "\n"; } break; case DatFormat.RedumpSFV: if (rom.Type == ItemType.Rom) { - state += (GameName ? rom.Machine.Name + Path.DirectorySeparatorChar : "") + rom.Name + " " + ((Rom)rom).CRC + "\n"; + state += (GameName ? rom.MachineName + Path.DirectorySeparatorChar : "") + rom.Name + " " + ((Rom)rom).CRC + "\n"; } break; case DatFormat.RedumpSHA1: if (rom.Type == ItemType.Rom) { - state += ((Rom)rom).SHA1 + " *" + (GameName ? rom.Machine.Name + Path.DirectorySeparatorChar : "") + rom.Name + "\n"; + state += ((Rom)rom).SHA1 + " *" + (GameName ? rom.MachineName + Path.DirectorySeparatorChar : "") + rom.Name + "\n"; } else if (rom.Type == ItemType.Disk) { - state += ((Disk)rom).SHA1 + " *" + (GameName ? rom.Machine.Name + Path.DirectorySeparatorChar : "") + rom.Name + "\n"; + state += ((Disk)rom).SHA1 + " *" + (GameName ? rom.MachineName + Path.DirectorySeparatorChar : "") + rom.Name + "\n"; } break; case DatFormat.RedumpSHA256: if (rom.Type == ItemType.Rom) { - state += ((Rom)rom).SHA256 + " *" + (GameName ? rom.Machine.Name + Path.DirectorySeparatorChar : "") + rom.Name + "\n"; + state += ((Rom)rom).SHA256 + " *" + (GameName ? rom.MachineName + Path.DirectorySeparatorChar : "") + rom.Name + "\n"; } else if (rom.Type == ItemType.Disk) { - state += ((Disk)rom).SHA256 + " *" + (GameName ? rom.Machine.Name + Path.DirectorySeparatorChar : "") + rom.Name + "\n"; + state += ((Disk)rom).SHA256 + " *" + (GameName ? rom.MachineName + Path.DirectorySeparatorChar : "") + rom.Name + "\n"; } break; case DatFormat.RedumpSHA384: if (rom.Type == ItemType.Rom) { - state += ((Rom)rom).SHA384 + " *" + (GameName ? rom.Machine.Name + Path.DirectorySeparatorChar : "") + rom.Name + "\n"; + state += ((Rom)rom).SHA384 + " *" + (GameName ? rom.MachineName + Path.DirectorySeparatorChar : "") + rom.Name + "\n"; } else if (rom.Type == ItemType.Disk) { - state += ((Disk)rom).SHA384 + " *" + (GameName ? rom.Machine.Name + Path.DirectorySeparatorChar : "") + rom.Name + "\n"; + state += ((Disk)rom).SHA384 + " *" + (GameName ? rom.MachineName + Path.DirectorySeparatorChar : "") + rom.Name + "\n"; } break; case DatFormat.RedumpSHA512: if (rom.Type == ItemType.Rom) { - state += ((Rom)rom).SHA512 + " *" + (GameName ? rom.Machine.Name + Path.DirectorySeparatorChar : "") + rom.Name + "\n"; + state += ((Rom)rom).SHA512 + " *" + (GameName ? rom.MachineName + Path.DirectorySeparatorChar : "") + rom.Name + "\n"; } else if (rom.Type == ItemType.Disk) { - state += ((Disk)rom).SHA512 + " *" + (GameName ? rom.Machine.Name + Path.DirectorySeparatorChar : "") + rom.Name + "\n"; + state += ((Disk)rom).SHA512 + " *" + (GameName ? rom.MachineName + Path.DirectorySeparatorChar : "") + rom.Name + "\n"; } break; case DatFormat.RomCenter: if (rom.Type == ItemType.Rom) { - state += "¬" + (String.IsNullOrEmpty(rom.Machine.CloneOf) ? "" : HttpUtility.HtmlEncode(rom.Machine.CloneOf)) + - "¬" + (String.IsNullOrEmpty(rom.Machine.CloneOf) ? "" : HttpUtility.HtmlEncode(rom.Machine.CloneOf)) + - "¬" + HttpUtility.HtmlEncode(rom.Machine.Name) + - "¬" + HttpUtility.HtmlEncode((String.IsNullOrEmpty(rom.Machine.Description) ? rom.Machine.Name : rom.Machine.Description)) + + state += "¬" + (String.IsNullOrEmpty(rom.CloneOf) ? "" : HttpUtility.HtmlEncode(rom.CloneOf)) + + "¬" + (String.IsNullOrEmpty(rom.CloneOf) ? "" : HttpUtility.HtmlEncode(rom.CloneOf)) + + "¬" + HttpUtility.HtmlEncode(rom.MachineName) + + "¬" + HttpUtility.HtmlEncode((String.IsNullOrEmpty(rom.Description) ? rom.MachineName : rom.Description)) + "¬" + HttpUtility.HtmlEncode(rom.Name) + "¬" + ((Rom)rom).CRC.ToLowerInvariant() + "¬" + (((Rom)rom).Size != -1 ? ((Rom)rom).Size.ToString() : "") + "¬¬¬\n"; } else if (rom.Type == ItemType.Disk) { - state += "¬" + (String.IsNullOrEmpty(rom.Machine.CloneOf) ? "" : HttpUtility.HtmlEncode(rom.Machine.CloneOf)) + - "¬" + (String.IsNullOrEmpty(rom.Machine.CloneOf) ? "" : HttpUtility.HtmlEncode(rom.Machine.CloneOf)) + - "¬" + HttpUtility.HtmlEncode(rom.Machine.Name) + - "¬" + HttpUtility.HtmlEncode((String.IsNullOrEmpty(rom.Machine.Description) ? rom.Machine.Name : rom.Machine.Description)) + + state += "¬" + (String.IsNullOrEmpty(rom.CloneOf) ? "" : HttpUtility.HtmlEncode(rom.CloneOf)) + + "¬" + (String.IsNullOrEmpty(rom.CloneOf) ? "" : HttpUtility.HtmlEncode(rom.CloneOf)) + + "¬" + HttpUtility.HtmlEncode(rom.MachineName) + + "¬" + HttpUtility.HtmlEncode((String.IsNullOrEmpty(rom.Description) ? rom.MachineName : rom.Description)) + "¬" + HttpUtility.HtmlEncode(rom.Name) + "¬¬¬¬¬\n"; } @@ -1466,7 +1466,7 @@ namespace SabreTools.Library.Dats { // Check for special strings in prefix and postfix pre = pre - .Replace("%game%", rom.Machine.Name) + .Replace("%game%", rom.MachineName) .Replace("%name%", rom.Name) .Replace("%crc%", ((Rom)rom).CRC) .Replace("%md5%", ((Rom)rom).MD5) @@ -1476,7 +1476,7 @@ namespace SabreTools.Library.Dats .Replace("%sha512%", ((Rom)rom).SHA512) .Replace("%size%", ((Rom)rom).Size.ToString()); post = post - .Replace("%game%", rom.Machine.Name) + .Replace("%game%", rom.MachineName) .Replace("%name%", rom.Name) .Replace("%crc%", ((Rom)rom).CRC) .Replace("%md5%", ((Rom)rom).MD5) @@ -1490,7 +1490,7 @@ namespace SabreTools.Library.Dats { // Check for special strings in prefix and postfix pre = pre - .Replace("%game%", rom.Machine.Name) + .Replace("%game%", rom.MachineName) .Replace("%name%", rom.Name) .Replace("%crc%", string.Empty) .Replace("%md5%", ((Disk)rom).MD5) @@ -1500,7 +1500,7 @@ namespace SabreTools.Library.Dats .Replace("%sha512%", ((Disk)rom).SHA512) .Replace("%size%", string.Empty); post = post - .Replace("%game%", rom.Machine.Name) + .Replace("%game%", rom.MachineName) .Replace("%name%", rom.Name) .Replace("%crc%", string.Empty) .Replace("%md5%", ((Disk)rom).MD5) @@ -1514,7 +1514,7 @@ namespace SabreTools.Library.Dats { // Check for special strings in prefix and postfix pre = pre - .Replace("%game%", rom.Machine.Name) + .Replace("%game%", rom.MachineName) .Replace("%name%", rom.Name) .Replace("%crc%", string.Empty) .Replace("%md5%", string.Empty) @@ -1524,7 +1524,7 @@ namespace SabreTools.Library.Dats .Replace("%sha512%", string.Empty) .Replace("%size%", string.Empty); post = post - .Replace("%game%", rom.Machine.Name) + .Replace("%game%", rom.MachineName) .Replace("%name%", rom.Name) .Replace("%crc%", string.Empty) .Replace("%md5%", string.Empty) @@ -1541,8 +1541,8 @@ namespace SabreTools.Library.Dats string inline = "\"" + FileName + "\"" + "\t\"" + Name + "\"" + "\t\"" + Description + "\"" - + "\t\"" + rom.Machine.Name + "\"" - + "\t\"" + rom.Machine.Description + "\"" + + "\t\"" + rom.MachineName + "\"" + + "\t\"" + rom.Description + "\"" + "\t" + "\"rom\"" + "\t\"" + rom.Name + "\"" + "\t" + "\"\"" @@ -1561,8 +1561,8 @@ namespace SabreTools.Library.Dats string inline = "\"" + FileName + "\"" + "\t\"" + Name + "\"" + "\t\"" + Description + "\"" - + "\t\"" + rom.Machine.Name + "\"" - + "\t\"" + rom.Machine.Description + "\"" + + "\t\"" + rom.MachineName + "\"" + + "\t\"" + rom.Description + "\"" + "\t" + "\"disk\"" + "\t" + "\"\"" + "\t\"" + rom.Name + "\"" diff --git a/SabreTools.Library/Tools/ArchiveTools.cs b/SabreTools.Library/Tools/ArchiveTools.cs index 7fb93e13..fde0a4f7 100644 --- a/SabreTools.Library/Tools/ArchiveTools.cs +++ b/SabreTools.Library/Tools/ArchiveTools.cs @@ -634,10 +634,7 @@ namespace SabreTools.Library.Tools CRC = entry.Crc.ToString("X").ToLowerInvariant(), Date = (date && entry.LastModifiedTime != null ? entry.LastModifiedTime?.ToString("yyyy/MM/dd hh:mm:ss") : null), - Machine = new Machine - { - Name = gamename, - }, + MachineName = gamename, }); } // Otherwise, extract to a stream @@ -650,10 +647,7 @@ namespace SabreTools.Library.Tools // Get and add the extended Rom information Rom sevenZipEntryRom = FileTools.GetStreamInfo(entryStream, entryStream.Length, omitFromScan: omitFromScan); sevenZipEntryRom.Name = entry.Key; - sevenZipEntryRom.Machine = new Machine() - { - Name = gamename, - }; + sevenZipEntryRom.MachineName = gamename; sevenZipEntryRom.Date = (date && entry.LastModifiedTime != null ? entry.LastModifiedTime?.ToString("yyyy/MM/dd hh:mm:ss") : null); found.Add(sevenZipEntryRom); } @@ -690,10 +684,7 @@ namespace SabreTools.Library.Tools // Get and add the extended Rom information Rom gzipEntryRom = FileTools.GetStreamInfo(outstream, outstream.Length, omitFromScan: omitFromScan); gzipEntryRom.Name = gzstream.FileName; - gzipEntryRom.Machine = new Machine() - { - Name = gamename, - }; + gzipEntryRom.MachineName = gamename; gzipEntryRom.Date = (date && gzstream.LastModified != null ? gzstream.LastModified?.ToString("yyyy/MM/dd hh:mm:ss") : null); found.Add(gzipEntryRom); @@ -718,10 +709,7 @@ namespace SabreTools.Library.Tools CRC = entry.Crc.ToString("X").ToLowerInvariant(), Date = (date && entry.LastModifiedTime != null ? entry.LastModifiedTime?.ToString("yyyy/MM/dd hh:mm:ss") : null), - Machine = new Machine - { - Name = gamename, - }, + MachineName = gamename, }); } // Otherwise, extract to a stream @@ -734,10 +722,7 @@ namespace SabreTools.Library.Tools // Get and add the extended Rom information Rom sevenZipEntryRom = FileTools.GetStreamInfo(entryStream, entryStream.Length, omitFromScan: omitFromScan); sevenZipEntryRom.Name = entry.Key; - sevenZipEntryRom.Machine = new Machine() - { - Name = gamename, - }; + sevenZipEntryRom.MachineName = gamename; sevenZipEntryRom.Date = entry.LastModifiedTime?.ToString("yyyy/MM/dd hh:mm:ss"); found.Add(sevenZipEntryRom); } @@ -763,10 +748,7 @@ namespace SabreTools.Library.Tools CRC = entry.Crc.ToString("X").ToLowerInvariant(), Date = (date && entry.LastModifiedTime != null ? entry.LastModifiedTime?.ToString("yyyy/MM/dd hh:mm:ss") : null), - Machine = new Machine - { - Name = gamename, - }, + MachineName = gamename, }); } // Otherwise, extract to a stream @@ -779,10 +761,7 @@ namespace SabreTools.Library.Tools // Get and add the extended Rom information Rom sevenZipEntryRom = FileTools.GetStreamInfo(entryStream, entryStream.Length, omitFromScan: omitFromScan); sevenZipEntryRom.Name = entry.Key; - sevenZipEntryRom.Machine = new Machine() - { - Name = gamename, - }; + sevenZipEntryRom.MachineName = gamename; sevenZipEntryRom.Date = entry.LastModifiedTime?.ToString("yyyy/MM/dd hh:mm:ss"); found.Add(sevenZipEntryRom); } @@ -830,10 +809,7 @@ namespace SabreTools.Library.Tools CRC = newcrc, Date = (date ? convertedDate : null), - Machine = new Machine - { - Name = gamename, - }, + MachineName = gamename, }); } // Otherwise, extract to a stream @@ -871,10 +847,7 @@ namespace SabreTools.Library.Tools // Get and add the extended Rom information Rom zipEntryRom = FileTools.GetStreamInfo(entryStream, entryStream.Length, omitFromScan: omitFromScan); zipEntryRom.Name = zf.Entries[i].FileName; - zipEntryRom.Machine = new Machine() - { - Name = gamename, - }; + zipEntryRom.MachineName = gamename; string convertedDate = Style.ConvertMsDosTimeFormatToDateTime(zf.Entries[i].LastMod).ToString("yyyy/MM/dd hh:mm:ss"); zipEntryRom.Date = (date ? convertedDate : null); found.Add(zipEntryRom); @@ -975,10 +948,7 @@ namespace SabreTools.Library.Tools MD5 = gzmd5.ToLowerInvariant(), SHA1 = Path.GetFileNameWithoutExtension(input).ToLowerInvariant(), // TODO: When updating to SHA-256, this needs to update to SHA256 - Machine = new Machine - { - Name = Path.GetFileNameWithoutExtension(input).ToLowerInvariant(), - }, + MachineName = Path.GetFileNameWithoutExtension(input).ToLowerInvariant(), }; return rom; @@ -1465,7 +1435,7 @@ namespace SabreTools.Library.Tools FileStream outputStream = null; // Get the output folder name from the first rebuild rom - string fileName = Path.Combine(outDir, Style.RemovePathUnsafeCharacters(rom.Machine.Name), Style.RemovePathUnsafeCharacters(rom.Name)); + string fileName = Path.Combine(outDir, Style.RemovePathUnsafeCharacters(rom.MachineName), Style.RemovePathUnsafeCharacters(rom.Name)); try { @@ -1558,7 +1528,7 @@ namespace SabreTools.Library.Tools } // Get the output archive name from the first rebuild rom - string archiveFileName = Path.Combine(outDir, Style.RemovePathUnsafeCharacters(rom.Machine.Name) + (rom.Machine.Name.EndsWith(".tar") ? "" : ".tar")); + string archiveFileName = Path.Combine(outDir, Style.RemovePathUnsafeCharacters(rom.MachineName) + (rom.MachineName.EndsWith(".tar") ? "" : ".tar")); // Set internal variables TarArchive oldTarFile = TarArchive.Create(); @@ -1704,7 +1674,7 @@ namespace SabreTools.Library.Tools } // Get the output archive name from the first rebuild rom - string archiveFileName = Path.Combine(outDir, Style.RemovePathUnsafeCharacters(roms[0].Machine.Name) + (roms[0].Machine.Name.EndsWith(".tar") ? "" : ".tar")); + string archiveFileName = Path.Combine(outDir, Style.RemovePathUnsafeCharacters(roms[0].MachineName) + (roms[0].MachineName.EndsWith(".tar") ? "" : ".tar")); // Set internal variables TarArchive oldTarFile = TarArchive.Create(); @@ -1877,7 +1847,7 @@ namespace SabreTools.Library.Tools inputStream.Seek(0, SeekOrigin.Begin); // Get the output archive name from the first rebuild rom - string archiveFileName = Path.Combine(outDir, Style.RemovePathUnsafeCharacters(rom.Machine.Name) + (rom.Machine.Name.EndsWith(".7z") ? "" : ".7z")); + string archiveFileName = Path.Combine(outDir, Style.RemovePathUnsafeCharacters(rom.MachineName) + (rom.MachineName.EndsWith(".7z") ? "" : ".7z")); // Set internal variables SevenZipBase.SetLibraryPath("7za.dll"); @@ -2069,7 +2039,7 @@ namespace SabreTools.Library.Tools } // Get the output archive name from the first rebuild rom - string archiveFileName = Path.Combine(outDir, Style.RemovePathUnsafeCharacters(roms[0].Machine.Name) + (roms[0].Machine.Name.EndsWith(".7z") ? "" : ".7z")); + string archiveFileName = Path.Combine(outDir, Style.RemovePathUnsafeCharacters(roms[0].MachineName) + (roms[0].MachineName.EndsWith(".7z") ? "" : ".7z")); // Set internal variables SevenZipBase.SetLibraryPath("7za.dll"); @@ -2451,7 +2421,7 @@ namespace SabreTools.Library.Tools inputStream.Seek(0, SeekOrigin.Begin); // Get the output archive name from the first rebuild rom - string archiveFileName = Path.Combine(outDir, Style.RemovePathUnsafeCharacters(rom.Machine.Name) + (rom.Machine.Name.EndsWith(".xz") ? "" : ".xz")); + string archiveFileName = Path.Combine(outDir, Style.RemovePathUnsafeCharacters(rom.MachineName) + (rom.MachineName.EndsWith(".xz") ? "" : ".xz")); // Set internal variables SevenZipBase.SetLibraryPath("7za.dll"); @@ -2643,7 +2613,7 @@ namespace SabreTools.Library.Tools } // Get the output archive name from the first rebuild rom - string archiveFileName = Path.Combine(outDir, Style.RemovePathUnsafeCharacters(roms[0].Machine.Name) + (roms[0].Machine.Name.EndsWith(".7z") ? "" : ".7z")); + string archiveFileName = Path.Combine(outDir, Style.RemovePathUnsafeCharacters(roms[0].MachineName) + (roms[0].MachineName.EndsWith(".7z") ? "" : ".7z")); // Set internal variables SevenZipBase.SetLibraryPath("7za.dll"); @@ -2857,7 +2827,7 @@ namespace SabreTools.Library.Tools inputStream.Seek(0, SeekOrigin.Begin); // Get the output archive name from the first rebuild rom - string archiveFileName = Path.Combine(outDir, Style.RemovePathUnsafeCharacters(rom.Machine.Name) + (rom.Machine.Name.EndsWith(".zip") ? "" : ".zip")); + string archiveFileName = Path.Combine(outDir, Style.RemovePathUnsafeCharacters(rom.MachineName) + (rom.MachineName.EndsWith(".zip") ? "" : ".zip")); // Set internal variables Stream writeStream = null; @@ -3060,7 +3030,7 @@ namespace SabreTools.Library.Tools } // Get the output archive name from the first rebuild rom - string archiveFileName = Path.Combine(outDir, Style.RemovePathUnsafeCharacters(roms[0].Machine.Name) + (roms[0].Machine.Name.EndsWith(".zip") ? "" : ".zip")); + string archiveFileName = Path.Combine(outDir, Style.RemovePathUnsafeCharacters(roms[0].MachineName) + (roms[0].MachineName.EndsWith(".zip") ? "" : ".zip")); // Set internal variables Stream writeStream = null;