using System; using System.Collections.Generic; using Jellyfin.Extensions; namespace Emby.Naming.Video { /// /// Object holding list of files paths with additional information. /// public class FileStack { /// /// Initializes a new instance of the class. /// /// The stack name. /// Whether the stack files are directories. /// The stack files. public FileStack(string name, bool isDirectory, IReadOnlyList files) { Name = name; IsDirectoryStack = isDirectory; Files = files; } /// /// Gets the name of file stack. /// public string Name { get; } /// /// Gets the list of paths in stack. /// public IReadOnlyList Files { get; } /// /// Gets a value indicating whether stack is directory stack. /// public bool IsDirectoryStack { get; } /// /// Helper function to determine if path is in the stack. /// /// Path of desired file. /// Requested type of stack. /// True if file is in the stack. public bool ContainsFile(string file, bool isDirectory) { if (string.IsNullOrEmpty(file)) { return false; } return IsDirectoryStack == isDirectory && Files.Contains(file, StringComparison.OrdinalIgnoreCase); } } }