From f404e915eeef6cc9b05c6d006569b6d3a3e54eee Mon Sep 17 00:00:00 2001 From: Bond-009 Date: Wed, 3 Jun 2020 13:04:45 +0200 Subject: [PATCH] Enable StyleCop for MediaBrowser.Common --- .../Configuration/ConfigurationStore.cs | 20 +++++++++++++ .../Configuration/IApplicationPaths.cs | 22 +++++++------- .../Configuration/IConfigurationFactory.cs | 30 ------------------- .../Configuration/IConfigurationManager.cs | 2 +- .../Configuration/IValidatingConfiguration.cs | 15 ++++++++++ .../MediaBrowser.Common.csproj | 2 +- MediaBrowser.Common/Net/CacheMode.cs | 11 +++++++ MediaBrowser.Common/Net/CompressionMethods.cs | 15 ++++++++++ MediaBrowser.Common/Net/HttpRequestOptions.cs | 14 --------- .../Progress/ActionableProgress.cs | 17 +++-------- .../Progress/SimpleProgress.cs | 16 ++++++++++ 11 files changed, 94 insertions(+), 70 deletions(-) create mode 100644 MediaBrowser.Common/Configuration/ConfigurationStore.cs create mode 100644 MediaBrowser.Common/Configuration/IValidatingConfiguration.cs create mode 100644 MediaBrowser.Common/Net/CacheMode.cs create mode 100644 MediaBrowser.Common/Net/CompressionMethods.cs create mode 100644 MediaBrowser.Common/Progress/SimpleProgress.cs diff --git a/MediaBrowser.Common/Configuration/ConfigurationStore.cs b/MediaBrowser.Common/Configuration/ConfigurationStore.cs new file mode 100644 index 0000000000..d31d45e4c3 --- /dev/null +++ b/MediaBrowser.Common/Configuration/ConfigurationStore.cs @@ -0,0 +1,20 @@ +using System; + +namespace MediaBrowser.Common.Configuration +{ + /// + /// Describes a single entry in the application configuration. + /// + public class ConfigurationStore + { + /// + /// Gets or sets the unique identifier for the configuration. + /// + public string Key { get; set; } + + /// + /// Gets or sets the type used to store the data for this configuration entry. + /// + public Type ConfigurationType { get; set; } + } +} diff --git a/MediaBrowser.Common/Configuration/IApplicationPaths.cs b/MediaBrowser.Common/Configuration/IApplicationPaths.cs index 870b90796c..4cea616826 100644 --- a/MediaBrowser.Common/Configuration/IApplicationPaths.cs +++ b/MediaBrowser.Common/Configuration/IApplicationPaths.cs @@ -3,12 +3,12 @@ using MediaBrowser.Model.Configuration; namespace MediaBrowser.Common.Configuration { /// - /// Interface IApplicationPaths + /// Interface IApplicationPaths. /// public interface IApplicationPaths { /// - /// Gets the path to the program data folder + /// Gets the path to the program data folder. /// /// The program data path. string ProgramDataPath { get; } @@ -23,13 +23,13 @@ namespace MediaBrowser.Common.Configuration string WebPath { get; } /// - /// Gets the path to the program system folder + /// Gets the path to the program system folder. /// /// The program data path. string ProgramSystemPath { get; } /// - /// Gets the folder path to the data directory + /// Gets the folder path to the data directory. /// /// The data directory. string DataPath { get; } @@ -41,43 +41,43 @@ namespace MediaBrowser.Common.Configuration string ImageCachePath { get; } /// - /// Gets the path to the plugin directory + /// Gets the path to the plugin directory. /// /// The plugins path. string PluginsPath { get; } /// - /// Gets the path to the plugin configurations directory + /// Gets the path to the plugin configurations directory. /// /// The plugin configurations path. string PluginConfigurationsPath { get; } /// - /// Gets the path to the log directory + /// Gets the path to the log directory. /// /// The log directory path. string LogDirectoryPath { get; } /// - /// Gets the path to the application configuration root directory + /// Gets the path to the application configuration root directory. /// /// The configuration directory path. string ConfigurationDirectoryPath { get; } /// - /// Gets the path to the system configuration file + /// Gets the path to the system configuration file. /// /// The system configuration file path. string SystemConfigurationFilePath { get; } /// - /// Gets the folder path to the cache directory + /// Gets the folder path to the cache directory. /// /// The cache directory. string CachePath { get; } /// - /// Gets the folder path to the temp directory within the cache folder + /// Gets the folder path to the temp directory within the cache folder. /// /// The temp directory. string TempDirectory { get; } diff --git a/MediaBrowser.Common/Configuration/IConfigurationFactory.cs b/MediaBrowser.Common/Configuration/IConfigurationFactory.cs index 07ca2b58ba..6db1f1364b 100644 --- a/MediaBrowser.Common/Configuration/IConfigurationFactory.cs +++ b/MediaBrowser.Common/Configuration/IConfigurationFactory.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; namespace MediaBrowser.Common.Configuration @@ -15,33 +14,4 @@ namespace MediaBrowser.Common.Configuration /// The configuration store. IEnumerable GetConfigurations(); } - - /// - /// Describes a single entry in the application configuration. - /// - public class ConfigurationStore - { - /// - /// Gets or sets the unique identifier for the configuration. - /// - public string Key { get; set; } - - /// - /// Gets or sets the type used to store the data for this configuration entry. - /// - public Type ConfigurationType { get; set; } - } - - /// - /// A configuration store that can be validated. - /// - public interface IValidatingConfiguration - { - /// - /// Validation method to be invoked before saving the configuration. - /// - /// The old configuration. - /// The new configuration. - void Validate(object oldConfig, object newConfig); - } } diff --git a/MediaBrowser.Common/Configuration/IConfigurationManager.cs b/MediaBrowser.Common/Configuration/IConfigurationManager.cs index caf2edd836..fe726090d6 100644 --- a/MediaBrowser.Common/Configuration/IConfigurationManager.cs +++ b/MediaBrowser.Common/Configuration/IConfigurationManager.cs @@ -24,7 +24,7 @@ namespace MediaBrowser.Common.Configuration event EventHandler NamedConfigurationUpdated; /// - /// Gets or sets the application paths. + /// Gets the application paths. /// /// The application paths. IApplicationPaths CommonApplicationPaths { get; } diff --git a/MediaBrowser.Common/Configuration/IValidatingConfiguration.cs b/MediaBrowser.Common/Configuration/IValidatingConfiguration.cs new file mode 100644 index 0000000000..3b1d84f3c2 --- /dev/null +++ b/MediaBrowser.Common/Configuration/IValidatingConfiguration.cs @@ -0,0 +1,15 @@ +namespace MediaBrowser.Common.Configuration +{ + /// + /// A configuration store that can be validated. + /// + public interface IValidatingConfiguration + { + /// + /// Validation method to be invoked before saving the configuration. + /// + /// The old configuration. + /// The new configuration. + void Validate(object oldConfig, object newConfig); + } +} diff --git a/MediaBrowser.Common/MediaBrowser.Common.csproj b/MediaBrowser.Common/MediaBrowser.Common.csproj index a597b90524..0713b83b75 100644 --- a/MediaBrowser.Common/MediaBrowser.Common.csproj +++ b/MediaBrowser.Common/MediaBrowser.Common.csproj @@ -37,7 +37,7 @@ - + diff --git a/MediaBrowser.Common/Net/CacheMode.cs b/MediaBrowser.Common/Net/CacheMode.cs new file mode 100644 index 0000000000..78fa3bf9bb --- /dev/null +++ b/MediaBrowser.Common/Net/CacheMode.cs @@ -0,0 +1,11 @@ +#pragma warning disable CS1591 +#pragma warning disable SA1602 + +namespace MediaBrowser.Common.Net +{ + public enum CacheMode + { + None = 0, + Unconditional = 1 + } +} diff --git a/MediaBrowser.Common/Net/CompressionMethods.cs b/MediaBrowser.Common/Net/CompressionMethods.cs new file mode 100644 index 0000000000..39b72609fe --- /dev/null +++ b/MediaBrowser.Common/Net/CompressionMethods.cs @@ -0,0 +1,15 @@ +#pragma warning disable CS1591 +#pragma warning disable SA1602 + +using System; + +namespace MediaBrowser.Common.Net +{ + [Flags] + public enum CompressionMethods + { + None = 0b00000001, + Deflate = 0b00000010, + Gzip = 0b00000100 + } +} diff --git a/MediaBrowser.Common/Net/HttpRequestOptions.cs b/MediaBrowser.Common/Net/HttpRequestOptions.cs index 38274a80e4..347fc98332 100644 --- a/MediaBrowser.Common/Net/HttpRequestOptions.cs +++ b/MediaBrowser.Common/Net/HttpRequestOptions.cs @@ -102,18 +102,4 @@ namespace MediaBrowser.Common.Net return value; } } - - public enum CacheMode - { - None = 0, - Unconditional = 1 - } - - [Flags] - public enum CompressionMethods - { - None = 0b00000001, - Deflate = 0b00000010, - Gzip = 0b00000100 - } } diff --git a/MediaBrowser.Common/Progress/ActionableProgress.cs b/MediaBrowser.Common/Progress/ActionableProgress.cs index af69055aa9..d5bcd5be96 100644 --- a/MediaBrowser.Common/Progress/ActionableProgress.cs +++ b/MediaBrowser.Common/Progress/ActionableProgress.cs @@ -5,15 +5,16 @@ using System; namespace MediaBrowser.Common.Progress { /// - /// Class ActionableProgress + /// Class ActionableProgress. /// - /// + /// The type for the action parameter. public class ActionableProgress : IProgress { /// - /// The _actions + /// The _actions. /// private Action _action; + public event EventHandler ProgressChanged; /// @@ -32,14 +33,4 @@ namespace MediaBrowser.Common.Progress _action?.Invoke(value); } } - - public class SimpleProgress : IProgress - { - public event EventHandler ProgressChanged; - - public void Report(T value) - { - ProgressChanged?.Invoke(this, value); - } - } } diff --git a/MediaBrowser.Common/Progress/SimpleProgress.cs b/MediaBrowser.Common/Progress/SimpleProgress.cs new file mode 100644 index 0000000000..d75675bf17 --- /dev/null +++ b/MediaBrowser.Common/Progress/SimpleProgress.cs @@ -0,0 +1,16 @@ +#pragma warning disable CS1591 + +using System; + +namespace MediaBrowser.Common.Progress +{ + public class SimpleProgress : IProgress + { + public event EventHandler ProgressChanged; + + public void Report(T value) + { + ProgressChanged?.Invoke(this, value); + } + } +}