Enable StyleCop for MediaBrowser.Common
This commit is contained in:
parent
40502a33e0
commit
f404e915ee
20
MediaBrowser.Common/Configuration/ConfigurationStore.cs
Normal file
20
MediaBrowser.Common/Configuration/ConfigurationStore.cs
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Common.Configuration
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Describes a single entry in the application configuration.
|
||||||
|
/// </summary>
|
||||||
|
public class ConfigurationStore
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the unique identifier for the configuration.
|
||||||
|
/// </summary>
|
||||||
|
public string Key { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the type used to store the data for this configuration entry.
|
||||||
|
/// </summary>
|
||||||
|
public Type ConfigurationType { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,12 +3,12 @@ using MediaBrowser.Model.Configuration;
|
||||||
namespace MediaBrowser.Common.Configuration
|
namespace MediaBrowser.Common.Configuration
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interface IApplicationPaths
|
/// Interface IApplicationPaths.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IApplicationPaths
|
public interface IApplicationPaths
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the path to the program data folder
|
/// Gets the path to the program data folder.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The program data path.</value>
|
/// <value>The program data path.</value>
|
||||||
string ProgramDataPath { get; }
|
string ProgramDataPath { get; }
|
||||||
|
@ -23,13 +23,13 @@ namespace MediaBrowser.Common.Configuration
|
||||||
string WebPath { get; }
|
string WebPath { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the path to the program system folder
|
/// Gets the path to the program system folder.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The program data path.</value>
|
/// <value>The program data path.</value>
|
||||||
string ProgramSystemPath { get; }
|
string ProgramSystemPath { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the folder path to the data directory
|
/// Gets the folder path to the data directory.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The data directory.</value>
|
/// <value>The data directory.</value>
|
||||||
string DataPath { get; }
|
string DataPath { get; }
|
||||||
|
@ -41,43 +41,43 @@ namespace MediaBrowser.Common.Configuration
|
||||||
string ImageCachePath { get; }
|
string ImageCachePath { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the path to the plugin directory
|
/// Gets the path to the plugin directory.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The plugins path.</value>
|
/// <value>The plugins path.</value>
|
||||||
string PluginsPath { get; }
|
string PluginsPath { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the path to the plugin configurations directory
|
/// Gets the path to the plugin configurations directory.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The plugin configurations path.</value>
|
/// <value>The plugin configurations path.</value>
|
||||||
string PluginConfigurationsPath { get; }
|
string PluginConfigurationsPath { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the path to the log directory
|
/// Gets the path to the log directory.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The log directory path.</value>
|
/// <value>The log directory path.</value>
|
||||||
string LogDirectoryPath { get; }
|
string LogDirectoryPath { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the path to the application configuration root directory
|
/// Gets the path to the application configuration root directory.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The configuration directory path.</value>
|
/// <value>The configuration directory path.</value>
|
||||||
string ConfigurationDirectoryPath { get; }
|
string ConfigurationDirectoryPath { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the path to the system configuration file
|
/// Gets the path to the system configuration file.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The system configuration file path.</value>
|
/// <value>The system configuration file path.</value>
|
||||||
string SystemConfigurationFilePath { get; }
|
string SystemConfigurationFilePath { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the folder path to the cache directory
|
/// Gets the folder path to the cache directory.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The cache directory.</value>
|
/// <value>The cache directory.</value>
|
||||||
string CachePath { get; }
|
string CachePath { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the folder path to the temp directory within the cache folder
|
/// Gets the folder path to the temp directory within the cache folder.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The temp directory.</value>
|
/// <value>The temp directory.</value>
|
||||||
string TempDirectory { get; }
|
string TempDirectory { get; }
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace MediaBrowser.Common.Configuration
|
namespace MediaBrowser.Common.Configuration
|
||||||
|
@ -15,33 +14,4 @@ namespace MediaBrowser.Common.Configuration
|
||||||
/// <returns>The configuration store.</returns>
|
/// <returns>The configuration store.</returns>
|
||||||
IEnumerable<ConfigurationStore> GetConfigurations();
|
IEnumerable<ConfigurationStore> GetConfigurations();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Describes a single entry in the application configuration.
|
|
||||||
/// </summary>
|
|
||||||
public class ConfigurationStore
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the unique identifier for the configuration.
|
|
||||||
/// </summary>
|
|
||||||
public string Key { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the type used to store the data for this configuration entry.
|
|
||||||
/// </summary>
|
|
||||||
public Type ConfigurationType { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A configuration store that can be validated.
|
|
||||||
/// </summary>
|
|
||||||
public interface IValidatingConfiguration
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Validation method to be invoked before saving the configuration.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="oldConfig">The old configuration.</param>
|
|
||||||
/// <param name="newConfig">The new configuration.</param>
|
|
||||||
void Validate(object oldConfig, object newConfig);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace MediaBrowser.Common.Configuration
|
||||||
event EventHandler<ConfigurationUpdateEventArgs> NamedConfigurationUpdated;
|
event EventHandler<ConfigurationUpdateEventArgs> NamedConfigurationUpdated;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the application paths.
|
/// Gets the application paths.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The application paths.</value>
|
/// <value>The application paths.</value>
|
||||||
IApplicationPaths CommonApplicationPaths { get; }
|
IApplicationPaths CommonApplicationPaths { get; }
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
namespace MediaBrowser.Common.Configuration
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A configuration store that can be validated.
|
||||||
|
/// </summary>
|
||||||
|
public interface IValidatingConfiguration
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Validation method to be invoked before saving the configuration.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="oldConfig">The old configuration.</param>
|
||||||
|
/// <param name="newConfig">The new configuration.</param>
|
||||||
|
void Validate(object oldConfig, object newConfig);
|
||||||
|
}
|
||||||
|
}
|
|
@ -37,7 +37,7 @@
|
||||||
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
|
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8" PrivateAssets="All" />
|
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8" PrivateAssets="All" />
|
||||||
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
|
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
|
||||||
<!-- <PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> -->
|
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" />
|
||||||
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
|
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
11
MediaBrowser.Common/Net/CacheMode.cs
Normal file
11
MediaBrowser.Common/Net/CacheMode.cs
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#pragma warning disable CS1591
|
||||||
|
#pragma warning disable SA1602
|
||||||
|
|
||||||
|
namespace MediaBrowser.Common.Net
|
||||||
|
{
|
||||||
|
public enum CacheMode
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
Unconditional = 1
|
||||||
|
}
|
||||||
|
}
|
15
MediaBrowser.Common/Net/CompressionMethods.cs
Normal file
15
MediaBrowser.Common/Net/CompressionMethods.cs
Normal file
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
|
@ -102,18 +102,4 @@ namespace MediaBrowser.Common.Net
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum CacheMode
|
|
||||||
{
|
|
||||||
None = 0,
|
|
||||||
Unconditional = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
[Flags]
|
|
||||||
public enum CompressionMethods
|
|
||||||
{
|
|
||||||
None = 0b00000001,
|
|
||||||
Deflate = 0b00000010,
|
|
||||||
Gzip = 0b00000100
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,15 +5,16 @@ using System;
|
||||||
namespace MediaBrowser.Common.Progress
|
namespace MediaBrowser.Common.Progress
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class ActionableProgress
|
/// Class ActionableProgress.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T"></typeparam>
|
/// <typeparam name="T">The type for the action parameter.</typeparam>
|
||||||
public class ActionableProgress<T> : IProgress<T>
|
public class ActionableProgress<T> : IProgress<T>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The _actions
|
/// The _actions.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private Action<T> _action;
|
private Action<T> _action;
|
||||||
|
|
||||||
public event EventHandler<T> ProgressChanged;
|
public event EventHandler<T> ProgressChanged;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -32,14 +33,4 @@ namespace MediaBrowser.Common.Progress
|
||||||
_action?.Invoke(value);
|
_action?.Invoke(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SimpleProgress<T> : IProgress<T>
|
|
||||||
{
|
|
||||||
public event EventHandler<T> ProgressChanged;
|
|
||||||
|
|
||||||
public void Report(T value)
|
|
||||||
{
|
|
||||||
ProgressChanged?.Invoke(this, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
16
MediaBrowser.Common/Progress/SimpleProgress.cs
Normal file
16
MediaBrowser.Common/Progress/SimpleProgress.cs
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
#pragma warning disable CS1591
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Common.Progress
|
||||||
|
{
|
||||||
|
public class SimpleProgress<T> : IProgress<T>
|
||||||
|
{
|
||||||
|
public event EventHandler<T> ProgressChanged;
|
||||||
|
|
||||||
|
public void Report(T value)
|
||||||
|
{
|
||||||
|
ProgressChanged?.Invoke(this, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user