mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[DatFile, Machine] Create and use clone method
This commit is contained in:
@@ -5,7 +5,7 @@ using SabreTools.Library.Data;
|
|||||||
|
|
||||||
namespace SabreTools.Library.Dats
|
namespace SabreTools.Library.Dats
|
||||||
{
|
{
|
||||||
public class Machine
|
public class Machine : ICloneable
|
||||||
{
|
{
|
||||||
#region Protected instance variables
|
#region Protected instance variables
|
||||||
|
|
||||||
@@ -83,6 +83,35 @@ namespace SabreTools.Library.Dats
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Cloning methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a clone of the current machine
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>New machine with the same values as the current one</returns>
|
||||||
|
public object Clone()
|
||||||
|
{
|
||||||
|
return new Machine()
|
||||||
|
{
|
||||||
|
Name = this.Name,
|
||||||
|
Comment = this.Comment,
|
||||||
|
Description = this.Description,
|
||||||
|
Year = this.Year,
|
||||||
|
Manufacturer = this.Manufacturer,
|
||||||
|
RomOf = this.RomOf,
|
||||||
|
CloneOf = this.CloneOf,
|
||||||
|
SampleOf = this.SampleOf,
|
||||||
|
SourceFile = this.SourceFile,
|
||||||
|
Runnable = this.Runnable,
|
||||||
|
Board = this.Board,
|
||||||
|
RebuildTo = this.RebuildTo,
|
||||||
|
Devices = this.Devices,
|
||||||
|
MachineType = this.MachineType,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Equality comparerers
|
#region Equality comparerers
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1813,7 +1813,7 @@ namespace SabreTools.Library.Dats
|
|||||||
CRC = subreader.ReadElementContentAsString(),
|
CRC = subreader.ReadElementContentAsString(),
|
||||||
ItemStatus = ItemStatus.None,
|
ItemStatus = ItemStatus.None,
|
||||||
|
|
||||||
Machine = machine,
|
Machine = (Machine)machine.Clone(),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Now process and add the rom
|
// Now process and add the rom
|
||||||
@@ -1900,7 +1900,7 @@ namespace SabreTools.Library.Dats
|
|||||||
Date = date,
|
Date = date,
|
||||||
Default = defaultrel,
|
Default = defaultrel,
|
||||||
|
|
||||||
Machine = machine,
|
Machine = (Machine)machine.Clone(),
|
||||||
|
|
||||||
Supported = supported,
|
Supported = supported,
|
||||||
Publisher = publisher,
|
Publisher = publisher,
|
||||||
@@ -1939,7 +1939,7 @@ namespace SabreTools.Library.Dats
|
|||||||
Description = subreader.GetAttribute("description"),
|
Description = subreader.GetAttribute("description"),
|
||||||
Default = defaultbios,
|
Default = defaultbios,
|
||||||
|
|
||||||
Machine = machine,
|
Machine = (Machine)machine.Clone(),
|
||||||
|
|
||||||
Supported = supported,
|
Supported = supported,
|
||||||
Publisher = publisher,
|
Publisher = publisher,
|
||||||
@@ -1967,7 +1967,7 @@ namespace SabreTools.Library.Dats
|
|||||||
{
|
{
|
||||||
Name = subreader.GetAttribute("name"),
|
Name = subreader.GetAttribute("name"),
|
||||||
|
|
||||||
Machine = machine,
|
Machine = (Machine)machine.Clone(),
|
||||||
|
|
||||||
Supported = supported,
|
Supported = supported,
|
||||||
Publisher = publisher,
|
Publisher = publisher,
|
||||||
@@ -1995,7 +1995,7 @@ namespace SabreTools.Library.Dats
|
|||||||
{
|
{
|
||||||
Name = subreader.GetAttribute("name"),
|
Name = subreader.GetAttribute("name"),
|
||||||
|
|
||||||
Machine = machine,
|
Machine = (Machine)machine.Clone(),
|
||||||
|
|
||||||
Supported = supported,
|
Supported = supported,
|
||||||
Publisher = publisher,
|
Publisher = publisher,
|
||||||
@@ -2104,7 +2104,7 @@ namespace SabreTools.Library.Dats
|
|||||||
MergeTag = merge,
|
MergeTag = merge,
|
||||||
ItemStatus = its,
|
ItemStatus = its,
|
||||||
|
|
||||||
Machine = machine,
|
Machine = (Machine)machine.Clone(),
|
||||||
|
|
||||||
Supported = supported,
|
Supported = supported,
|
||||||
Publisher = publisher,
|
Publisher = publisher,
|
||||||
@@ -2136,7 +2136,7 @@ namespace SabreTools.Library.Dats
|
|||||||
MergeTag = merge,
|
MergeTag = merge,
|
||||||
Date = date,
|
Date = date,
|
||||||
|
|
||||||
Machine = machine,
|
Machine = (Machine)machine.Clone(),
|
||||||
|
|
||||||
Supported = supported,
|
Supported = supported,
|
||||||
Publisher = publisher,
|
Publisher = publisher,
|
||||||
|
|||||||
Reference in New Issue
Block a user