diff options
| author | Cody Robibero <cody@robibe.ro> | 2021-12-17 07:51:32 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-17 07:51:32 -0700 |
| commit | 923720c988ce62ce5c57337252cf981ceeef9a23 (patch) | |
| tree | 1d300f11103f6dca0c922e9e6490e29a8bcff1b5 /Emby.Naming/Video/FileStack.cs | |
| parent | 16bf4a013b4e5eb937bf370eb595437f109412a4 (diff) | |
| parent | 9a0618552b87241537590e77c70cfdbac2b0b8ce (diff) | |
Merge pull request #6956 from cvium/what_could_go_wrong
Diffstat (limited to 'Emby.Naming/Video/FileStack.cs')
| -rw-r--r-- | Emby.Naming/Video/FileStack.cs | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/Emby.Naming/Video/FileStack.cs b/Emby.Naming/Video/FileStack.cs index 6519db57c..bd635a9f7 100644 --- a/Emby.Naming/Video/FileStack.cs +++ b/Emby.Naming/Video/FileStack.cs @@ -12,25 +12,30 @@ namespace Emby.Naming.Video /// <summary> /// Initializes a new instance of the <see cref="FileStack"/> class. /// </summary> - public FileStack() + /// <param name="name">The stack name.</param> + /// <param name="isDirectory">Whether the stack files are directories.</param> + /// <param name="files">The stack files.</param> + public FileStack(string name, bool isDirectory, IReadOnlyList<string> files) { - Files = new List<string>(); + Name = name; + IsDirectoryStack = isDirectory; + Files = files; } /// <summary> - /// Gets or sets name of file stack. + /// Gets the name of file stack. /// </summary> - public string Name { get; set; } = string.Empty; + public string Name { get; } /// <summary> - /// Gets or sets list of paths in stack. + /// Gets the list of paths in stack. /// </summary> - public List<string> Files { get; set; } + public IReadOnlyList<string> Files { get; } /// <summary> - /// Gets or sets a value indicating whether stack is directory stack. + /// Gets a value indicating whether stack is directory stack. /// </summary> - public bool IsDirectoryStack { get; set; } + public bool IsDirectoryStack { get; } /// <summary> /// Helper function to determine if path is in the stack. @@ -40,12 +45,12 @@ namespace Emby.Naming.Video /// <returns>True if file is in the stack.</returns> public bool ContainsFile(string file, bool isDirectory) { - if (IsDirectoryStack == isDirectory) + if (string.IsNullOrEmpty(file)) { - return Files.Contains(file, StringComparer.OrdinalIgnoreCase); + return false; } - return false; + return IsDirectoryStack == isDirectory && Files.Contains(file, StringComparer.OrdinalIgnoreCase); } } } |
