Enable nullable reference types for Emby.Dlna
This commit is contained in:
parent
a3c9edde34
commit
06caee28b7
|
@ -1,3 +1,5 @@
|
|||
#nullable disable
|
||||
|
||||
#pragma warning disable CS1591
|
||||
|
||||
namespace Emby.Dlna.Configuration
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#nullable enable
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using Emby.Dlna.Configuration;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable disable
|
||||
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable disable
|
||||
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System.IO;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable disable
|
||||
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable disable
|
||||
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace Emby.Dlna.Didl
|
|||
{
|
||||
public class StringWriterWithEncoding : StringWriter
|
||||
{
|
||||
private readonly Encoding _encoding;
|
||||
private readonly Encoding? _encoding;
|
||||
|
||||
public StringWriterWithEncoding()
|
||||
{
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#nullable enable
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable disable
|
||||
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Code Analyzers-->
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable disable
|
||||
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable disable
|
||||
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable disable
|
||||
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable disable
|
||||
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable disable
|
||||
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable disable
|
||||
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable disable
|
||||
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable disable
|
||||
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable disable
|
||||
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable disable
|
||||
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable disable
|
||||
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable disable
|
||||
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable disable
|
||||
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using MediaBrowser.Model.Dlna;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable disable
|
||||
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System.IO;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable disable
|
||||
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace Emby.Dlna.PlayTo
|
|||
{
|
||||
var serviceAction = new ServiceAction
|
||||
{
|
||||
Name = container.GetValue(UPnpNamespaces.Svc + "name"),
|
||||
Name = container.GetValue(UPnpNamespaces.Svc + "name") ?? string.Empty,
|
||||
};
|
||||
|
||||
var argumentList = serviceAction.ArgumentList;
|
||||
|
@ -68,9 +68,9 @@ namespace Emby.Dlna.PlayTo
|
|||
|
||||
return new Argument
|
||||
{
|
||||
Name = container.GetValue(UPnpNamespaces.Svc + "name"),
|
||||
Direction = container.GetValue(UPnpNamespaces.Svc + "direction"),
|
||||
RelatedStateVariable = container.GetValue(UPnpNamespaces.Svc + "relatedStateVariable")
|
||||
Name = container.GetValue(UPnpNamespaces.Svc + "name") ?? string.Empty,
|
||||
Direction = container.GetValue(UPnpNamespaces.Svc + "direction") ?? string.Empty,
|
||||
RelatedStateVariable = container.GetValue(UPnpNamespaces.Svc + "relatedStateVariable") ?? string.Empty
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -89,8 +89,8 @@ namespace Emby.Dlna.PlayTo
|
|||
|
||||
return new StateVariable
|
||||
{
|
||||
Name = container.GetValue(UPnpNamespaces.Svc + "name"),
|
||||
DataType = container.GetValue(UPnpNamespaces.Svc + "dataType"),
|
||||
Name = container.GetValue(UPnpNamespaces.Svc + "name") ?? string.Empty,
|
||||
DataType = container.GetValue(UPnpNamespaces.Svc + "dataType") ?? string.Empty,
|
||||
AllowedValues = allowedValues
|
||||
};
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ namespace Emby.Dlna.PlayTo
|
|||
return string.Format(CultureInfo.InvariantCulture, CommandBase, action.Name, xmlNamesapce, stateString);
|
||||
}
|
||||
|
||||
private string BuildArgumentXml(Argument argument, string value, string commandParameter = "")
|
||||
private string BuildArgumentXml(Argument argument, string? value, string commandParameter = "")
|
||||
{
|
||||
var state = StateVariables.FirstOrDefault(a => string.Equals(a.Name, argument.RelatedStateVariable, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable disable
|
||||
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
|
|
|
@ -250,7 +250,8 @@ namespace Emby.Dlna.Server
|
|||
|
||||
url = _serverAddress.TrimEnd('/') + "/dlna/" + _serverUdn + "/" + url.TrimStart('/');
|
||||
|
||||
return SecurityElement.Escape(url);
|
||||
// TODO: @bond remove null-coalescing operator when https://github.com/dotnet/runtime/pull/52442 is merged/released
|
||||
return SecurityElement.Escape(url) ?? string.Empty;
|
||||
}
|
||||
|
||||
private IEnumerable<DeviceIcon> GetIcons()
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace Emby.Dlna.Service
|
|||
|
||||
private async Task<ControlResponse> ProcessControlRequestInternalAsync(ControlRequest request)
|
||||
{
|
||||
ControlRequestInfo requestInfo = null;
|
||||
ControlRequestInfo? requestInfo = null;
|
||||
|
||||
using (var streamReader = new StreamReader(request.InputXml, Encoding.UTF8))
|
||||
{
|
||||
|
@ -151,7 +151,7 @@ namespace Emby.Dlna.Service
|
|||
|
||||
private async Task<ControlRequestInfo> ParseBodyTagAsync(XmlReader reader)
|
||||
{
|
||||
string namespaceURI = null, localName = null;
|
||||
string? namespaceURI = null, localName = null;
|
||||
|
||||
await reader.MoveToContentAsync().ConfigureAwait(false);
|
||||
await reader.ReadAsync().ConfigureAwait(false);
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable disable
|
||||
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
|
|
|
@ -7,21 +7,21 @@ namespace Emby.Dlna.Ssdp
|
|||
{
|
||||
public static class SsdpExtensions
|
||||
{
|
||||
public static string GetValue(this XElement container, XName name)
|
||||
public static string? GetValue(this XElement container, XName name)
|
||||
{
|
||||
var node = container.Element(name);
|
||||
|
||||
return node?.Value;
|
||||
}
|
||||
|
||||
public static string GetAttributeValue(this XElement container, XName name)
|
||||
public static string? GetAttributeValue(this XElement container, XName name)
|
||||
{
|
||||
var node = container.Attribute(name);
|
||||
|
||||
return node?.Value;
|
||||
}
|
||||
|
||||
public static string GetDescendantValue(this XElement container, XName name)
|
||||
public static string? GetDescendantValue(this XElement container, XName name)
|
||||
=> container.Descendants(name).FirstOrDefault()?.Value;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user