You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jellyfin/MediaBrowser.Model/Dlna/ContainerProfile.cs

50 lines
1.7 KiB

5 months ago
#pragma warning disable CA1819 // Properties should not return arrays
using System;
5 months ago
using System.Collections.Generic;
6 years ago
using System.Xml.Serialization;
5 months ago
using MediaBrowser.Model.Extensions;
6 years ago
5 months ago
namespace MediaBrowser.Model.Dlna;
/// <summary>
/// Defines the <see cref="ContainerProfile"/>.
/// </summary>
public class ContainerProfile
6 years ago
{
5 months ago
/// <summary>
/// Gets or sets the <see cref="DlnaProfileType"/> which this container must meet.
/// </summary>
[XmlAttribute("type")]
public DlnaProfileType Type { get; set; }
/// <summary>
/// Gets or sets the list of <see cref="ProfileCondition"/> which this container will be applied to.
/// </summary>
public ProfileCondition[] Conditions { get; set; } = [];
/// <summary>
/// Gets or sets the container(s) which this container must meet.
/// </summary>
[XmlAttribute("container")]
public string? Container { get; set; }
/// <summary>
/// Gets or sets the sub container(s) which this container must meet.
/// </summary>
[XmlAttribute("subcontainer")]
public string? SubContainer { get; set; }
/// <summary>
/// Returns true if an item in <paramref name="container"/> appears in the <see cref="Container"/> property.
/// </summary>
/// <param name="container">The item to match.</param>
/// <param name="useSubContainer">Consider subcontainers.</param>
/// <returns>The result of the operation.</returns>
public bool ContainsContainer(ReadOnlySpan<char> container, bool useSubContainer = false)
6 years ago
{
5 months ago
var containerToCheck = useSubContainer && string.Equals(Container, "hls", StringComparison.OrdinalIgnoreCase) ? SubContainer : Container;
return ContainerHelper.ContainsContainer(containerToCheck, container);
6 years ago
}
}