mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-16 10:29:01 -07:00
Merge pull request #3024 from Bond-009/listhelper
Remove ListHelper extensions
This commit is contained in:
commit
c9d0b07ab0
@ -1,8 +1,8 @@
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
using MediaBrowser.Model.Extensions;
|
||||
|
||||
namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
@ -57,7 +57,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
foreach (var val in codec)
|
||||
{
|
||||
if (ListHelper.ContainsIgnoreCase(codecs, val))
|
||||
if (codecs.Contains(val, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Globalization;
|
||||
using MediaBrowser.Model.Extensions;
|
||||
using MediaBrowser.Model.MediaInfo;
|
||||
|
||||
namespace MediaBrowser.Model.Dlna
|
||||
@ -167,9 +167,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
switch (condition.Condition)
|
||||
{
|
||||
case ProfileConditionType.EqualsAny:
|
||||
{
|
||||
return ListHelper.ContainsIgnoreCase(expected.Split('|'), currentValue);
|
||||
}
|
||||
return expected.Split('|').Contains(currentValue, StringComparer.OrdinalIgnoreCase);
|
||||
case ProfileConditionType.Equals:
|
||||
return string.Equals(currentValue, expected, StringComparison.OrdinalIgnoreCase);
|
||||
case ProfileConditionType.NotEquals:
|
||||
|
@ -1,8 +1,8 @@
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
using MediaBrowser.Model.Extensions;
|
||||
|
||||
namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
@ -45,7 +45,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
public static bool ContainsContainer(string profileContainers, string inputContainer)
|
||||
{
|
||||
var isNegativeList = false;
|
||||
if (profileContainers != null && profileContainers.StartsWith("-"))
|
||||
if (profileContainers != null && profileContainers.StartsWith("-", StringComparison.Ordinal))
|
||||
{
|
||||
isNegativeList = true;
|
||||
profileContainers = profileContainers.Substring(1);
|
||||
@ -72,7 +72,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
foreach (var container in allInputContainers)
|
||||
{
|
||||
if (ListHelper.ContainsIgnoreCase(profileContainers, container))
|
||||
if (profileContainers.Contains(container, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -86,7 +86,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
foreach (var container in allInputContainers)
|
||||
{
|
||||
if (ListHelper.ContainsIgnoreCase(profileContainers, container))
|
||||
if (profileContainers.Contains(container, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
using MediaBrowser.Model.Extensions;
|
||||
using MediaBrowser.Model.MediaInfo;
|
||||
|
||||
namespace MediaBrowser.Model.Dlna
|
||||
@ -93,14 +93,14 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
public DeviceProfile()
|
||||
{
|
||||
DirectPlayProfiles = new DirectPlayProfile[] { };
|
||||
TranscodingProfiles = new TranscodingProfile[] { };
|
||||
ResponseProfiles = new ResponseProfile[] { };
|
||||
CodecProfiles = new CodecProfile[] { };
|
||||
ContainerProfiles = new ContainerProfile[] { };
|
||||
DirectPlayProfiles = Array.Empty<DirectPlayProfile>();
|
||||
TranscodingProfiles = Array.Empty<TranscodingProfile>();
|
||||
ResponseProfiles = Array.Empty<ResponseProfile>();
|
||||
CodecProfiles = Array.Empty<CodecProfile>();
|
||||
ContainerProfiles = Array.Empty<ContainerProfile>();
|
||||
SubtitleProfiles = Array.Empty<SubtitleProfile>();
|
||||
|
||||
XmlRootAttributes = new XmlAttribute[] { };
|
||||
XmlRootAttributes = Array.Empty<XmlAttribute>();
|
||||
|
||||
SupportedMediaTypes = "Audio,Photo,Video";
|
||||
MaxStreamingBitrate = 8000000;
|
||||
@ -129,13 +129,14 @@ namespace MediaBrowser.Model.Dlna
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!ListHelper.ContainsIgnoreCase(i.GetAudioCodecs(), audioCodec ?? string.Empty))
|
||||
if (!i.GetAudioCodecs().Contains(audioCodec ?? string.Empty, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -155,7 +156,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!ListHelper.ContainsIgnoreCase(i.GetAudioCodecs(), audioCodec ?? string.Empty))
|
||||
if (!i.GetAudioCodecs().Contains(audioCodec ?? string.Empty, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -185,7 +186,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
}
|
||||
|
||||
var audioCodecs = i.GetAudioCodecs();
|
||||
if (audioCodecs.Length > 0 && !ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec ?? string.Empty))
|
||||
if (audioCodecs.Length > 0 && !audioCodecs.Contains(audioCodec ?? string.Empty, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -288,13 +289,13 @@ namespace MediaBrowser.Model.Dlna
|
||||
}
|
||||
|
||||
var audioCodecs = i.GetAudioCodecs();
|
||||
if (audioCodecs.Length > 0 && !ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec ?? string.Empty))
|
||||
if (audioCodecs.Length > 0 && !audioCodecs.Contains(audioCodec ?? string.Empty, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var videoCodecs = i.GetVideoCodecs();
|
||||
if (videoCodecs.Length > 0 && !ListHelper.ContainsIgnoreCase(videoCodecs, videoCodec ?? string.Empty))
|
||||
if (videoCodecs.Length > 0 && !videoCodecs.Contains(videoCodec ?? string.Empty, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
using MediaBrowser.Model.Extensions;
|
||||
|
||||
namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
@ -40,7 +41,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
}
|
||||
|
||||
var languages = GetLanguages();
|
||||
return languages.Length == 0 || ListHelper.ContainsIgnoreCase(languages, subLanguage);
|
||||
return languages.Length == 0 || languages.Contains(subLanguage, StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,27 +0,0 @@
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Model.Extensions
|
||||
{
|
||||
// TODO: @bond remove
|
||||
public static class ListHelper
|
||||
{
|
||||
public static bool ContainsIgnoreCase(string[] list, string value)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(value));
|
||||
}
|
||||
|
||||
foreach (var item in list)
|
||||
{
|
||||
if (string.Equals(item, value, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using MediaBrowser.Model.Extensions;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Model.Users;
|
||||
|
||||
namespace MediaBrowser.Model.Notifications
|
||||
@ -81,8 +81,12 @@ namespace MediaBrowser.Model.Notifications
|
||||
{
|
||||
foreach (NotificationOption i in Options)
|
||||
{
|
||||
if (string.Equals(type, i.Type, StringComparison.OrdinalIgnoreCase)) return i;
|
||||
if (string.Equals(type, i.Type, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -98,7 +102,7 @@ namespace MediaBrowser.Model.Notifications
|
||||
NotificationOption opt = GetOptions(notificationType);
|
||||
|
||||
return opt == null ||
|
||||
!ListHelper.ContainsIgnoreCase(opt.DisabledServices, service);
|
||||
!opt.DisabledServices.Contains(service, StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public bool IsEnabledToMonitorUser(string type, Guid userId)
|
||||
@ -106,7 +110,7 @@ namespace MediaBrowser.Model.Notifications
|
||||
NotificationOption opt = GetOptions(type);
|
||||
|
||||
return opt != null && opt.Enabled &&
|
||||
!ListHelper.ContainsIgnoreCase(opt.DisabledMonitorUsers, userId.ToString(""));
|
||||
!opt.DisabledMonitorUsers.Contains(userId.ToString(""), StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public bool IsEnabledToSendToUser(string type, string userId, UserPolicy userPolicy)
|
||||
@ -125,7 +129,7 @@ namespace MediaBrowser.Model.Notifications
|
||||
return true;
|
||||
}
|
||||
|
||||
return ListHelper.ContainsIgnoreCase(opt.SendToUsers, userId);
|
||||
return opt.SendToUsers.Contains(userId, StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user