Enable nullabe reference types for MediaBrowser.Model

pull/2767/head
Bond_009 4 years ago
parent 29539174a3
commit 30ce346f34

@ -100,15 +100,13 @@ namespace Emby.Dlna.Ssdp
var headers = headerDict.ToDictionary(i => i.Key, i => i.Value.Value.FirstOrDefault(), StringComparer.OrdinalIgnoreCase); var headers = headerDict.ToDictionary(i => i.Key, i => i.Value.Value.FirstOrDefault(), StringComparer.OrdinalIgnoreCase);
var args = new GenericEventArgs<UpnpDeviceInfo> var args = new GenericEventArgs<UpnpDeviceInfo>(
{ new UpnpDeviceInfo
Argument = new UpnpDeviceInfo
{ {
Location = e.DiscoveredDevice.DescriptionLocation, Location = e.DiscoveredDevice.DescriptionLocation,
Headers = headers, Headers = headers,
LocalIpAddress = e.LocalIpAddress LocalIpAddress = e.LocalIpAddress
} });
};
DeviceDiscoveredInternal?.Invoke(this, args); DeviceDiscoveredInternal?.Invoke(this, args);
} }
@ -121,14 +119,12 @@ namespace Emby.Dlna.Ssdp
var headers = headerDict.ToDictionary(i => i.Key, i => i.Value.Value.FirstOrDefault(), StringComparer.OrdinalIgnoreCase); var headers = headerDict.ToDictionary(i => i.Key, i => i.Value.Value.FirstOrDefault(), StringComparer.OrdinalIgnoreCase);
var args = new GenericEventArgs<UpnpDeviceInfo> var args = new GenericEventArgs<UpnpDeviceInfo>(
{ new UpnpDeviceInfo
Argument = new UpnpDeviceInfo
{ {
Location = e.DiscoveredDevice.DescriptionLocation, Location = e.DiscoveredDevice.DescriptionLocation,
Headers = headers Headers = headers
} });
};
DeviceLeft?.Invoke(this, args); DeviceLeft?.Invoke(this, args);
} }

@ -91,7 +91,7 @@ namespace Emby.Server.Implementations.Configuration
ValidateMetadataPath(newConfig); ValidateMetadataPath(newConfig);
ValidateSslCertificate(newConfig); ValidateSslCertificate(newConfig);
ConfigurationUpdating?.Invoke(this, new GenericEventArgs<ServerConfiguration> { Argument = newConfig }); ConfigurationUpdating?.Invoke(this, new GenericEventArgs<ServerConfiguration>(newConfig));
base.ReplaceConfiguration(newConfiguration); base.ReplaceConfiguration(newConfiguration);
} }

@ -1,3 +1,5 @@
#nullable enable
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Security.Cryptography; using System.Security.Cryptography;
@ -134,8 +136,6 @@ namespace Emby.Server.Implementations.Cryptography
_randomNumberGenerator.Dispose(); _randomNumberGenerator.Dispose();
} }
_randomNumberGenerator = null;
_disposed = true; _disposed = true;
} }
} }

@ -86,13 +86,7 @@ namespace Emby.Server.Implementations.Devices
{ {
_authRepo.UpdateDeviceOptions(deviceId, options); _authRepo.UpdateDeviceOptions(deviceId, options);
if (DeviceOptionsUpdated != null) DeviceOptionsUpdated?.Invoke(this, new GenericEventArgs<Tuple<string, DeviceOptions>>(new Tuple<string, DeviceOptions>(deviceId, options)));
{
DeviceOptionsUpdated(this, new GenericEventArgs<Tuple<string, DeviceOptions>>()
{
Argument = new Tuple<string, DeviceOptions>(deviceId, options)
});
}
} }
public DeviceOptions GetDeviceOptions(string deviceId) public DeviceOptions GetDeviceOptions(string deviceId)
@ -251,14 +245,12 @@ namespace Emby.Server.Implementations.Devices
if (CameraImageUploaded != null) if (CameraImageUploaded != null)
{ {
CameraImageUploaded?.Invoke(this, new GenericEventArgs<CameraImageUploadInfo> CameraImageUploaded?.Invoke(this, new GenericEventArgs<CameraImageUploadInfo>(
{ new CameraImageUploadInfo
Argument = new CameraImageUploadInfo
{ {
Device = device, Device = device,
FileInfo = file FileInfo = file
} }));
});
} }
} }

@ -44,10 +44,11 @@ namespace Emby.Server.Implementations.EntryPoints
} }
/// <inheritdoc /> /// <inheritdoc />
public async Task RunAsync() public Task RunAsync()
{ {
_udpServer = new UdpServer(_logger, _appHost); _udpServer = new UdpServer(_logger, _appHost);
_udpServer.Start(PortNumber, _cancellationTokenSource.Token); _udpServer.Start(PortNumber, _cancellationTokenSource.Token);
return Task.CompletedTask;
} }
/// <inheritdoc /> /// <inheritdoc />

@ -521,11 +521,7 @@ namespace Emby.Server.Implementations.Library
SetDefaultAudioAndSubtitleStreamIndexes(item, clone, user); SetDefaultAudioAndSubtitleStreamIndexes(item, clone, user);
} }
return new Tuple<LiveStreamResponse, IDirectStreamProvider>(new LiveStreamResponse return new Tuple<LiveStreamResponse, IDirectStreamProvider>(new LiveStreamResponse(clone), liveStream as IDirectStreamProvider);
{
MediaSource = clone
}, liveStream as IDirectStreamProvider);
} }
private static void AddMediaInfo(MediaSourceInfo mediaSource, bool isAudio) private static void AddMediaInfo(MediaSourceInfo mediaSource, bool isAudio)

@ -131,7 +131,7 @@ namespace Emby.Server.Implementations.Library
/// <param name="user">The user.</param> /// <param name="user">The user.</param>
private void OnUserUpdated(User user) private void OnUserUpdated(User user)
{ {
UserUpdated?.Invoke(this, new GenericEventArgs<User> { Argument = user }); UserUpdated?.Invoke(this, new GenericEventArgs<User>(user));
} }
/// <summary> /// <summary>
@ -140,7 +140,7 @@ namespace Emby.Server.Implementations.Library
/// <param name="user">The user.</param> /// <param name="user">The user.</param>
private void OnUserDeleted(User user) private void OnUserDeleted(User user)
{ {
UserDeleted?.Invoke(this, new GenericEventArgs<User> { Argument = user }); UserDeleted?.Invoke(this, new GenericEventArgs<User>(user));
} }
public NameIdPair[] GetAuthenticationProviders() public NameIdPair[] GetAuthenticationProviders()
@ -755,7 +755,7 @@ namespace Emby.Server.Implementations.Library
_userRepository.CreateUser(user); _userRepository.CreateUser(user);
EventHelper.QueueEventIfNotNull(UserCreated, this, new GenericEventArgs<User> { Argument = user }, _logger); EventHelper.QueueEventIfNotNull(UserCreated, this, new GenericEventArgs<User>(user), _logger);
return user; return user;
} }
@ -980,7 +980,7 @@ namespace Emby.Server.Implementations.Library
if (fireEvent) if (fireEvent)
{ {
UserPolicyUpdated?.Invoke(this, new GenericEventArgs<User> { Argument = user }); UserPolicyUpdated?.Invoke(this, new GenericEventArgs<User>(user));
} }
} }
@ -1050,7 +1050,7 @@ namespace Emby.Server.Implementations.Library
if (fireEvent) if (fireEvent)
{ {
UserConfigurationUpdated?.Invoke(this, new GenericEventArgs<User> { Argument = user }); UserConfigurationUpdated?.Invoke(this, new GenericEventArgs<User>(user));
} }
} }
} }

