aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2015-11-22 13:18:53 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2015-11-22 13:18:53 -0500
commit9e568bf99a7a37a4c997299c80a65ca6c3f223c9 (patch)
tree69898918f42f5c236ff356093cbbf186b2685402
parent4a24490752e16a700316bab1b3d1e95e1bc8a86a (diff)
update dlna profile header checks
-rw-r--r--MediaBrowser.Dlna/DlnaManager.cs17
1 files changed, 9 insertions, 8 deletions
diff --git a/MediaBrowser.Dlna/DlnaManager.cs b/MediaBrowser.Dlna/DlnaManager.cs
index be49c0f89..2a688fa54 100644
--- a/MediaBrowser.Dlna/DlnaManager.cs
+++ b/MediaBrowser.Dlna/DlnaManager.cs
@@ -251,7 +251,8 @@ namespace MediaBrowser.Dlna
case HeaderMatchType.Substring:
return value.IndexOf(header.Value, StringComparison.OrdinalIgnoreCase) != -1;
case HeaderMatchType.Regex:
- return Regex.IsMatch(value, header.Value, RegexOptions.IgnoreCase);
+ // Reports of IgnoreCase not working on linux so try it a couple different ways.
+ return Regex.IsMatch(value, header.Value, RegexOptions.IgnoreCase) || Regex.IsMatch(value.ToUpper(), header.Value.ToUpper(), RegexOptions.IgnoreCase);
default:
throw new ArgumentException("Unrecognized HeaderMatchType");
}
@@ -280,7 +281,7 @@ namespace MediaBrowser.Dlna
{
try
{
- return _fileSystem.GetFiles(path)
+ return _fileSystem.GetFiles(path)
.Where(i => string.Equals(i.Extension, ".xml", StringComparison.OrdinalIgnoreCase))
.Select(i => ParseProfileXmlFile(i.FullName, type))
.Where(i => i != null)
@@ -318,7 +319,7 @@ namespace MediaBrowser.Dlna
throw new ArgumentNullException("id");
}
- var info = GetProfileInfosInternal().First(i => string.Equals(i.Info.Id, id));
+ var info = GetProfileInfosInternal().First(i => string.Equals(i.Info.Id, id, StringComparison.OrdinalIgnoreCase));
return ParseProfileXmlFile(info.Path, info.Info.Type);
}
@@ -342,7 +343,7 @@ namespace MediaBrowser.Dlna
{
try
{
- return _fileSystem.GetFiles(path)
+ return _fileSystem.GetFiles(path)
.Where(i => string.Equals(i.Extension, ".xml", StringComparison.OrdinalIgnoreCase))
.Select(i => new InternalProfileInfo
{
@@ -384,7 +385,7 @@ namespace MediaBrowser.Dlna
if (!fileInfo.Exists || fileInfo.Length != stream.Length)
{
- _fileSystem.CreateDirectory(systemProfilesPath);
+ _fileSystem.CreateDirectory(systemProfilesPath);
using (var fileStream = _fileSystem.GetFileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read))
{
@@ -395,12 +396,12 @@ namespace MediaBrowser.Dlna
}
// Not necessary, but just to make it easy to find
- _fileSystem.CreateDirectory(UserProfilesPath);
+ _fileSystem.CreateDirectory(UserProfilesPath);
}
public void DeleteProfile(string id)
{
- var info = GetProfileInfosInternal().First(i => string.Equals(id, i.Info.Id));
+ var info = GetProfileInfosInternal().First(i => string.Equals(id, i.Info.Id, StringComparison.OrdinalIgnoreCase));
if (info.Info.Type == DeviceProfileType.System)
{
@@ -448,7 +449,7 @@ namespace MediaBrowser.Dlna
{
_fileSystem.DeleteFile(current.Path);
}
-
+
_xmlSerializer.SerializeToFile(profile, path);
}