jellyfin/Emby.Naming/Video/FileStack.cs

52 lines
1.5 KiB
C#
Raw Normal View History

using System;
2018-09-12 13:26:21 -04:00
using System.Collections.Generic;
using System.Linq;
namespace Emby.Naming.Video
{
2020-11-10 13:23:10 -05:00
/// <summary>
/// Object holding list of files paths with additional information.
/// </summary>
2018-09-12 13:26:21 -04:00
public class FileStack
{
2020-11-10 13:23:10 -05:00
/// <summary>
/// Initializes a new instance of the <see cref="FileStack"/> class.
/// </summary>
2018-09-12 13:26:21 -04:00
public FileStack()
{
Files = new List<string>();
}
2020-11-10 13:23:10 -05:00
/// <summary>
/// Gets or sets name of file stack.
/// </summary>
2020-11-01 04:47:31 -05:00
public string Name { get; set; } = string.Empty;
2020-11-10 13:23:10 -05:00
/// <summary>
/// Gets or sets list of paths in stack.
/// </summary>
public List<string> Files { get; set; }
2020-11-10 13:23:10 -05:00
/// <summary>
/// Gets or sets a value indicating whether stack is directory stack.
/// </summary>
public bool IsDirectoryStack { get; set; }
2020-11-10 13:23:10 -05:00
/// <summary>
/// Helper function to determine if path is in the stack.
/// </summary>
/// <param name="file">Path of desired file.</param>
/// <param name="isDirectory">Requested type of stack.</param>
/// <returns>True if file is in the stack.</returns>
2019-05-10 14:37:42 -04:00
public bool ContainsFile(string file, bool isDirectory)
2018-09-12 13:26:21 -04:00
{
2019-05-10 14:37:42 -04:00
if (IsDirectoryStack == isDirectory)
2018-09-12 13:26:21 -04:00
{
return Files.Contains(file, StringComparer.OrdinalIgnoreCase);
}
return false;
}
}
}