@ -109,7 +109,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
if (startDate < now) if (startDate < now)
{ {
TimerFired?.Invoke(this, new GenericEventArgs<TimerInfo> { Argument = item }); TimerFired?.Invoke(this, new GenericEventArgs<TimerInfo>(item));
return; return;
} }
@ -151,7 +151,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
var timer = GetAll().FirstOrDefault(i => string.Equals(i.Id, timerId, StringComparison.OrdinalIgnoreCase)); var timer = GetAll().FirstOrDefault(i => string.Equals(i.Id, timerId, StringComparison.OrdinalIgnoreCase));
if (timer != null) if (timer != null)
{ {
TimerFired?.Invoke(this, new GenericEventArgs<TimerInfo> { Argument = timer }); TimerFired?.Invoke(this, new GenericEventArgs<TimerInfo>(timer));
} }
} }

@ -149,27 +149,18 @@ namespace Emby.Server.Implementations.LiveTv
{ {
var timerId = e.Argument; var timerId = e.Argument;
TimerCancelled?.Invoke(this, new GenericEventArgs<TimerEventInfo> TimerCancelled?.Invoke(this, new GenericEventArgs<TimerEventInfo>(new TimerEventInfo(timerId)));
{
Argument = new TimerEventInfo
{
Id = timerId
}
});
} }
private void OnEmbyTvTimerCreated(object sender, GenericEventArgs<TimerInfo> e) private void OnEmbyTvTimerCreated(object sender, GenericEventArgs<TimerInfo> e)
{ {
var timer = e.Argument; var timer = e.Argument;
TimerCreated?.Invoke(this, new GenericEventArgs<TimerEventInfo> TimerCreated?.Invoke(this, new GenericEventArgs<TimerEventInfo>(
{ new TimerEventInfo(timer.Id)
Argument = new TimerEventInfo
{ {
ProgramId = _tvDtoService.GetInternalProgramId(timer.ProgramId), ProgramId = _tvDtoService.GetInternalProgramId(timer.ProgramId)
Id = timer.Id }));
}
});
} }
public List<NameIdPair> GetTunerHostTypes() public List<NameIdPair> GetTunerHostTypes()
@ -1725,13 +1716,7 @@ namespace Emby.Server.Implementations.LiveTv
if (!(service is EmbyTV.EmbyTV)) if (!(service is EmbyTV.EmbyTV))
{ {
TimerCancelled?.Invoke(this, new GenericEventArgs<TimerEventInfo> TimerCancelled?.Invoke(this, new GenericEventArgs<TimerEventInfo>(new TimerEventInfo(id)));
{
Argument = new TimerEventInfo
{
Id = id
}
});
} }
} }
@ -1748,13 +1733,7 @@ namespace Emby.Server.Implementations.LiveTv
await service.CancelSeriesTimerAsync(timer.ExternalId, CancellationToken.None).ConfigureAwait(false); await service.CancelSeriesTimerAsync(timer.ExternalId, CancellationToken.None).ConfigureAwait(false);
SeriesTimerCancelled?.Invoke(this, new GenericEventArgs<TimerEventInfo> SeriesTimerCancelled?.Invoke(this, new GenericEventArgs<TimerEventInfo>(new TimerEventInfo(id)));
{
Argument = new TimerEventInfo
{
Id = id
}
});
} }
public async Task<TimerInfoDto> GetTimer(string id, CancellationToken cancellationToken) public async Task<TimerInfoDto> GetTimer(string id, CancellationToken cancellationToken)
@ -2073,14 +2052,11 @@ namespace Emby.Server.Implementations.LiveTv
if (!(service is EmbyTV.EmbyTV)) if (!(service is EmbyTV.EmbyTV))
{ {
TimerCreated?.Invoke(this, new GenericEventArgs<TimerEventInfo> TimerCreated?.Invoke(this, new GenericEventArgs<TimerEventInfo>(
{ new TimerEventInfo(newTimerId)
Argument = new TimerEventInfo
{ {
ProgramId = _tvDtoService.GetInternalProgramId(info.ProgramId), ProgramId = _tvDtoService.GetInternalProgramId(info.ProgramId)
Id = newTimerId }));
}
});
} }
} }
@ -2105,14 +2081,11 @@ namespace Emby.Server.Implementations.LiveTv
await service.CreateSeriesTimerAsync(info, cancellationToken).ConfigureAwait(false); await service.CreateSeriesTimerAsync(info, cancellationToken).ConfigureAwait(false);
} }
SeriesTimerCreated?.Invoke(this, new GenericEventArgs<TimerEventInfo> SeriesTimerCreated?.Invoke(this, new GenericEventArgs<TimerEventInfo>(
{ new TimerEventInfo(newTimerId)
Argument = new TimerEventInfo
{ {
ProgramId = _tvDtoService.GetInternalProgramId(info.ProgramId), ProgramId = _tvDtoService.GetInternalProgramId(info.ProgramId)
Id = newTimerId }));
}
});
} }
public async Task UpdateTimer(TimerInfoDto timer, CancellationToken cancellationToken) public async Task UpdateTimer(TimerInfoDto timer, CancellationToken cancellationToken)

@ -153,10 +153,7 @@ namespace Emby.Server.Implementations.Playlists
}); });
} }
return new PlaylistCreationResult return new PlaylistCreationResult(playlist.Id.ToString("N", CultureInfo.InvariantCulture));
{
Id = playlist.Id.ToString("N", CultureInfo.InvariantCulture)
};
} }
finally finally
{ {

@ -392,7 +392,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
((TaskManager)TaskManager).OnTaskExecuting(this); ((TaskManager)TaskManager).OnTaskExecuting(this);
progress.ProgressChanged += progress_ProgressChanged; progress.ProgressChanged += OnProgressChanged;
TaskCompletionStatus status; TaskCompletionStatus status;
CurrentExecutionStartTime = DateTime.UtcNow; CurrentExecutionStartTime = DateTime.UtcNow;
@ -426,7 +426,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
var startTime = CurrentExecutionStartTime; var startTime = CurrentExecutionStartTime;
var endTime = DateTime.UtcNow; var endTime = DateTime.UtcNow;
progress.ProgressChanged -= progress_ProgressChanged; progress.ProgressChanged -= OnProgressChanged;
CurrentCancellationTokenSource.Dispose(); CurrentCancellationTokenSource.Dispose();
CurrentCancellationTokenSource = null; CurrentCancellationTokenSource = null;
CurrentProgress = null; CurrentProgress = null;
@ -439,16 +439,13 @@ namespace Emby.Server.Implementations.ScheduledTasks
/// </summary> /// </summary>
/// <param name="sender">The sender.</param> /// <param name="sender">The sender.</param>
/// <param name="e">The e.</param> /// <param name="e">The e.</param>
void progress_ProgressChanged(object sender, double e) private void OnProgressChanged(object sender, double e)
{ {
e = Math.Min(e, 100); e = Math.Min(e, 100);
CurrentProgress = e; CurrentProgress = e;
TaskProgress?.Invoke(this, new GenericEventArgs<double> TaskProgress?.Invoke(this, new GenericEventArgs<double>(e));
{
Argument = e
});
} }
/// <summary> /// <summary>

@ -254,10 +254,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
/// <param name="task">The task.</param> /// <param name="task">The task.</param>
internal void OnTaskExecuting(IScheduledTaskWorker task) internal void OnTaskExecuting(IScheduledTaskWorker task)
{ {
TaskExecuting?.Invoke(this, new GenericEventArgs<IScheduledTaskWorker> TaskExecuting?.Invoke(this, new GenericEventArgs<IScheduledTaskWorker>(task));
{
Argument = task
});
} }
/// <summary> /// <summary>
@ -267,11 +264,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
/// <param name="result">The result.</param> /// <param name="result">The result.</param>
internal void OnTaskCompleted(IScheduledTaskWorker task, TaskResult result) internal void OnTaskCompleted(IScheduledTaskWorker task, TaskResult result)
{ {
TaskCompleted?.Invoke(task, new TaskCompletionEventArgs TaskCompleted?.Invoke(task, new TaskCompletionEventArgs(task, result));
{
Result = result,
Task = task
});
ExecuteQueuedTasks(); ExecuteQueuedTasks();
} }

@ -427,7 +427,7 @@ namespace Emby.Server.Implementations.Updates
_config.SaveConfiguration(); _config.SaveConfiguration();
} }
PluginUninstalled?.Invoke(this, new GenericEventArgs<IPlugin> { Argument = plugin }); PluginUninstalled?.Invoke(this, new GenericEventArgs<IPlugin>(plugin));
_applicationHost.NotifyPendingRestart(); _applicationHost.NotifyPendingRestart();
} }

