Close xmlwriter first

This commit is contained in:
Bond-009 2020-01-29 17:30:27 +01:00
parent 6ee04855cd
commit d69870680b

View File

@ -257,6 +257,8 @@ namespace Emby.Dlna.ContentDirectory
int totalCount;
using (StringWriter builder = new StringWriterWithEncoding(Encoding.UTF8))
{
var settings = new XmlWriterSettings()
{
Encoding = Encoding.UTF8,
@ -265,7 +267,6 @@ namespace Emby.Dlna.ContentDirectory
ConformanceLevel = ConformanceLevel.Fragment
};
using (StringWriter builder = new StringWriterWithEncoding(Encoding.UTF8))
using (var writer = XmlWriter.Create(builder, settings))
{
writer.WriteStartElement(string.Empty, "DIDL-Lite", NS_DIDL);
@ -326,6 +327,7 @@ namespace Emby.Dlna.ContentDirectory
}
writer.WriteFullEndElement();
}
xmlWriter.WriteElementString("Result", builder.ToString());
}
@ -366,6 +368,8 @@ namespace Emby.Dlna.ContentDirectory
QueryResult<BaseItem> childrenResult;
using (StringWriter builder = new StringWriterWithEncoding(Encoding.UTF8))
{
var settings = new XmlWriterSettings()
{
Encoding = Encoding.UTF8,
@ -374,7 +378,6 @@ namespace Emby.Dlna.ContentDirectory
ConformanceLevel = ConformanceLevel.Fragment
};
using (StringWriter builder = new StringWriterWithEncoding(Encoding.UTF8))
using (var writer = XmlWriter.Create(builder, settings))
{
writer.WriteStartElement(string.Empty, "DIDL-Lite", NS_DIDL);
@ -409,6 +412,7 @@ namespace Emby.Dlna.ContentDirectory
}
writer.WriteFullEndElement();
}
xmlWriter.WriteElementString("Result", builder.ToString());
}