mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Simplify conditional source update
This commit is contained in:
@@ -170,7 +170,6 @@ namespace SabreTools.DatItems
|
|||||||
/// <param name="item">Existing item to copy information from</param>
|
/// <param name="item">Existing item to copy information from</param>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// The cases when Source data is updated:
|
/// The cases when Source data is updated:
|
||||||
/// - Current source data is missing and the other item has a source
|
|
||||||
/// - Current source data has an index higher than the other item
|
/// - Current source data has an index higher than the other item
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public void ConditionalUpdateSource(DatItem item)
|
public void ConditionalUpdateSource(DatItem item)
|
||||||
@@ -179,19 +178,6 @@ namespace SabreTools.DatItems
|
|||||||
Source? selfSource = GetFieldValue<Source?>(DatItem.SourceKey);
|
Source? selfSource = GetFieldValue<Source?>(DatItem.SourceKey);
|
||||||
Source? itemSource = item.GetFieldValue<Source?>(DatItem.SourceKey);
|
Source? itemSource = item.GetFieldValue<Source?>(DatItem.SourceKey);
|
||||||
|
|
||||||
// If both sources are missing, do nothing
|
|
||||||
if (selfSource == null && itemSource == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Use the new source if missing
|
|
||||||
if (selfSource == null && itemSource != null)
|
|
||||||
{
|
|
||||||
SetFieldValue<Source?>(DatItem.SourceKey, itemSource.Clone() as Source);
|
|
||||||
CopyMachineInformation(item);
|
|
||||||
SetName(item.GetName());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If either source is missing
|
// If either source is missing
|
||||||
if (selfSource == null || itemSource == null)
|
if (selfSource == null || itemSource == null)
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user