@ -226,12 +226,7 @@ namespace MediaBrowser.Api
/// <returns>IEnumerable{FileSystemEntryInfo}.</returns> /// <returns>IEnumerable{FileSystemEntryInfo}.</returns>
private IEnumerable<FileSystemEntryInfo> GetDrives() private IEnumerable<FileSystemEntryInfo> GetDrives()
{ {
return _fileSystem.GetDrives().Select(d => new FileSystemEntryInfo return _fileSystem.GetDrives().Select(d => new FileSystemEntryInfo(d.Name, d.FullName, FileSystemEntryType.Directory));
{
Name = d.Name,
Path = d.FullName,
Type = FileSystemEntryType.Directory
});
} }
/// <summary> /// <summary>
@ -266,13 +261,7 @@ namespace MediaBrowser.Api
return true; return true;
}); });
return entries.Select(f => new FileSystemEntryInfo return entries.Select(f => new FileSystemEntryInfo(f.Name, f.FullName, f.IsDirectory ? FileSystemEntryType.Directory : FileSystemEntryType.File));
{
Name = f.Name,
Path = f.FullName,
Type = f.IsDirectory ? FileSystemEntryType.Directory : FileSystemEntryType.File
});
} }
public object Get(GetParentPath request) public object Get(GetParentPath request)

