mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-01 13:28:27 +01:00
Enable nullabe reference types for MediaBrowser.Model
This commit is contained in:
@@ -5,6 +5,7 @@ namespace MediaBrowser.Model.Net
|
||||
public class EndPointInfo
|
||||
{
|
||||
public bool IsLocal { get; set; }
|
||||
|
||||
public bool IsInNetwork { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace MediaBrowser.Model.Net
|
||||
Task<SocketReceiveResult> ReceiveAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken);
|
||||
|
||||
IAsyncResult BeginReceive(byte[] buffer, int offset, int count, AsyncCallback callback);
|
||||
|
||||
SocketReceiveResult EndReceive(IAsyncResult result);
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -8,12 +8,12 @@ using System.Linq;
|
||||
namespace MediaBrowser.Model.Net
|
||||
{
|
||||
/// <summary>
|
||||
/// Class MimeTypes
|
||||
/// Class MimeTypes.
|
||||
/// </summary>
|
||||
public static class MimeTypes
|
||||
{
|
||||
/// <summary>
|
||||
/// Any extension in this list is considered a video file
|
||||
/// Any extension in this list is considered a video file.
|
||||
/// </summary>
|
||||
private static readonly HashSet<string> _videoFileExtensions = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
@@ -141,16 +141,16 @@ namespace MediaBrowser.Model.Net
|
||||
return dict;
|
||||
}
|
||||
|
||||
public static string GetMimeType(string path) => GetMimeType(path, true);
|
||||
public static string? GetMimeType(string path) => GetMimeType(path, true);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type of the MIME.
|
||||
/// </summary>
|
||||
public static string GetMimeType(string path, bool enableStreamDefault)
|
||||
public static string? GetMimeType(string path, bool enableStreamDefault)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
if (path.Length == 0)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(path));
|
||||
throw new ArgumentException("String can't be empty.", nameof(path));
|
||||
}
|
||||
|
||||
var ext = Path.GetExtension(path);
|
||||
@@ -188,11 +188,11 @@ namespace MediaBrowser.Model.Net
|
||||
return enableStreamDefault ? "application/octet-stream" : null;
|
||||
}
|
||||
|
||||
public static string ToExtension(string mimeType)
|
||||
public static string? ToExtension(string mimeType)
|
||||
{
|
||||
if (string.IsNullOrEmpty(mimeType))
|
||||
if (mimeType.Length == 0)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(mimeType));
|
||||
throw new ArgumentException("String can't be empty.", nameof(mimeType));
|
||||
}
|
||||
|
||||
// handle text/html; charset=UTF-8
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable disable
|
||||
#pragma warning disable CS1591
|
||||
|
||||
namespace MediaBrowser.Model.Net
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pragma warning disable CS1591
|
||||
#nullable disable
|
||||
|
||||
using System.Net;
|
||||
|
||||
@@ -10,12 +10,12 @@ namespace MediaBrowser.Model.Net
|
||||
public sealed class SocketReceiveResult
|
||||
{
|
||||
/// <summary>
|
||||
/// The buffer to place received data into.
|
||||
/// Gets or sets the buffer to place received data into.
|
||||
/// </summary>
|
||||
public byte[] Buffer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The number of bytes received.
|
||||
/// Gets or sets the number of bytes received.
|
||||
/// </summary>
|
||||
public int ReceivedBytes { get; set; }
|
||||
|
||||
@@ -23,6 +23,10 @@ namespace MediaBrowser.Model.Net
|
||||
/// The <see cref="IPEndPoint"/> the data was received from.
|
||||
/// </summary>
|
||||
public IPEndPoint RemoteEndPoint { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The local <see cref="IPAddress"/>.
|
||||
/// </summary>
|
||||
public IPAddress LocalIPAddress { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable disable
|
||||
#pragma warning disable CS1591
|
||||
|
||||
namespace MediaBrowser.Model.Net
|
||||
|
||||
Reference in New Issue
Block a user