From e78fa8c3ef0e1af49afae6ffec2439e1e2fc24a5 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Sun, 11 Apr 2021 13:29:00 -0400 Subject: Merge pull request #5416 from BaronGreenback/SubnetOverlappFix (cherry picked from commit 19e7ebb27927737ab38499be1f66621cf14f6698) Signed-off-by: Joshua M. Boniface --- MediaBrowser.Common/Net/NetworkExtensions.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'MediaBrowser.Common/Net/NetworkExtensions.cs') diff --git a/MediaBrowser.Common/Net/NetworkExtensions.cs b/MediaBrowser.Common/Net/NetworkExtensions.cs index d07bba249..0a4b003eb 100644 --- a/MediaBrowser.Common/Net/NetworkExtensions.cs +++ b/MediaBrowser.Common/Net/NetworkExtensions.cs @@ -32,9 +32,11 @@ namespace MediaBrowser.Common.Net /// /// The . /// Item to add. - public static void AddItem(this Collection source, IPObject item) + /// If true the values are treated as subnets. + /// If false items are addresses. + public static void AddItem(this Collection source, IPObject item, bool itemsAreNetworks = true) { - if (!source.ContainsAddress(item)) + if (!source.ContainsAddress(item) || !itemsAreNetworks) { source.Add(item); } @@ -195,8 +197,9 @@ namespace MediaBrowser.Common.Net /// /// The . /// Items to exclude. + /// Collection is a network collection. /// A new collection, with the items excluded. - public static Collection Exclude(this Collection source, Collection excludeList) + public static Collection Exclude(this Collection source, Collection excludeList, bool isNetwork) { if (source.Count == 0 || excludeList == null) { @@ -221,7 +224,7 @@ namespace MediaBrowser.Common.Net if (!found) { - results.AddItem(outer); + results.AddItem(outer, isNetwork); } } -- cgit v1.2.3