diff options
| author | Joshua M. Boniface <joshua@boniface.me> | 2021-04-11 13:29:00 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-11 13:29:00 -0400 |
| commit | 19e7ebb27927737ab38499be1f66621cf14f6698 (patch) | |
| tree | 6dc3b4503ebbae1f47e0df58a62b43c2dadabe5f /MediaBrowser.Common | |
| parent | cd0daa7985c17bef28f8dc109686271045c18794 (diff) | |
| parent | 4c7680e186ec76053f6d54e29e5cd67c5a0b17f7 (diff) | |
Merge pull request #5416 from BaronGreenback/SubnetOverlappFix
Diffstat (limited to 'MediaBrowser.Common')
| -rw-r--r-- | MediaBrowser.Common/Net/NetworkExtensions.cs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/MediaBrowser.Common/Net/NetworkExtensions.cs b/MediaBrowser.Common/Net/NetworkExtensions.cs index 9c1a0cf49..93cfb4817 100644 --- a/MediaBrowser.Common/Net/NetworkExtensions.cs +++ b/MediaBrowser.Common/Net/NetworkExtensions.cs @@ -27,9 +27,11 @@ namespace MediaBrowser.Common.Net /// </summary> /// <param name="source">The <see cref="Collection{IPObject}"/>.</param> /// <param name="item">Item to add.</param> - public static void AddItem(this Collection<IPObject> source, IPObject item) + /// <param name="itemsAreNetworks">If <c>true</c> the values are treated as subnets. + /// If <b>false</b> items are addresses.</param> + public static void AddItem(this Collection<IPObject> source, IPObject item, bool itemsAreNetworks = true) { - if (!source.ContainsAddress(item)) + if (!source.ContainsAddress(item) || !itemsAreNetworks) { source.Add(item); } @@ -190,8 +192,9 @@ namespace MediaBrowser.Common.Net /// </summary> /// <param name="source">The <see cref="Collection{IPObject}"/>.</param> /// <param name="excludeList">Items to exclude.</param> + /// <param name="isNetwork">Collection is a network collection.</param> /// <returns>A new collection, with the items excluded.</returns> - public static Collection<IPObject> Exclude(this Collection<IPObject> source, Collection<IPObject> excludeList) + public static Collection<IPObject> Exclude(this Collection<IPObject> source, Collection<IPObject> excludeList, bool isNetwork) { if (source.Count == 0 || excludeList == null) { @@ -216,7 +219,7 @@ namespace MediaBrowser.Common.Net if (!found) { - results.AddItem(outer); + results.AddItem(outer, isNetwork); } } |