@ -147,9 +147,8 @@ namespace MediaBrowser.Api.Images
{ {
var item = _libraryManager.GetItemById(request.Id); var item = _libraryManager.GetItemById(request.Id);
var images = await _providerManager.GetAvailableRemoteImages(item, new RemoteImageQuery var images = await _providerManager.GetAvailableRemoteImages(item, new RemoteImageQuery(request.ProviderName)
{ {
ProviderName = request.ProviderName,
IncludeAllLanguages = request.IncludeAllLanguages, IncludeAllLanguages = request.IncludeAllLanguages,
IncludeDisabledProviders = true, IncludeDisabledProviders = true,
ImageType = request.Type ImageType = request.Type

@ -1,10 +1,19 @@
#nullable enable
#pragma warning disable CS1591
using System; using System;
namespace MediaBrowser.Controller.LiveTv namespace MediaBrowser.Controller.LiveTv
{ {
public class TimerEventInfo public class TimerEventInfo
{ {
public string Id { get; set; } public TimerEventInfo(string id)
public Guid ProgramId { get; set; } {
Id = id;
}
public string Id { get; }
public Guid? ProgramId { get; set; }
} }
} }

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System; using System;

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
namespace MediaBrowser.Model.ApiClient namespace MediaBrowser.Model.ApiClient

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
namespace MediaBrowser.Model.Branding namespace MediaBrowser.Model.Branding

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System; using System;

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
namespace MediaBrowser.Model.Channels namespace MediaBrowser.Model.Channels

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System; using System;
@ -13,8 +14,11 @@ namespace MediaBrowser.Model.Channels
/// </summary> /// </summary>
/// <value>The fields.</value> /// <value>The fields.</value>
public ItemFields[] Fields { get; set; } public ItemFields[] Fields { get; set; }
public bool? EnableImages { get; set; } public bool? EnableImages { get; set; }
public int? ImageTypeLimit { get; set; } public int? ImageTypeLimit { get; set; }
public ImageType[] EnableImageTypes { get; set; } public ImageType[] EnableImageTypes { get; set; }
/// <summary> /// <summary>
@ -48,7 +52,9 @@ namespace MediaBrowser.Model.Channels
/// </summary> /// </summary>
/// <value><c>null</c> if [is favorite] contains no value, <c>true</c> if [is favorite]; otherwise, <c>false</c>.</value> /// <value><c>null</c> if [is favorite] contains no value, <c>true</c> if [is favorite]; otherwise, <c>false</c>.</value>
public bool? IsFavorite { get; set; } public bool? IsFavorite { get; set; }
public bool? IsRecordingsFolder { get; set; } public bool? IsRecordingsFolder { get; set; }
public bool RefreshLatestChannelItems { get; set; } public bool RefreshLatestChannelItems { get; set; }
} }
} }

@ -1,3 +1,4 @@
#nullable disable
using System; using System;
using System.Xml.Serialization; using System.Xml.Serialization;

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
namespace MediaBrowser.Model.Configuration namespace MediaBrowser.Model.Configuration
@ -5,10 +6,15 @@ namespace MediaBrowser.Model.Configuration
public class EncodingOptions public class EncodingOptions
{ {
public int EncodingThreadCount { get; set; } public int EncodingThreadCount { get; set; }
public string TranscodingTempPath { get; set; } public string TranscodingTempPath { get; set; }
public double DownMixAudioBoost { get; set; } public double DownMixAudioBoost { get; set; }
public bool EnableThrottling { get; set; } public bool EnableThrottling { get; set; }
public int ThrottleDelaySeconds { get; set; } public int ThrottleDelaySeconds { get; set; }
public string HardwareAccelerationType { get; set; } public string HardwareAccelerationType { get; set; }
/// <summary> /// <summary>
@ -20,12 +26,19 @@ namespace MediaBrowser.Model.Configuration
/// The current FFmpeg path being used by the system and displayed on the transcode page. /// The current FFmpeg path being used by the system and displayed on the transcode page.
/// </summary> /// </summary>
public string EncoderAppPathDisplay { get; set; } public string EncoderAppPathDisplay { get; set; }
public string VaapiDevice { get; set; } public string VaapiDevice { get; set; }
public int H264Crf { get; set; } public int H264Crf { get; set; }
public int H265Crf { get; set; } public int H265Crf { get; set; }
public string EncoderPreset { get; set; } public string EncoderPreset { get; set; }
public string DeinterlaceMethod { get; set; } public string DeinterlaceMethod { get; set; }
public bool EnableHardwareEncoding { get; set; } public bool EnableHardwareEncoding { get; set; }
public bool EnableSubtitleExtraction { get; set; } public bool EnableSubtitleExtraction { get; set; }
public string[] HardwareDecodingCodecs { get; set; } public string[] HardwareDecodingCodecs { get; set; }

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System; using System;

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System; using System;
@ -12,12 +13,15 @@ namespace MediaBrowser.Model.Configuration
public string ItemType { get; set; } public string ItemType { get; set; }
public string[] DisabledMetadataSavers { get; set; } public string[] DisabledMetadataSavers { get; set; }
public string[] LocalMetadataReaderOrder { get; set; } public string[] LocalMetadataReaderOrder { get; set; }
public string[] DisabledMetadataFetchers { get; set; } public string[] DisabledMetadataFetchers { get; set; }
public string[] MetadataFetcherOrder { get; set; } public string[] MetadataFetcherOrder { get; set; }
public string[] DisabledImageFetchers { get; set; } public string[] DisabledImageFetchers { get; set; }
public string[] ImageFetcherOrder { get; set; } public string[] ImageFetcherOrder { get; set; }
public MetadataOptions() public MetadataOptions()

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
namespace MediaBrowser.Model.Configuration namespace MediaBrowser.Model.Configuration

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System; using System;

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System; using System;

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System; using System;

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
namespace MediaBrowser.Model.Configuration namespace MediaBrowser.Model.Configuration

@ -10,7 +10,7 @@ namespace MediaBrowser.Model.Cryptography
IEnumerable<string> GetSupportedHashMethods(); IEnumerable<string> GetSupportedHashMethods();
byte[] ComputeHash(string HashMethod, byte[] bytes, byte[] salt); byte[] ComputeHash(string hashMethod, byte[] bytes, byte[] salt);
byte[] ComputeHashWithDefaultMethod(byte[] bytes, byte[] salt); byte[] ComputeHashWithDefaultMethod(byte[] bytes, byte[] salt);

@ -1,15 +1,19 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System;
namespace MediaBrowser.Model.Devices namespace MediaBrowser.Model.Devices
{ {
public class ContentUploadHistory public class ContentUploadHistory
{ {
public string DeviceId { get; set; } public string DeviceId { get; set; }
public LocalFileInfo[] FilesUploaded { get; set; } public LocalFileInfo[] FilesUploaded { get; set; }
public ContentUploadHistory() public ContentUploadHistory()
{ {
FilesUploaded = new LocalFileInfo[] { }; FilesUploaded = Array.Empty<LocalFileInfo>();
} }
} }
} }

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System; using System;

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System; using System;
@ -7,7 +8,9 @@ namespace MediaBrowser.Model.Devices
public class DevicesOptions public class DevicesOptions
{ {
public string[] EnabledCameraUploadDevices { get; set; } public string[] EnabledCameraUploadDevices { get; set; }
public string CameraUploadPath { get; set; } public string CameraUploadPath { get; set; }
public bool EnableCameraUploadSubfolders { get; set; } public bool EnableCameraUploadSubfolders { get; set; }
public DevicesOptions() public DevicesOptions()

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
namespace MediaBrowser.Model.Devices namespace MediaBrowser.Model.Devices
@ -5,8 +6,11 @@ namespace MediaBrowser.Model.Devices
public class LocalFileInfo public class LocalFileInfo
{ {
public string Name { get; set; } public string Name { get; set; }
public string Id { get; set; } public string Id { get; set; }
public string Album { get; set; } public string Album { get; set; }
public string MimeType { get; set; } public string MimeType { get; set; }
} }
} }

@ -11,13 +11,21 @@ namespace MediaBrowser.Model.Diagnostics
event EventHandler Exited; event EventHandler Exited;
void Kill(); void Kill();
bool WaitForExit(int timeMs); bool WaitForExit(int timeMs);
Task<bool> WaitForExitAsync(int timeMs); Task<bool> WaitForExitAsync(int timeMs);
int ExitCode { get; } int ExitCode { get; }
void Start(); void Start();
StreamWriter StandardInput { get; } StreamWriter StandardInput { get; }
StreamReader StandardError { get; } StreamReader StandardError { get; }
StreamReader StandardOutput { get; } StreamReader StandardOutput { get; }
ProcessOptions StartInfo { get; } ProcessOptions StartInfo { get; }
} }
} }

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
namespace MediaBrowser.Model.Diagnostics namespace MediaBrowser.Model.Diagnostics
@ -10,15 +11,25 @@ namespace MediaBrowser.Model.Diagnostics
public class ProcessOptions public class ProcessOptions
{ {
public string FileName { get; set; } public string FileName { get; set; }
public string Arguments { get; set; } public string Arguments { get; set; }
public string WorkingDirectory { get; set; } public string WorkingDirectory { get; set; }
public bool CreateNoWindow { get; set; } public bool CreateNoWindow { get; set; }
public bool UseShellExecute { get; set; } public bool UseShellExecute { get; set; }
public bool EnableRaisingEvents { get; set; } public bool EnableRaisingEvents { get; set; }
public bool ErrorDialog { get; set; } public bool ErrorDialog { get; set; }
public bool RedirectStandardError { get; set; } public bool RedirectStandardError { get; set; }
public bool RedirectStandardInput { get; set; } public bool RedirectStandardInput { get; set; }
public bool RedirectStandardOutput { get; set; } public bool RedirectStandardOutput { get; set; }
public bool IsHidden { get; set; } public bool IsHidden { get; set; }
} }
} }

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System; using System;
@ -19,12 +20,17 @@ namespace MediaBrowser.Model.Dlna
} }
public bool EnableDirectPlay { get; set; } public bool EnableDirectPlay { get; set; }
public bool EnableDirectStream { get; set; } public bool EnableDirectStream { get; set; }
public bool ForceDirectPlay { get; set; } public bool ForceDirectPlay { get; set; }
public bool ForceDirectStream { get; set; } public bool ForceDirectStream { get; set; }
public Guid ItemId { get; set; } public Guid ItemId { get; set; }
public MediaSourceInfo[] MediaSources { get; set; } public MediaSourceInfo[] MediaSources { get; set; }
public DeviceProfile Profile { get; set; } public DeviceProfile Profile { get; set; }
/// <summary> /// <summary>

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System; using System;

