Skip to content

Commit

Permalink
Distinct target RIDs.
Browse files Browse the repository at this point in the history
  • Loading branch information
wasabii committed Dec 19, 2023
1 parent 800caf5 commit 0f21751
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,21 +122,18 @@ static bool IsImport(string rid, string importRid)
/// <returns></returns>
public override bool Execute()
{
MatchCompatibleItems(TargetRuntimeIdentifiers.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries));
MatchCompatibleItems(TargetRuntimeIdentifiers.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries).Distinct());
return true;
}

/// <summary>
/// For each group of items defined by the GroupKey, append metadata
/// </summary>
/// <param name="targetRids"></param>
/// <exception cref="NotImplementedException"></exception>
void MatchCompatibleItems(ICollection<string> targetRids)
void MatchCompatibleItems(IEnumerable<string> targetRids)
{
if (targetRids is null)
throw new ArgumentNullException(nameof(targetRids));
if (targetRids.Count == 0)
throw new ArgumentOutOfRangeException(nameof(targetRids));

// group items and match group
foreach (var group in Items.GroupBy(i => GroupKeyMetadataName != null ? (i.GetMetadata(GroupKeyMetadataName) ?? "") : ""))
Expand Down

0 comments on commit 0f21751

Please sign in to comment.