diff options
Diffstat (limited to 'MediaBrowser.Common')
23 files changed, 70 insertions, 165 deletions
diff --git a/MediaBrowser.Common/Configuration/ConfigurationUpdateEventArgs.cs b/MediaBrowser.Common/Configuration/ConfigurationUpdateEventArgs.cs index 310e2aa638..0b59627cc8 100644 --- a/MediaBrowser.Common/Configuration/ConfigurationUpdateEventArgs.cs +++ b/MediaBrowser.Common/Configuration/ConfigurationUpdateEventArgs.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace MediaBrowser.Common.Configuration { diff --git a/MediaBrowser.Common/Configuration/IApplicationPaths.cs b/MediaBrowser.Common/Configuration/IApplicationPaths.cs index c6256bc5a4..27092c0e1a 100644 --- a/MediaBrowser.Common/Configuration/IApplicationPaths.cs +++ b/MediaBrowser.Common/Configuration/IApplicationPaths.cs @@ -1,4 +1,3 @@ - namespace MediaBrowser.Common.Configuration { /// <summary> diff --git a/MediaBrowser.Common/Configuration/IConfigurationFactory.cs b/MediaBrowser.Common/Configuration/IConfigurationFactory.cs index 6ed6385360..0fb2b83d1b 100644 --- a/MediaBrowser.Common/Configuration/IConfigurationFactory.cs +++ b/MediaBrowser.Common/Configuration/IConfigurationFactory.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; namespace MediaBrowser.Common.Configuration diff --git a/MediaBrowser.Common/Configuration/IConfigurationManager.cs b/MediaBrowser.Common/Configuration/IConfigurationManager.cs index d826a3ee78..8fed2dcdf4 100644 --- a/MediaBrowser.Common/Configuration/IConfigurationManager.cs +++ b/MediaBrowser.Common/Configuration/IConfigurationManager.cs @@ -1,6 +1,6 @@ -using MediaBrowser.Model.Configuration; using System; using System.Collections.Generic; +using MediaBrowser.Model.Configuration; namespace MediaBrowser.Common.Configuration { diff --git a/MediaBrowser.Common/Events/EventHelper.cs b/MediaBrowser.Common/Events/EventHelper.cs index 2630ce7da9..0ac7905a18 100644 --- a/MediaBrowser.Common/Events/EventHelper.cs +++ b/MediaBrowser.Common/Events/EventHelper.cs @@ -1,6 +1,6 @@ -using Microsoft.Extensions.Logging; using System; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace MediaBrowser.Common.Events { diff --git a/MediaBrowser.Common/Extensions/BaseExtensions.cs b/MediaBrowser.Common/Extensions/BaseExtensions.cs index 520c04244e..db0514bb18 100644 --- a/MediaBrowser.Common/Extensions/BaseExtensions.cs +++ b/MediaBrowser.Common/Extensions/BaseExtensions.cs @@ -1,5 +1,4 @@ -using System; -using System.Globalization; +using System; using System.Text.RegularExpressions; using MediaBrowser.Model.Cryptography; diff --git a/MediaBrowser.Common/Extensions/ResourceNotFoundException.cs b/MediaBrowser.Common/Extensions/ResourceNotFoundException.cs index 89e20b1b41..f62c65fd7f 100644 --- a/MediaBrowser.Common/Extensions/ResourceNotFoundException.cs +++ b/MediaBrowser.Common/Extensions/ResourceNotFoundException.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace MediaBrowser.Common.Extensions { diff --git a/MediaBrowser.Common/IApplicationHost.cs b/MediaBrowser.Common/IApplicationHost.cs index c4f760b151..385127c54b 100644 --- a/MediaBrowser.Common/IApplicationHost.cs +++ b/MediaBrowser.Common/IApplicationHost.cs @@ -1,10 +1,10 @@ -using MediaBrowser.Common.Plugins; -using MediaBrowser.Model.Events; -using MediaBrowser.Model.Updates; using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Common.Plugins; +using MediaBrowser.Model.Events; +using MediaBrowser.Model.Updates; namespace MediaBrowser.Common { @@ -69,7 +69,13 @@ namespace MediaBrowser.Common /// Gets the application version. /// </summary> /// <value>The application version.</value> - Version ApplicationVersion { get; } + string ApplicationVersion { get; } + + /// <summary> + /// Gets the application user agent. + /// </summary> + /// <value>The application user agent.</value> + string ApplicationUserAgent { get; } /// <summary> /// Gets or sets a value indicating whether this instance can self update. diff --git a/MediaBrowser.Common/MediaBrowser.Common.csproj b/MediaBrowser.Common/MediaBrowser.Common.csproj index a485fa8be0..2220d46610 100644 --- a/MediaBrowser.Common/MediaBrowser.Common.csproj +++ b/MediaBrowser.Common/MediaBrowser.Common.csproj @@ -1,8 +1,10 @@ -<Project Sdk="Microsoft.NET.Sdk"> +<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <Authors>Jellyfin Contributors</Authors> <PackageId>Jellyfin.Common</PackageId> + <PackageLicenseUrl>https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt</PackageLicenseUrl> + <RepositoryUrl>https://github.com/jellyfin/jellyfin</RepositoryUrl> </PropertyGroup> <ItemGroup> diff --git a/MediaBrowser.Common/Net/HttpRequestOptions.cs b/MediaBrowser.Common/Net/HttpRequestOptions.cs index c61e88c878..dadac5e03d 100644 --- a/MediaBrowser.Common/Net/HttpRequestOptions.cs +++ b/MediaBrowser.Common/Net/HttpRequestOptions.cs @@ -1,9 +1,7 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; -using System.Net; using System.Threading; -using System.Text; namespace MediaBrowser.Common.Net { @@ -26,11 +24,8 @@ namespace MediaBrowser.Common.Net /// <value>The accept header.</value> public string AcceptHeader { - get { return GetHeaderValue("Accept"); } - set - { - RequestHeaders["Accept"] = value; - } + get => GetHeaderValue("Accept"); + set => RequestHeaders["Accept"] = value; } /// <summary> /// Gets or sets the cancellation token. @@ -50,11 +45,8 @@ namespace MediaBrowser.Common.Net /// <value>The user agent.</value> public string UserAgent { - get { return GetHeaderValue("User-Agent"); } - set - { - RequestHeaders["User-Agent"] = value; - } + get => GetHeaderValue("User-Agent"); + set => RequestHeaders["User-Agent"] = value; } /// <summary> @@ -110,9 +102,7 @@ namespace MediaBrowser.Common.Net private string GetHeaderValue(string name) { - string value; - - RequestHeaders.TryGetValue(name, out value); + RequestHeaders.TryGetValue(name, out var value); return value; } @@ -133,7 +123,7 @@ namespace MediaBrowser.Common.Net TimeoutMs = 20000; } - public void SetPostData(IDictionary<string,string> values) + public void SetPostData(IDictionary<string, string> values) { var strings = values.Keys.Select(key => string.Format("{0}={1}", key, values[key])); var postContent = string.Join("&", strings.ToArray()); diff --git a/MediaBrowser.Common/Net/HttpResponseInfo.cs b/MediaBrowser.Common/Net/HttpResponseInfo.cs index ed941a4474..1866741676 100644 --- a/MediaBrowser.Common/Net/HttpResponseInfo.cs +++ b/MediaBrowser.Common/Net/HttpResponseInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Net; @@ -21,7 +21,7 @@ namespace MediaBrowser.Common.Net /// </summary> /// <value>The response URL.</value> public string ResponseUrl { get; set; } - + /// <summary> /// Gets or sets the content. /// </summary> @@ -50,7 +50,7 @@ namespace MediaBrowser.Common.Net /// Gets or sets the headers. /// </summary> /// <value>The headers.</value> - public Dictionary<string,string> Headers { get; set; } + public Dictionary<string, string> Headers { get; set; } private readonly IDisposable _disposable; diff --git a/MediaBrowser.Common/Net/IHttpClient.cs b/MediaBrowser.Common/Net/IHttpClient.cs index f88cfbb2b5..5aaf7e0be6 100644 --- a/MediaBrowser.Common/Net/IHttpClient.cs +++ b/MediaBrowser.Common/Net/IHttpClient.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using System.Threading.Tasks; namespace MediaBrowser.Common.Net @@ -43,7 +43,7 @@ namespace MediaBrowser.Common.Net /// <param name="options">The options.</param> /// <returns>Task{System.String}.</returns> /// <exception cref="System.ArgumentNullException">progress</exception> - /// <exception cref="MediaBrowser.Model.Net.HttpException"></exception> + /// <exception cref="Model.Net.HttpException"></exception> Task<string> GetTempFile(HttpRequestOptions options); /// <summary> diff --git a/MediaBrowser.Common/Net/INetworkManager.cs b/MediaBrowser.Common/Net/INetworkManager.cs index b2ff797bcf..72fb6e2b86 100644 --- a/MediaBrowser.Common/Net/INetworkManager.cs +++ b/MediaBrowser.Common/Net/INetworkManager.cs @@ -1,8 +1,8 @@ -using MediaBrowser.Model.IO; -using MediaBrowser.Model.Net; -using System.Collections.Generic; using System; +using System.Collections.Generic; using System.Threading.Tasks; +using MediaBrowser.Model.IO; +using MediaBrowser.Model.Net; namespace MediaBrowser.Common.Net { @@ -63,4 +63,4 @@ namespace MediaBrowser.Common.Net bool IsAddressInSubnets(string addressString, string[] subnets); } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Common/Plugins/BasePlugin.cs b/MediaBrowser.Common/Plugins/BasePlugin.cs index 82eb6ba4bf..1ff2e98ef7 100644 --- a/MediaBrowser.Common/Plugins/BasePlugin.cs +++ b/MediaBrowser.Common/Plugins/BasePlugin.cs @@ -1,8 +1,8 @@ -using MediaBrowser.Common.Configuration; -using MediaBrowser.Model.Plugins; -using MediaBrowser.Model.Serialization; using System; using System.IO; +using MediaBrowser.Common.Configuration; +using MediaBrowser.Model.Plugins; +using MediaBrowser.Model.Serialization; namespace MediaBrowser.Common.Plugins { @@ -18,10 +18,7 @@ namespace MediaBrowser.Common.Plugins /// Gets the description. /// </summary> /// <value>The description.</value> - public virtual string Description - { - get { return string.Empty; } - } + public virtual string Description => string.Empty; /// <summary> /// Gets the unique id. @@ -108,10 +105,7 @@ namespace MediaBrowser.Common.Plugins /// Gets the type of configuration this plugin uses /// </summary> /// <value>The type of the configuration.</value> - public Type ConfigurationType - { - get { return typeof(TConfigurationType); } - } + public Type ConfigurationType => typeof(TConfigurationType); private Action<string> _directoryCreateFn; public void SetStartupInfo(Action<string> directoryCreateFn) @@ -124,13 +118,7 @@ namespace MediaBrowser.Common.Plugins /// Gets the name the assembly file /// </summary> /// <value>The name of the assembly file.</value> - protected string AssemblyFileName - { - get - { - return Path.GetFileName(AssemblyFilePath); - } - } + protected string AssemblyFileName => Path.GetFileName(AssemblyFilePath); /// <summary> /// The _configuration sync lock @@ -161,10 +149,7 @@ namespace MediaBrowser.Common.Plugins } return _configuration; } - protected set - { - _configuration = value; - } + protected set => _configuration = value; } private TConfigurationType LoadConfiguration() @@ -185,22 +170,13 @@ namespace MediaBrowser.Common.Plugins /// Gets the name of the configuration file. Subclasses should override /// </summary> /// <value>The name of the configuration file.</value> - public virtual string ConfigurationFileName - { - get { return Path.ChangeExtension(AssemblyFileName, ".xml"); } - } + public virtual string ConfigurationFileName => Path.ChangeExtension(AssemblyFileName, ".xml"); /// <summary> /// Gets the full path to the configuration file /// </summary> /// <value>The configuration file path.</value> - public string ConfigurationFilePath - { - get - { - return Path.Combine(ApplicationPaths.PluginConfigurationsPath, ConfigurationFileName); - } - } + public string ConfigurationFilePath => Path.Combine(ApplicationPaths.PluginConfigurationsPath, ConfigurationFileName); /// <summary> /// Initializes a new instance of the <see cref="BasePlugin{TConfigurationType}" /> class. @@ -236,12 +212,12 @@ namespace MediaBrowser.Common.Plugins /// Returns true or false indicating success or failure /// </summary> /// <param name="configuration">The configuration.</param> - /// <exception cref="System.ArgumentNullException">configuration</exception> + /// <exception cref="ArgumentNullException">configuration</exception> public virtual void UpdateConfiguration(BasePluginConfiguration configuration) { if (configuration == null) { - throw new ArgumentNullException("configuration"); + throw new ArgumentNullException(nameof(configuration)); } Configuration = (TConfigurationType)configuration; @@ -253,10 +229,7 @@ namespace MediaBrowser.Common.Plugins /// Gets the plugin's configuration /// </summary> /// <value>The configuration.</value> - BasePluginConfiguration IHasPluginConfiguration.Configuration - { - get { return Configuration; } - } + BasePluginConfiguration IHasPluginConfiguration.Configuration => Configuration; public override PluginInfo GetPluginInfo() { diff --git a/MediaBrowser.Common/Plugins/IPlugin.cs b/MediaBrowser.Common/Plugins/IPlugin.cs index bffd211439..32527c2997 100644 --- a/MediaBrowser.Common/Plugins/IPlugin.cs +++ b/MediaBrowser.Common/Plugins/IPlugin.cs @@ -1,5 +1,5 @@ -using MediaBrowser.Model.Plugins; using System; +using MediaBrowser.Model.Plugins; namespace MediaBrowser.Common.Plugins { @@ -69,7 +69,7 @@ namespace MediaBrowser.Common.Plugins /// Returns true or false indicating success or failure /// </summary> /// <param name="configuration">The configuration.</param> - /// <exception cref="System.ArgumentNullException">configuration</exception> + /// <exception cref="ArgumentNullException">configuration</exception> void UpdateConfiguration(BasePluginConfiguration configuration); /// <summary> @@ -80,4 +80,4 @@ namespace MediaBrowser.Common.Plugins void SetStartupInfo(Action<string> directoryCreateFn); } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Common/Progress/ActionableProgress.cs b/MediaBrowser.Common/Progress/ActionableProgress.cs index 67347bc157..9fe01931f5 100644 --- a/MediaBrowser.Common/Progress/ActionableProgress.cs +++ b/MediaBrowser.Common/Progress/ActionableProgress.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System; namespace MediaBrowser.Common.Progress { diff --git a/MediaBrowser.Common/Properties/AssemblyInfo.cs b/MediaBrowser.Common/Properties/AssemblyInfo.cs index 09fd68f93a..1a8fdb618d 100644 --- a/MediaBrowser.Common/Properties/AssemblyInfo.cs +++ b/MediaBrowser.Common/Properties/AssemblyInfo.cs @@ -1,27 +1,21 @@ -using System.Reflection; +using System.Reflection; +using System.Resources; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("MediaBrowser.Common")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("MediaBrowser.Common")] -[assembly: AssemblyCopyright("Copyright © 2012")] +[assembly: AssemblyCompany("Jellyfin Project")] +[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")] +[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] +[assembly: NeutralResourcesLanguage("en")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -//
\ No newline at end of file diff --git a/MediaBrowser.Common/Security/IRequiresRegistration.cs b/MediaBrowser.Common/Security/IRequiresRegistration.cs deleted file mode 100644 index 7b1667c2e2..0000000000 --- a/MediaBrowser.Common/Security/IRequiresRegistration.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Threading.Tasks; - -namespace MediaBrowser.Common.Security -{ - public interface IRequiresRegistration - { - /// <summary> - /// Load all registration information required for this entity. - /// Your class should re-load all MBRegistrationRecords when this is called even if they were - /// previously loaded. - /// </summary> - /// <returns></returns> - Task LoadRegistrationInfoAsync(); - } -} diff --git a/MediaBrowser.Common/Security/ISecurityManager.cs b/MediaBrowser.Common/Security/ISecurityManager.cs deleted file mode 100644 index b63a9efd09..0000000000 --- a/MediaBrowser.Common/Security/ISecurityManager.cs +++ /dev/null @@ -1,32 +0,0 @@ -using MediaBrowser.Model.Entities; -using System.Threading.Tasks; - -namespace MediaBrowser.Common.Security -{ - public interface ISecurityManager - { - /// <summary> - /// Gets a value indicating whether this instance is MB supporter. - /// </summary> - /// <value><c>true</c> if this instance is MB supporter; otherwise, <c>false</c>.</value> - Task<bool> IsSupporter(); - - /// <summary> - /// Gets or sets the supporter key. - /// </summary> - /// <value>The supporter key.</value> - string SupporterKey { get; } - - /// <summary> - /// Gets the registration status. Overload to support existing plug-ins. - /// </summary> - Task<MBRegistrationRecord> GetRegistrationStatus(string feature); - - /// <summary> - /// Register and app store sale with our back-end - /// </summary> - /// <param name="parameters">Json parameters to pass to admin server</param> - Task RegisterAppStoreSale(string parameters); - Task UpdateSupporterKey(string newValue); - } -}
\ No newline at end of file diff --git a/MediaBrowser.Common/Security/PaymentRequiredException.cs b/MediaBrowser.Common/Security/PaymentRequiredException.cs deleted file mode 100644 index 27b3e69613..0000000000 --- a/MediaBrowser.Common/Security/PaymentRequiredException.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System; - -namespace MediaBrowser.Common.Security -{ - public class PaymentRequiredException : Exception - { - } -} diff --git a/MediaBrowser.Common/Updates/IInstallationManager.cs b/MediaBrowser.Common/Updates/IInstallationManager.cs index dab38b27c2..a263be35f9 100644 --- a/MediaBrowser.Common/Updates/IInstallationManager.cs +++ b/MediaBrowser.Common/Updates/IInstallationManager.cs @@ -1,10 +1,10 @@ -using MediaBrowser.Common.Plugins; -using MediaBrowser.Model.Events; -using MediaBrowser.Model.Updates; using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Common.Plugins; +using MediaBrowser.Model.Events; +using MediaBrowser.Model.Updates; namespace MediaBrowser.Common.Updates { @@ -49,9 +49,7 @@ namespace MediaBrowser.Common.Updates /// <param name="applicationVersion">The application version.</param> /// <returns>Task{List{PackageInfo}}.</returns> Task<List<PackageInfo>> GetAvailablePackages(CancellationToken cancellationToken, - bool withRegistration = true, - string packageType = null, - Version applicationVersion = null); + bool withRegistration = true, string packageType = null, Version applicationVersion = null); /// <summary> /// Gets all available packages from a static resource. @@ -108,14 +106,14 @@ namespace MediaBrowser.Common.Updates /// <param name="progress">The progress.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>Task.</returns> - /// <exception cref="System.ArgumentNullException">package</exception> + /// <exception cref="ArgumentNullException">package</exception> Task InstallPackage(PackageVersionInfo package, bool isPlugin, IProgress<double> progress, CancellationToken cancellationToken); /// <summary> /// Uninstalls a plugin /// </summary> /// <param name="plugin">The plugin.</param> - /// <exception cref="System.ArgumentException"></exception> + /// <exception cref="ArgumentException"></exception> void UninstallPlugin(IPlugin plugin); } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Common/Updates/InstallationEventArgs.cs b/MediaBrowser.Common/Updates/InstallationEventArgs.cs index 9dc8ead835..9f215e8890 100644 --- a/MediaBrowser.Common/Updates/InstallationEventArgs.cs +++ b/MediaBrowser.Common/Updates/InstallationEventArgs.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Model.Updates; +using MediaBrowser.Model.Updates; namespace MediaBrowser.Common.Updates { diff --git a/MediaBrowser.Common/Updates/InstallationFailedEventArgs.cs b/MediaBrowser.Common/Updates/InstallationFailedEventArgs.cs index 69dc1ee982..43adfb02d9 100644 --- a/MediaBrowser.Common/Updates/InstallationFailedEventArgs.cs +++ b/MediaBrowser.Common/Updates/InstallationFailedEventArgs.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace MediaBrowser.Common.Updates { @@ -6,4 +6,4 @@ namespace MediaBrowser.Common.Updates { public Exception Exception { get; set; } } -}
\ No newline at end of file +} |