@ -15,7 +15,7 @@ namespace MediaBrowser.Model.Dlna
int? height, int? height,
int? videoBitDepth, int? videoBitDepth,
int? videoBitrate, int? videoBitrate,
string videoProfile, string? videoProfile,
double? videoLevel, double? videoLevel,
float? videoFramerate, float? videoFramerate,
int? packetLength, int? packetLength,
@ -25,7 +25,7 @@ namespace MediaBrowser.Model.Dlna
int? refFrames, int? refFrames,
int? numVideoStreams, int? numVideoStreams,
int? numAudioStreams, int? numAudioStreams,
string videoCodecTag, string? videoCodecTag,
bool? isAvc) bool? isAvc)
{ {
switch (condition.Property) switch (condition.Property)
@ -103,7 +103,7 @@ namespace MediaBrowser.Model.Dlna
int? audioBitrate, int? audioBitrate,
int? audioSampleRate, int? audioSampleRate,
int? audioBitDepth, int? audioBitDepth,
string audioProfile, string? audioProfile,
bool? isSecondaryTrack) bool? isSecondaryTrack)
{ {
switch (condition.Property) switch (condition.Property)
@ -154,7 +154,7 @@ namespace MediaBrowser.Model.Dlna
return false; return false;
} }
private static bool IsConditionSatisfied(ProfileCondition condition, string currentValue) private static bool IsConditionSatisfied(ProfileCondition condition, string? currentValue)
{ {
if (string.IsNullOrEmpty(currentValue)) if (string.IsNullOrEmpty(currentValue))
{ {
@ -203,34 +203,6 @@ namespace MediaBrowser.Model.Dlna
return false; return false;
} }
private static bool IsConditionSatisfied(ProfileCondition condition, float currentValue)
{
if (currentValue <= 0)
{
// If the value is unknown, it satisfies if not marked as required
return !condition.IsRequired;
}
if (float.TryParse(condition.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out var expected))
{
switch (condition.Condition)
{
case ProfileConditionType.Equals:
return currentValue.Equals(expected);
case ProfileConditionType.GreaterThanEqual:
return currentValue >= expected;
case ProfileConditionType.LessThanEqual:
return currentValue <= expected;
case ProfileConditionType.NotEquals:
return !currentValue.Equals(expected);
default:
throw new InvalidOperationException("Unexpected ProfileConditionType: " + condition.Condition);
}
}
return false;
}
private static bool IsConditionSatisfied(ProfileCondition condition, double? currentValue) private static bool IsConditionSatisfied(ProfileCondition condition, double? currentValue)
{ {
if (!currentValue.HasValue) if (!currentValue.HasValue)

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System; using System;
@ -10,6 +11,7 @@ namespace MediaBrowser.Model.Dlna
{ {
[XmlAttribute("type")] [XmlAttribute("type")]
public DlnaProfileType Type { get; set; } public DlnaProfileType Type { get; set; }
public ProfileCondition[] Conditions { get; set; } public ProfileCondition[] Conditions { get; set; }
[XmlAttribute("container")] [XmlAttribute("container")]
@ -45,7 +47,7 @@ namespace MediaBrowser.Model.Dlna
public static bool ContainsContainer(string profileContainers, string inputContainer) public static bool ContainsContainer(string profileContainers, string inputContainer)
{ {
var isNegativeList = false; var isNegativeList = false;
if (profileContainers != null && profileContainers.StartsWith("-")) if (profileContainers != null && profileContainers.StartsWith("-", StringComparison.Ordinal))
{ {
isNegativeList = true; isNegativeList = true;
profileContainers = profileContainers.Substring(1); profileContainers = profileContainers.Substring(1);

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System; using System;
@ -32,7 +33,10 @@ namespace MediaBrowser.Model.Dlna
DlnaFlags.InteractiveTransferMode | DlnaFlags.InteractiveTransferMode |
DlnaFlags.DlnaV15; DlnaFlags.DlnaV15;
string dlnaflags = string.Format(";DLNA.ORG_FLAGS={0}", DlnaMaps.FlagsToString(flagValue)); string dlnaflags = string.Format(
CultureInfo.InvariantCulture,
";DLNA.ORG_FLAGS={0}",
DlnaMaps.FlagsToString(flagValue));
ResponseProfile mediaProfile = _profile.GetImageMediaProfile(container, ResponseProfile mediaProfile = _profile.GetImageMediaProfile(container,
width, width,

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System; using System;

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System; using System;

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
namespace MediaBrowser.Model.Dlna namespace MediaBrowser.Model.Dlna

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System.Xml.Serialization; using System.Xml.Serialization;

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System.Xml.Serialization; using System.Xml.Serialization;

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
namespace MediaBrowser.Model.Dlna namespace MediaBrowser.Model.Dlna
@ -5,7 +6,9 @@ namespace MediaBrowser.Model.Dlna
public interface ITranscoderSupport public interface ITranscoderSupport
{ {
bool CanEncodeToAudioCodec(string codec); bool CanEncodeToAudioCodec(string codec);
bool CanEncodeToSubtitleCodec(string codec); bool CanEncodeToSubtitleCodec(string codec);
bool CanExtractSubtitles(string codec); bool CanExtractSubtitles(string codec);
} }
@ -15,10 +18,12 @@ namespace MediaBrowser.Model.Dlna
{ {
return true; return true;
} }
public bool CanEncodeToSubtitleCodec(string codec) public bool CanEncodeToSubtitleCodec(string codec)
{ {
return true; return true;
} }
public bool CanExtractSubtitles(string codec) public bool CanExtractSubtitles(string codec)
{ {
return true; return true;

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System; using System;
@ -21,13 +22,13 @@ namespace MediaBrowser.Model.Dlna
if (string.Equals(container, "asf", StringComparison.OrdinalIgnoreCase)) if (string.Equals(container, "asf", StringComparison.OrdinalIgnoreCase))
{ {
MediaFormatProfile? val = ResolveVideoASFFormat(videoCodec, audioCodec, width, height); MediaFormatProfile? val = ResolveVideoASFFormat(videoCodec, audioCodec, width, height);
return val.HasValue ? new MediaFormatProfile[] { val.Value } : new MediaFormatProfile[] { }; return val.HasValue ? new MediaFormatProfile[] { val.Value } : Array.Empty<MediaFormatProfile>();
} }
if (string.Equals(container, "mp4", StringComparison.OrdinalIgnoreCase)) if (string.Equals(container, "mp4", StringComparison.OrdinalIgnoreCase))
{ {
MediaFormatProfile? val = ResolveVideoMP4Format(videoCodec, audioCodec, width, height); MediaFormatProfile? val = ResolveVideoMP4Format(videoCodec, audioCodec, width, height);
return val.HasValue ? new MediaFormatProfile[] { val.Value } : new MediaFormatProfile[] { }; return val.HasValue ? new MediaFormatProfile[] { val.Value } : Array.Empty<MediaFormatProfile>();
} }
if (string.Equals(container, "avi", StringComparison.OrdinalIgnoreCase)) if (string.Equals(container, "avi", StringComparison.OrdinalIgnoreCase))
@ -61,18 +62,18 @@ namespace MediaBrowser.Model.Dlna
if (string.Equals(container, "3gp", StringComparison.OrdinalIgnoreCase)) if (string.Equals(container, "3gp", StringComparison.OrdinalIgnoreCase))
{ {
MediaFormatProfile? val = ResolveVideo3GPFormat(videoCodec, audioCodec); MediaFormatProfile? val = ResolveVideo3GPFormat(videoCodec, audioCodec);
return val.HasValue ? new MediaFormatProfile[] { val.Value } : new MediaFormatProfile[] { }; return val.HasValue ? new MediaFormatProfile[] { val.Value } : Array.Empty<MediaFormatProfile>();
} }
if (string.Equals(container, "ogv", StringComparison.OrdinalIgnoreCase) || string.Equals(container, "ogg", StringComparison.OrdinalIgnoreCase)) if (string.Equals(container, "ogv", StringComparison.OrdinalIgnoreCase) || string.Equals(container, "ogg", StringComparison.OrdinalIgnoreCase))
return new MediaFormatProfile[] { MediaFormatProfile.OGV }; return new MediaFormatProfile[] { MediaFormatProfile.OGV };
return new MediaFormatProfile[] { }; return Array.Empty<MediaFormatProfile>();
} }
private MediaFormatProfile[] ResolveVideoMPEG2TSFormat(string videoCodec, string audioCodec, int? width, int? height, TransportStreamTimestamp timestampType) private MediaFormatProfile[] ResolveVideoMPEG2TSFormat(string videoCodec, string audioCodec, int? width, int? height, TransportStreamTimestamp timestampType)
{ {
string suffix = ""; string suffix = string.Empty;
switch (timestampType) switch (timestampType)
{ {
@ -92,16 +93,18 @@ namespace MediaBrowser.Model.Dlna
if (string.Equals(videoCodec, "mpeg2video", StringComparison.OrdinalIgnoreCase)) if (string.Equals(videoCodec, "mpeg2video", StringComparison.OrdinalIgnoreCase))
{ {
var list = new List<MediaFormatProfile>(); var list = new List<MediaFormatProfile>
{
list.Add(ValueOf("MPEG_TS_SD_NA" + suffix)); ValueOf("MPEG_TS_SD_NA" + suffix),
list.Add(ValueOf("MPEG_TS_SD_EU" + suffix)); ValueOf("MPEG_TS_SD_EU" + suffix),
list.Add(ValueOf("MPEG_TS_SD_KO" + suffix)); ValueOf("MPEG_TS_SD_KO" + suffix)
};
if ((timestampType == TransportStreamTimestamp.Valid) && string.Equals(audioCodec, "aac", StringComparison.OrdinalIgnoreCase)) if ((timestampType == TransportStreamTimestamp.Valid) && string.Equals(audioCodec, "aac", StringComparison.OrdinalIgnoreCase))
{ {
list.Add(MediaFormatProfile.MPEG_TS_JP_T); list.Add(MediaFormatProfile.MPEG_TS_JP_T);
} }
return list.ToArray(); return list.ToArray();
} }
if (string.Equals(videoCodec, "h264", StringComparison.OrdinalIgnoreCase)) if (string.Equals(videoCodec, "h264", StringComparison.OrdinalIgnoreCase))
@ -115,6 +118,7 @@ namespace MediaBrowser.Model.Dlna
{ {
return new MediaFormatProfile[] { MediaFormatProfile.AVC_TS_HD_DTS_ISO }; return new MediaFormatProfile[] { MediaFormatProfile.AVC_TS_HD_DTS_ISO };
} }
return new MediaFormatProfile[] { MediaFormatProfile.AVC_TS_HD_DTS_T }; return new MediaFormatProfile[] { MediaFormatProfile.AVC_TS_HD_DTS_T };
} }

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System.Xml.Serialization; using System.Xml.Serialization;
@ -6,18 +7,6 @@ namespace MediaBrowser.Model.Dlna
{ {
public class ProfileCondition public class ProfileCondition
{ {
[XmlAttribute("condition")]
public ProfileConditionType Condition { get; set; }
[XmlAttribute("property")]
public ProfileConditionValue Property { get; set; }
[XmlAttribute("value")]
public string Value { get; set; }
[XmlAttribute("isRequired")]
public bool IsRequired { get; set; }
public ProfileCondition() public ProfileCondition()
{ {
IsRequired = true; IsRequired = true;
@ -36,5 +25,17 @@ namespace MediaBrowser.Model.Dlna
Value = value; Value = value;
IsRequired = isRequired; IsRequired = isRequired;
} }
[XmlAttribute("condition")]
public ProfileConditionType Condition { get; set; }
[XmlAttribute("property")]
public ProfileConditionValue Property { get; set; }
[XmlAttribute("value")]
public string Value { get; set; }
[XmlAttribute("isRequired")]
public bool IsRequired { get; set; }
} }
} }

@ -5,6 +5,7 @@ namespace MediaBrowser.Model.Dlna
public class ResolutionConfiguration public class ResolutionConfiguration
{ {
public int MaxWidth { get; set; } public int MaxWidth { get; set; }
public int MaxBitrate { get; set; } public int MaxBitrate { get; set; }
public ResolutionConfiguration(int maxWidth, int maxBitrate) public ResolutionConfiguration(int maxWidth, int maxBitrate)

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System; using System;
@ -17,7 +18,8 @@ namespace MediaBrowser.Model.Dlna
new ResolutionConfiguration(3840, 35000000) new ResolutionConfiguration(3840, 35000000)
}; };
public static ResolutionOptions Normalize(int? inputBitrate, public static ResolutionOptions Normalize(
int? inputBitrate,
int? unused1, int? unused1,
int? unused2, int? unused2,
int outputBitrate, int outputBitrate,
@ -83,6 +85,7 @@ namespace MediaBrowser.Model.Dlna
{ {
return .5; return .5;
} }
return 1; return 1;
} }

@ -5,6 +5,7 @@ namespace MediaBrowser.Model.Dlna
public class ResolutionOptions public class ResolutionOptions
{ {
public int? MaxWidth { get; set; } public int? MaxWidth { get; set; }
public int? MaxHeight { get; set; } public int? MaxHeight { get; set; }
} }
} }

@ -1,5 +1,7 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System;
using System.Xml.Serialization; using System.Xml.Serialization;
namespace MediaBrowser.Model.Dlna namespace MediaBrowser.Model.Dlna
@ -28,7 +30,7 @@ namespace MediaBrowser.Model.Dlna
public ResponseProfile() public ResponseProfile()
{ {
Conditions = new ProfileCondition[] { }; Conditions = Array.Empty<ProfileCondition>();
} }
public string[] GetContainers() public string[] GetContainers()

@ -34,9 +34,9 @@ namespace MediaBrowser.Model.Dlna
public SearchCriteria(string search) public SearchCriteria(string search)
{ {
if (string.IsNullOrEmpty(search)) if (search.Length == 0)
{ {
throw new ArgumentNullException(nameof(search)); throw new ArgumentException("String can't be empty.", nameof(search));
} }
SearchType = SearchType.Unknown; SearchType = SearchType.Unknown;
@ -48,11 +48,10 @@ namespace MediaBrowser.Model.Dlna
if (subFactors.Length == 3) if (subFactors.Length == 3)
{ {
if (string.Equals("upnp:class", subFactors[0], StringComparison.OrdinalIgnoreCase) && if (string.Equals("upnp:class", subFactors[0], StringComparison.OrdinalIgnoreCase) &&
(string.Equals("=", subFactors[1]) || string.Equals("derivedfrom", subFactors[1], StringComparison.OrdinalIgnoreCase))) (string.Equals("=", subFactors[1], StringComparison.Ordinal) || string.Equals("derivedfrom", subFactors[1], StringComparison.OrdinalIgnoreCase)))
{ {
if (string.Equals("\"object.item.imageItem\"", subFactors[2]) || string.Equals("\"object.item.imageItem.photo\"", subFactors[2], StringComparison.OrdinalIgnoreCase)) if (string.Equals("\"object.item.imageItem\"", subFactors[2], StringComparison.Ordinal) || string.Equals("\"object.item.imageItem.photo\"", subFactors[2], StringComparison.OrdinalIgnoreCase))
{ {
SearchType = SearchType.Image; SearchType = SearchType.Image;
} }

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System; using System;
@ -339,6 +340,7 @@ namespace MediaBrowser.Model.Dlna
{ {
transcodeReasons.Add(transcodeReason.Value); transcodeReasons.Add(transcodeReason.Value);
} }
all = false; all = false;
break; break;
} }

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System; using System;

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System.Xml.Serialization; using System.Xml.Serialization;

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
namespace MediaBrowser.Model.Dlna namespace MediaBrowser.Model.Dlna
@ -5,13 +6,21 @@ namespace MediaBrowser.Model.Dlna
public class SubtitleStreamInfo public class SubtitleStreamInfo
{ {
public string Url { get; set; } public string Url { get; set; }
public string Language { get; set; } public string Language { get; set; }
public string Name { get; set; } public string Name { get; set; }
public bool IsForced { get; set; } public bool IsForced { get; set; }
public string Format { get; set; } public string Format { get; set; }
public string DisplayTitle { get; set; } public string DisplayTitle { get; set; }
public int Index { get; set; } public int Index { get; set; }
public SubtitleDeliveryMethod DeliveryMethod { get; set; } public SubtitleDeliveryMethod DeliveryMethod { get; set; }
public bool IsExternalUrl { get; set; } public bool IsExternalUrl { get; set; }
} }
} }

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System.Xml.Serialization; using System.Xml.Serialization;

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System; using System;
@ -9,8 +10,11 @@ namespace MediaBrowser.Model.Dlna
public class UpnpDeviceInfo public class UpnpDeviceInfo
{ {
public Uri Location { get; set; } public Uri Location { get; set; }
public Dictionary<string, string> Headers { get; set; } public Dictionary<string, string> Headers { get; set; }
public IPAddress LocalIpAddress { get; set; } public IPAddress LocalIpAddress { get; set; }
public int LocalPort { get; set; } public int LocalPort { get; set; }
} }
} }

@ -8,6 +8,7 @@ namespace MediaBrowser.Model.Dlna
public class VideoOptions : AudioOptions public class VideoOptions : AudioOptions
{ {
public int? AudioStreamIndex { get; set; } public int? AudioStreamIndex { get; set; }
public int? SubtitleStreamIndex { get; set; } public int? SubtitleStreamIndex { get; set; }
} }
} }

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System.Xml.Serialization; using System.Xml.Serialization;

@ -16,7 +16,8 @@ namespace MediaBrowser.Model.Drawing
/// <param name="maxWidth">A max fixed width, if desired.</param> /// <param name="maxWidth">A max fixed width, if desired.</param>
/// <param name="maxHeight">A max fixed height, if desired.</param> /// <param name="maxHeight">A max fixed height, if desired.</param>
/// <returns>A new size object.</returns> /// <returns>A new size object.</returns>
public static ImageDimensions Resize(ImageDimensions size, public static ImageDimensions Resize(
ImageDimensions size,
int width, int width,
int height, int height,
int maxWidth, int maxWidth,
@ -62,7 +63,7 @@ namespace MediaBrowser.Model.Drawing
/// <param name="currentHeight">Height of the current.</param> /// <param name="currentHeight">Height of the current.</param>
/// <param name="currentWidth">Width of the current.</param> /// <param name="currentWidth">Width of the current.</param>
/// <param name="newHeight">The new height.</param> /// <param name="newHeight">The new height.</param>
/// <returns>the new width</returns> /// <returns>The new width.</returns>
private static int GetNewWidth(int currentHeight, int currentWidth, int newHeight) private static int GetNewWidth(int currentHeight, int currentWidth, int newHeight)
=> Convert.ToInt32((double)newHeight / currentHeight * currentWidth); => Convert.ToInt32((double)newHeight / currentHeight * currentWidth);

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System; using System;

@ -1,3 +1,4 @@
#nullable disable
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace MediaBrowser.Model.Dto namespace MediaBrowser.Model.Dto

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
namespace MediaBrowser.Model.Dto namespace MediaBrowser.Model.Dto

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
namespace MediaBrowser.Model.Dto namespace MediaBrowser.Model.Dto

@ -1,3 +1,4 @@
#nullable disable
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
namespace MediaBrowser.Model.Dto namespace MediaBrowser.Model.Dto
@ -20,9 +21,9 @@ namespace MediaBrowser.Model.Dto
public int? ImageIndex { get; set; } public int? ImageIndex { get; set; }
/// <summary> /// <summary>
/// The image tag /// Gets or sets the image tag.
/// </summary> /// </summary>
public string ImageTag; public string ImageTag { get; set; }
/// <summary> /// <summary>
/// Gets or sets the path. /// Gets or sets the path.

@ -1,3 +1,4 @@
#nullable disable
using MediaBrowser.Model.Drawing; using MediaBrowser.Model.Drawing;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
@ -8,6 +9,14 @@ namespace MediaBrowser.Model.Dto
/// </summary> /// </summary>
public class ImageOptions public class ImageOptions
{ {
/// <summary>
/// Initializes a new instance of the <see cref="ImageOptions" /> class.
/// </summary>
public ImageOptions()
{
EnableImageEnhancers = true;
}
/// <summary> /// <summary>
/// Gets or sets the type of the image. /// Gets or sets the type of the image.
/// </summary> /// </summary>
@ -98,13 +107,5 @@ namespace MediaBrowser.Model.Dto
/// </summary> /// </summary>
/// <value>The color of the background.</value> /// <value>The color of the background.</value>
public string BackgroundColor { get; set; } public string BackgroundColor { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="ImageOptions" /> class.
/// </summary>
public ImageOptions()
{
EnableImageEnhancers = true;
}
} }
} }

@ -1,20 +0,0 @@
namespace MediaBrowser.Model.Dto
{
/// <summary>
/// Class ItemIndex.
/// </summary>
public class ItemIndex
{
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the item count.
/// </summary>
/// <value>The item count.</value>
public int ItemCount { get; set; }
}
}

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System; using System;

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System; using System;

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System; using System;

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
namespace MediaBrowser.Model.Dto namespace MediaBrowser.Model.Dto
@ -6,7 +7,6 @@ namespace MediaBrowser.Model.Dto
{ {
public NameValuePair() public NameValuePair()
{ {
} }
public NameValuePair(string name, string value) public NameValuePair(string name, string value)

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System; using System;

@ -1,3 +1,4 @@
#nullable disable
using System; using System;
using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Users; using MediaBrowser.Model.Users;

@ -1,3 +1,4 @@
#nullable disable
using System; using System;
namespace MediaBrowser.Model.Dto namespace MediaBrowser.Model.Dto

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System; using System;

@ -1,3 +1,4 @@
#nullable disable
using System.Collections.Generic; using System.Collections.Generic;
namespace MediaBrowser.Model.Entities namespace MediaBrowser.Model.Entities

@ -3,7 +3,7 @@ using System.Collections.Generic;
namespace MediaBrowser.Model.Entities namespace MediaBrowser.Model.Entities
{ {
/// <summary> /// <summary>
/// Since BaseItem and DTOBaseItem both have ProviderIds, this interface helps avoid code repition by using extension methods. /// Since BaseItem and DTOBaseItem both have ProviderIds, this interface helps avoid code repetition by using extension methods.
/// </summary> /// </summary>
public interface IHasProviderIds public interface IHasProviderIds
{ {

@ -5,15 +5,29 @@ using System;
namespace MediaBrowser.Model.Entities namespace MediaBrowser.Model.Entities
{ {
/// <summary> /// <summary>
/// Class LibraryUpdateInfo /// Class LibraryUpdateInfo.
/// </summary> /// </summary>
public class LibraryUpdateInfo public class LibraryUpdateInfo
{ {
/// <summary>
/// Initializes a new instance of the <see cref="LibraryUpdateInfo"/> class.
/// </summary>
public LibraryUpdateInfo()
{
FoldersAddedTo = Array.Empty<string>();
FoldersRemovedFrom = Array.Empty<string>();
ItemsAdded = Array.Empty<string>();
ItemsRemoved = Array.Empty<string>();
ItemsUpdated = Array.Empty<string>();
CollectionFolders = Array.Empty<string>();
}
/// <summary> /// <summary>
/// Gets or sets the folders added to. /// Gets or sets the folders added to.
/// </summary> /// </summary>
/// <value>The folders added to.</value> /// <value>The folders added to.</value>
public string[] FoldersAddedTo { get; set; } public string[] FoldersAddedTo { get; set; }
/// <summary> /// <summary>
/// Gets or sets the folders removed from. /// Gets or sets the folders removed from.
/// </summary> /// </summary>
@ -41,18 +55,5 @@ namespace MediaBrowser.Model.Entities
public string[] CollectionFolders { get; set; } public string[] CollectionFolders { get; set; }
public bool IsEmpty => FoldersAddedTo.Length == 0 && FoldersRemovedFrom.Length == 0 && ItemsAdded.Length == 0 && ItemsRemoved.Length == 0 && ItemsUpdated.Length == 0 && CollectionFolders.Length == 0; public bool IsEmpty => FoldersAddedTo.Length == 0 && FoldersRemovedFrom.Length == 0 && ItemsAdded.Length == 0 && ItemsRemoved.Length == 0 && ItemsUpdated.Length == 0 && CollectionFolders.Length == 0;
/// <summary>
/// Initializes a new instance of the <see cref="LibraryUpdateInfo"/> class.
/// </summary>
public LibraryUpdateInfo()
{
FoldersAddedTo = Array.Empty<string>();
FoldersRemovedFrom = Array.Empty<string>();
ItemsAdded = Array.Empty<string>();
ItemsRemoved = Array.Empty<string>();
ItemsUpdated = Array.Empty<string>();
CollectionFolders = Array.Empty<string>();
}
} }
} }

@ -1,3 +1,4 @@
#nullable disable
namespace MediaBrowser.Model.Entities namespace MediaBrowser.Model.Entities
{ {
/// <summary> /// <summary>

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System; using System;

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
namespace MediaBrowser.Model.Entities namespace MediaBrowser.Model.Entities

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System; using System;
@ -7,32 +8,32 @@ namespace MediaBrowser.Model.Entities
public class PackageReviewInfo public class PackageReviewInfo
{ {
/// <summary> /// <summary>
/// The package id (database key) for this review /// Gets or sets the package id (database key) for this review.
/// </summary> /// </summary>
public int id { get; set; } public int id { get; set; }
/// <summary> /// <summary>
/// The rating value /// Gets or sets the rating value.
/// </summary> /// </summary>
public int rating { get; set; } public int rating { get; set; }
/// <summary> /// <summary>
/// Whether or not this review recommends this item /// Gets or sets whether or not this review recommends this item.
/// </summary> /// </summary>
public bool recommend { get; set; } public bool recommend { get; set; }
/// <summary> /// <summary>
/// A short description of the review /// Gets or sets a short description of the review.
/// </summary> /// </summary>
public string title { get; set; } public string title { get; set; }
/// <summary> /// <summary>
/// A full review /// Gets or sets the full review.
/// </summary> /// </summary>
public string review { get; set; } public string review { get; set; }
/// <summary> /// <summary>
/// Time of review /// Gets or sets the time of review.
/// </summary> /// </summary>
public DateTime timestamp { get; set; } public DateTime timestamp { get; set; }

@ -1,12 +1,23 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
namespace MediaBrowser.Model.Entities namespace MediaBrowser.Model.Entities
{ {
/// <summary> /// <summary>
/// Class ParentalRating /// Class ParentalRating.
/// </summary> /// </summary>
public class ParentalRating public class ParentalRating
{ {
public ParentalRating()
{
}
public ParentalRating(string name, int value)
{
Name = name;
Value = value;
}
/// <summary> /// <summary>
/// Gets or sets the name. /// Gets or sets the name.
/// </summary> /// </summary>
@ -18,16 +29,5 @@ namespace MediaBrowser.Model.Entities
/// </summary> /// </summary>
/// <value>The value.</value> /// <value>The value.</value>
public int Value { get; set; } public int Value { get; set; }
public ParentalRating()
{
}
public ParentalRating(string name, int value)
{
Name = name;
Value = value;
}
} }
} }

@ -20,23 +20,23 @@ namespace MediaBrowser.Model.Entities
} }
/// <summary> /// <summary>
/// Gets a provider id /// Gets a provider id.
/// </summary> /// </summary>
/// <param name="instance">The instance.</param> /// <param name="instance">The instance.</param>
/// <param name="provider">The provider.</param> /// <param name="provider">The provider.</param>
/// <returns>System.String.</returns> /// <returns>System.String.</returns>
public static string GetProviderId(this IHasProviderIds instance, MetadataProviders provider) public static string? GetProviderId(this IHasProviderIds instance, MetadataProviders provider)
{ {
return instance.GetProviderId(provider.ToString()); return instance.GetProviderId(provider.ToString());
} }
/// <summary> /// <summary>
/// Gets a provider id /// Gets a provider id.
/// </summary> /// </summary>
/// <param name="instance">The instance.</param> /// <param name="instance">The instance.</param>
/// <param name="name">The name.</param> /// <param name="name">The name.</param>
/// <returns>System.String.</returns> /// <returns>System.String.</returns>
public static string GetProviderId(this IHasProviderIds instance, string name) public static string? GetProviderId(this IHasProviderIds instance, string name)
{ {
if (instance == null) if (instance == null)
{ {
@ -53,7 +53,7 @@ namespace MediaBrowser.Model.Entities
} }
/// <summary> /// <summary>
/// Sets a provider id /// Sets a provider id.
/// </summary> /// </summary>
/// <param name="instance">The instance.</param> /// <param name="instance">The instance.</param>
/// <param name="name">The name.</param> /// <param name="name">The name.</param>
@ -89,7 +89,7 @@ namespace MediaBrowser.Model.Entities
} }
/// <summary> /// <summary>
/// Sets a provider id /// Sets a provider id.
/// </summary> /// </summary>
/// <param name="instance">The instance.</param> /// <param name="instance">The instance.</param>
/// <param name="provider">The provider.</param> /// <param name="provider">The provider.</param>

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System; using System;

@ -22,12 +22,5 @@ namespace MediaBrowser.Model.Events
{ {
Argument = arg; Argument = arg;
} }
/// <summary>
/// Initializes a new instance of the <see cref="GenericEventArgs{T}"/> class.
/// </summary>
public GenericEventArgs()
{
}
} }
} }

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System; using System;
@ -21,6 +22,7 @@ namespace MediaBrowser.Model.Extensions
return true; return true;
} }
} }
return false; return false;
} }
} }

@ -12,9 +12,9 @@ namespace MediaBrowser.Model.Extensions
/// <returns>The string with the first character as uppercase.</returns> /// <returns>The string with the first character as uppercase.</returns>
public static string FirstToUpper(string str) public static string FirstToUpper(string str)
{ {
if (string.IsNullOrEmpty(str)) if (str.Length == 0)
{ {
return string.Empty; return str;
} }
if (char.IsUpper(str[0])) if (char.IsUpper(str[0]))

@ -1,3 +1,4 @@
#nullable disable
namespace MediaBrowser.Model.Globalization namespace MediaBrowser.Model.Globalization
{ {
/// <summary> /// <summary>

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System; using System;

@ -1,3 +1,4 @@
#nullable disable
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
namespace MediaBrowser.Model.Globalization namespace MediaBrowser.Model.Globalization
@ -11,6 +12,7 @@ namespace MediaBrowser.Model.Globalization
} }
public string Name { get; set; } public string Name { get; set; }
public string Value { get; set; } public string Value { get; set; }
} }
} }

@ -1,26 +1,39 @@
namespace MediaBrowser.Model.IO namespace MediaBrowser.Model.IO
{ {
/// <summary> /// <summary>
/// Class FileSystemEntryInfo /// Class FileSystemEntryInfo.
/// </summary> /// </summary>
public class FileSystemEntryInfo public class FileSystemEntryInfo
{ {
/// <summary> /// <summary>
/// Gets or sets the name. /// Initializes a new instance of the <see cref="FileSystemEntryInfo" /> class.
/// </summary>
/// <param name="name">The filename.</param>
/// <param name="path">The file path.</param>
/// <param name="type">The file type.</param>
public FileSystemEntryInfo(string name, string path, FileSystemEntryType type)
{
Name = name;
Path = path;
Type = type;
}
/// <summary>
/// Gets the name.
/// </summary> /// </summary>
/// <value>The name.</value> /// <value>The name.</value>
public string Name { get; set; } public string Name { get; }
/// <summary> /// <summary>
/// Gets or sets the path. /// Gets the path.
/// </summary> /// </summary>
/// <value>The path.</value> /// <value>The path.</value>
public string Path { get; set; } public string Path { get; }
/// <summary> /// <summary>
/// Gets or sets the type. /// Gets the type.
/// </summary> /// </summary>
/// <value>The type.</value> /// <value>The type.</value>
public FileSystemEntryType Type { get; set; } public FileSystemEntryType Type { get; }
} }
} }

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System; using System;

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System; using System;

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save