|
|
@ -156,7 +156,7 @@ namespace Emby.Dlna
|
|
|
|
/// <param name="deviceInfo">The <see cref="DeviceIdentification"/> of the device.</param>
|
|
|
|
/// <param name="deviceInfo">The <see cref="DeviceIdentification"/> of the device.</param>
|
|
|
|
/// <param name="profileInfo">The <see cref="DeviceIdentification"/> of the profile.</param>
|
|
|
|
/// <param name="profileInfo">The <see cref="DeviceIdentification"/> of the profile.</param>
|
|
|
|
/// <returns><b>True</b> if they match.</returns>
|
|
|
|
/// <returns><b>True</b> if they match.</returns>
|
|
|
|
public static bool IsMatch(DeviceIdentification deviceInfo, DeviceIdentification profileInfo)
|
|
|
|
public bool IsMatch(DeviceIdentification deviceInfo, DeviceIdentification profileInfo)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return IsRegexOrSubstringMatch(deviceInfo.FriendlyName, profileInfo.FriendlyName)
|
|
|
|
return IsRegexOrSubstringMatch(deviceInfo.FriendlyName, profileInfo.FriendlyName)
|
|
|
|
&& IsRegexOrSubstringMatch(deviceInfo.Manufacturer, profileInfo.Manufacturer)
|
|
|
|
&& IsRegexOrSubstringMatch(deviceInfo.Manufacturer, profileInfo.Manufacturer)
|
|
|
@ -168,7 +168,7 @@ namespace Emby.Dlna
|
|
|
|
&& IsRegexOrSubstringMatch(deviceInfo.SerialNumber, profileInfo.SerialNumber);
|
|
|
|
&& IsRegexOrSubstringMatch(deviceInfo.SerialNumber, profileInfo.SerialNumber);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static bool IsRegexOrSubstringMatch(string input, string pattern)
|
|
|
|
private bool IsRegexOrSubstringMatch(string input, string pattern)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (string.IsNullOrEmpty(pattern))
|
|
|
|
if (string.IsNullOrEmpty(pattern))
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -182,16 +182,9 @@ namespace Emby.Dlna
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return input.Equals(pattern, StringComparison.OrdinalIgnoreCase)
|
|
|
|
return input.Equals(pattern, StringComparison.OrdinalIgnoreCase)
|
|
|
|
|| Regex.IsMatch(input, pattern, RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
|
|
|
|| Regex.IsMatch(input, pattern, RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (ArgumentException ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw new ArgumentException("Error evaluating regex pattern " + pattern, ex);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public DeviceProfile GetProfile(IHeaderDictionary headers)
|
|
|
|
public DeviceProfile GetProfile(IHeaderDictionary headers)
|
|
|
|
{
|
|
|
|
{
|
|
|
|