aboutsummaryrefslogtreecommitdiff
path: root/BDInfo/BDROM.cs
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2016-12-28 16:13:12 -0500
committerGitHub <noreply@github.com>2016-12-28 16:13:12 -0500
commit2cb0f3eed635bb468b3672d08dca9a720b4fb48f (patch)
tree1a0d7c53ec148619ae966a81187413a33ca9a8a4 /BDInfo/BDROM.cs
parente47ccdce4247b93faa6d27849b255aac83324c42 (diff)
parentc10b152018967ddafe72efbccfe8ca6c586cbf04 (diff)
Merge pull request #2372 from MediaBrowser/beta
Beta
Diffstat (limited to 'BDInfo/BDROM.cs')
-rw-r--r--BDInfo/BDROM.cs24
1 files changed, 21 insertions, 3 deletions
diff --git a/BDInfo/BDROM.cs b/BDInfo/BDROM.cs
index 97dbfbf3b..2faeb405e 100644
--- a/BDInfo/BDROM.cs
+++ b/BDInfo/BDROM.cs
@@ -77,6 +77,11 @@ namespace BDInfo
public BDROM(
string path, IFileSystem fileSystem, ITextEncoding textEncoding)
{
+ if (string.IsNullOrWhiteSpace(path))
+ {
+ throw new ArgumentNullException("path");
+ }
+
_fileSystem = fileSystem;
//
// Locate BDMV directories.
@@ -326,15 +331,28 @@ namespace BDInfo
private FileSystemMetadata GetDirectoryBDMV(
string path)
{
+ if (string.IsNullOrWhiteSpace(path))
+ {
+ throw new ArgumentNullException("path");
+ }
+
FileSystemMetadata dir = _fileSystem.GetDirectoryInfo(path);
while (dir != null)
{
- if (dir.Name == "BDMV")
+ if (string.Equals(dir.Name, "BDMV", StringComparison.OrdinalIgnoreCase))
{
return dir;
}
- dir = _fileSystem.GetDirectoryInfo(Path.GetDirectoryName(dir.FullName));
+ var parentFolder = Path.GetDirectoryName(dir.FullName);
+ if (string.IsNullOrEmpty(parentFolder))
+ {
+ dir = null;
+ }
+ else
+ {
+ dir = _fileSystem.GetDirectoryInfo(parentFolder);
+ }
}
return GetDirectory("BDMV", _fileSystem.GetDirectoryInfo(path), 0);
@@ -350,7 +368,7 @@ namespace BDInfo
FileSystemMetadata[] children = _fileSystem.GetDirectories(dir.FullName).ToArray();
foreach (FileSystemMetadata child in children)
{
- if (child.Name == name)
+ if (string.Equals(child.Name, name, StringComparison.OrdinalIgnoreCase))
{
return child;
}