diff options
Diffstat (limited to 'MediaBrowser.Common')
7 files changed, 43 insertions, 10 deletions
diff --git a/MediaBrowser.Common/Configuration/IApplicationPaths.cs b/MediaBrowser.Common/Configuration/IApplicationPaths.cs index 57c654667..7a8ab3236 100644 --- a/MediaBrowser.Common/Configuration/IApplicationPaths.cs +++ b/MediaBrowser.Common/Configuration/IApplicationPaths.cs @@ -84,5 +84,11 @@ namespace MediaBrowser.Common.Configuration /// </summary> /// <value>The magic string used for virtual path manipulation.</value> string VirtualDataPath { get; } + + /// <summary> + /// Gets the path used for storing trickplay files. + /// </summary> + /// <value>The trickplay path.</value> + string TrickplayPath { get; } } } diff --git a/MediaBrowser.Common/Configuration/IConfigurationManager.cs b/MediaBrowser.Common/Configuration/IConfigurationManager.cs index e6696a571..18a8d3e7b 100644 --- a/MediaBrowser.Common/Configuration/IConfigurationManager.cs +++ b/MediaBrowser.Common/Configuration/IConfigurationManager.cs @@ -61,7 +61,7 @@ namespace MediaBrowser.Common.Configuration object GetConfiguration(string key); /// <summary> - /// Gets the array of coniguration stores. + /// Gets the array of configuration stores. /// </summary> /// <returns>Array of ConfigurationStore.</returns> ConfigurationStore[] GetConfigurationStores(); diff --git a/MediaBrowser.Common/Net/INetworkManager.cs b/MediaBrowser.Common/Net/INetworkManager.cs index 78a391d36..d838144ff 100644 --- a/MediaBrowser.Common/Net/INetworkManager.cs +++ b/MediaBrowser.Common/Net/INetworkManager.cs @@ -95,12 +95,6 @@ namespace MediaBrowser.Common.Net string GetBindAddress(string source, out int? port); /// <summary> - /// Get a list of all the MAC addresses associated with active interfaces. - /// </summary> - /// <returns>List of MAC addresses.</returns> - IReadOnlyList<PhysicalAddress> GetMacAddresses(); - - /// <summary> /// Returns true if the address is part of the user defined LAN. /// </summary> /// <param name="address">IP to check.</param> diff --git a/MediaBrowser.Common/Net/NetworkConfiguration.cs b/MediaBrowser.Common/Net/NetworkConfiguration.cs index 61a51c99e..053357296 100644 --- a/MediaBrowser.Common/Net/NetworkConfiguration.cs +++ b/MediaBrowser.Common/Net/NetworkConfiguration.cs @@ -110,6 +110,7 @@ public class NetworkConfiguration /// <summary> /// Gets or sets a value indicating whether to enable automatic port forwarding. /// </summary> + [Obsolete("No longer supported")] public bool EnableUPnP { get; set; } /// <summary> diff --git a/MediaBrowser.Common/Net/NetworkUtils.cs b/MediaBrowser.Common/Net/NetworkUtils.cs index e482089f0..a498d6271 100644 --- a/MediaBrowser.Common/Net/NetworkUtils.cs +++ b/MediaBrowser.Common/Net/NetworkUtils.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; +using System.Globalization; using System.Net; using System.Net.Sockets; using System.Text.RegularExpressions; @@ -102,7 +103,7 @@ public static partial class NetworkUtils Span<byte> bytes = stackalloc byte[mask.AddressFamily == AddressFamily.InterNetwork ? NetworkConstants.IPv4MaskBytes : NetworkConstants.IPv6MaskBytes]; if (!mask.TryWriteBytes(bytes, out var bytesWritten)) { - Console.WriteLine("Unable to write address bytes, only ${bytesWritten} bytes written."); + Console.WriteLine("Unable to write address bytes, only {0} bytes written.", bytesWritten.ToString(CultureInfo.InvariantCulture)); } var zeroed = false; @@ -325,4 +326,23 @@ public static partial class NetworkUtils return new IPAddress(BitConverter.GetBytes(broadCastIPAddress)); } + + /// <summary> + /// Check if a subnet contains an address. This method also handles IPv4 mapped to IPv6 addresses. + /// </summary> + /// <param name="network">The <see cref="IPNetwork"/>.</param> + /// <param name="address">The <see cref="IPAddress"/>.</param> + /// <returns>Whether the supplied IP is in the supplied network.</returns> + public static bool SubnetContainsAddress(IPNetwork network, IPAddress address) + { + ArgumentNullException.ThrowIfNull(address); + ArgumentNullException.ThrowIfNull(network); + + if (address.IsIPv4MappedToIPv6) + { + address = address.MapToIPv4(); + } + + return network.Contains(address); + } } diff --git a/MediaBrowser.Common/Plugins/BasePluginOfT.cs b/MediaBrowser.Common/Plugins/BasePluginOfT.cs index bf2f12cb9..58992ecd7 100644 --- a/MediaBrowser.Common/Plugins/BasePluginOfT.cs +++ b/MediaBrowser.Common/Plugins/BasePluginOfT.cs @@ -4,6 +4,7 @@ using System; using System.IO; using System.Runtime.InteropServices; +using System.Threading; using MediaBrowser.Common.Configuration; using MediaBrowser.Model.Plugins; using MediaBrowser.Model.Serialization; @@ -20,12 +21,12 @@ namespace MediaBrowser.Common.Plugins /// <summary> /// The configuration sync lock. /// </summary> - private readonly object _configurationSyncLock = new object(); + private readonly Lock _configurationSyncLock = new(); /// <summary> /// The configuration save lock. /// </summary> - private readonly object _configurationSaveLock = new object(); + private readonly Lock _configurationSaveLock = new(); /// <summary> /// The configuration. diff --git a/MediaBrowser.Common/RequiresSourceSerialisationAttribute.cs b/MediaBrowser.Common/RequiresSourceSerialisationAttribute.cs new file mode 100644 index 000000000..b22e7cba1 --- /dev/null +++ b/MediaBrowser.Common/RequiresSourceSerialisationAttribute.cs @@ -0,0 +1,11 @@ +using System; + +namespace MediaBrowser.Common; + +/// <summary> +/// Marks a BaseItem as needing custom serialisation from the Data field of the db. +/// </summary> +[System.AttributeUsage(System.AttributeTargets.Class, Inherited = true, AllowMultiple = false)] +public sealed class RequiresSourceSerialisationAttribute : System.Attribute +{ +} |
