//
// Copyright (c) PlaceholderCompany. All rights reserved.
//
namespace Emby.Naming.Video
{
using System;
using System.Collections.Generic;
using Jellyfin.Extensions;
///
/// 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 this.FileStack(string name, bool isDirectory, IReadOnlyList files)
{
this.Name = name;
this.IsDirectoryStack = isDirectory;
this.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 this.ContainsFile(string file, bool isDirectory)
{
if (string.IsNullOrEmpty(file))
{
return false;
}
return IsDirectoryStack == isDirectory && Files.Contains(file, StringComparison.OrdinalIgnoreCase);
}
}
}