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