mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-09-23 07:14:57 +00:00
Further reduce use of GetName and SetName
This commit is contained in:
@@ -15,6 +15,7 @@ namespace SabreTools.Data.Extensions
|
||||
/// <summary>
|
||||
/// Gets the name to use for a DictionaryBase or null
|
||||
/// </summary>
|
||||
/// TODO: Determine if this can be removed
|
||||
public static string? GetName(this DictionaryBase self)
|
||||
{
|
||||
if (self is null)
|
||||
@@ -75,6 +76,7 @@ namespace SabreTools.Data.Extensions
|
||||
/// <summary>
|
||||
/// Gets the name to use for a DictionaryBase or null
|
||||
/// </summary>
|
||||
/// TODO: Determine if this can be removed
|
||||
public static void SetName(this DictionaryBase self, string? name)
|
||||
{
|
||||
if (self is null || string.IsNullOrEmpty(name))
|
||||
@@ -211,6 +213,8 @@ namespace SabreTools.Data.Extensions
|
||||
return releaseDetails.Clone() as ReleaseDetails;
|
||||
else if (self is Rom rom)
|
||||
return rom.Clone() as Rom;
|
||||
else if (self is Sample sample)
|
||||
return sample.Clone() as Sample;
|
||||
else if (self is Serials serials)
|
||||
return serials.Clone() as Serials;
|
||||
else if (self is SharedFeat sharedFeat)
|
||||
@@ -300,6 +304,7 @@ namespace SabreTools.Data.Extensions
|
||||
cloneMachine.Language = selfMachine.Language;
|
||||
cloneMachine.Location = selfMachine.Location;
|
||||
cloneMachine.Manufacturer = selfMachine.Manufacturer;
|
||||
cloneMachine.Name = selfMachine.Name;
|
||||
cloneMachine.Notes = selfMachine.Notes;
|
||||
cloneMachine.PlayedCount = selfMachine.PlayedCount;
|
||||
cloneMachine.PlayedTime = selfMachine.PlayedTime;
|
||||
@@ -322,9 +327,6 @@ namespace SabreTools.Data.Extensions
|
||||
cloneMachine.Year = selfMachine.Year;
|
||||
}
|
||||
|
||||
// Handle known properties
|
||||
clone.SetName(self.GetName());
|
||||
|
||||
// Loop through and clone per type
|
||||
foreach (string key in self.Keys)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user