Code review

This commit is contained in:
David 2020-08-20 17:59:27 +02:00
parent ca2b36bdb0
commit 1337a0dcec
7 changed files with 25 additions and 13 deletions

View File

@ -1,7 +1,7 @@
#pragma warning disable CS1591
#pragma warning disable CA1305
using System;
using System.Globalization;
using System.IO;
using System.Text;
@ -21,7 +21,7 @@ namespace Emby.Dlna.Didl
}
public StringWriterWithEncoding(StringBuilder sb)
: base(sb, CultureInfo.InvariantCulture)
: base(sb)
{
}
@ -42,7 +42,7 @@ namespace Emby.Dlna.Didl
}
public StringWriterWithEncoding(StringBuilder sb, Encoding encoding)
: base(sb, CultureInfo.InvariantCulture)
: base(sb)
{
_encoding = encoding;
}

View File

@ -418,6 +418,10 @@ namespace Emby.Dlna.Main
GC.SuppressFinalize(this);
}
/// <summary>
/// Releases unmanaged and optionally managed resources.
/// </summary>
/// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
protected virtual void Dispose(bool disposing)
{
if (_disposed)

View File

@ -1200,6 +1200,10 @@ namespace Emby.Dlna.PlayTo
GC.SuppressFinalize(this);
}
/// <summary>
/// Releases unmanaged and optionally managed resources.
/// </summary>
/// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
protected virtual void Dispose(bool disposing)
{
if (_disposed)

View File

@ -637,6 +637,10 @@ namespace Emby.Dlna.PlayTo
GC.SuppressFinalize(this);
}
/// <summary>
/// Releases unmanaged and optionally managed resources.
/// </summary>
/// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
protected virtual void Dispose(bool disposing)
{
if (_disposed)

View File

@ -249,7 +249,7 @@ namespace Emby.Dlna.PlayTo
}
catch (Exception ex)
{
_logger.LogDebug("Error while disposing PlayToManager", ex);
_logger.LogDebug(ex, "Error while disposing PlayToManager");
}
_sessionLock.Dispose();

View File

@ -15,7 +15,7 @@ namespace Emby.Dlna.Service
{
public abstract class BaseControlHandler
{
private const string NsSoapenv = "http://schemas.xmlsoap.org/soap/envelope/";
private const string NsSoapEnv = "http://schemas.xmlsoap.org/soap/envelope/";
protected BaseControlHandler(IServerConfigurationManager config, ILogger logger)
{
@ -80,10 +80,10 @@ namespace Emby.Dlna.Service
{
writer.WriteStartDocument(true);
writer.WriteStartElement("SOAP-ENV", "Envelope", NsSoapenv);
writer.WriteAttributeString(string.Empty, "encodingStyle", NsSoapenv, "http://schemas.xmlsoap.org/soap/encoding/");
writer.WriteStartElement("SOAP-ENV", "Envelope", NsSoapEnv);
writer.WriteAttributeString(string.Empty, "encodingStyle", NsSoapEnv, "http://schemas.xmlsoap.org/soap/encoding/");
writer.WriteStartElement("SOAP-ENV", "Body", NsSoapenv);
writer.WriteStartElement("SOAP-ENV", "Body", NsSoapEnv);
writer.WriteStartElement("u", requestInfo.LocalName + "Response", requestInfo.NamespaceURI);
WriteResult(requestInfo.LocalName, requestInfo.Headers, writer);

View File

@ -10,7 +10,7 @@ namespace Emby.Dlna.Service
{
public static class ControlErrorHandler
{
private const string NsSoapenv = "http://schemas.xmlsoap.org/soap/envelope/";
private const string NsSoapEnv = "http://schemas.xmlsoap.org/soap/envelope/";
public static ControlResponse GetResponse(Exception ex)
{
@ -26,11 +26,11 @@ namespace Emby.Dlna.Service
{
writer.WriteStartDocument(true);
writer.WriteStartElement("SOAP-ENV", "Envelope", NsSoapenv);
writer.WriteAttributeString(string.Empty, "encodingStyle", NsSoapenv, "http://schemas.xmlsoap.org/soap/encoding/");
writer.WriteStartElement("SOAP-ENV", "Envelope", NsSoapEnv);
writer.WriteAttributeString(string.Empty, "encodingStyle", NsSoapEnv, "http://schemas.xmlsoap.org/soap/encoding/");
writer.WriteStartElement("SOAP-ENV", "Body", NsSoapenv);
writer.WriteStartElement("SOAP-ENV", "Fault", NsSoapenv);
writer.WriteStartElement("SOAP-ENV", "Body", NsSoapEnv);
writer.WriteStartElement("SOAP-ENV", "Fault", NsSoapEnv);
writer.WriteElementString("faultcode", "500");
writer.WriteElementString("faultstring", ex.Message);