repo creation with initial code after cloning public repo

This commit is contained in:
2026-02-19 07:36:25 -05:00
commit 460884fea3
2860 changed files with 650825 additions and 0 deletions
@@ -0,0 +1,22 @@
#nullable disable
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; }
}
}
@@ -0,0 +1,33 @@
using System;
namespace MediaBrowser.Common.Configuration
{
/// <summary>
/// <see cref="EventArgs" /> for the ConfigurationUpdated event.
/// </summary>
public class ConfigurationUpdateEventArgs : EventArgs
{
/// <summary>
/// Initializes a new instance of the <see cref="ConfigurationUpdateEventArgs"/> class.
/// </summary>
/// <param name="key">The configuration key.</param>
/// <param name="newConfiguration">The new configuration.</param>
public ConfigurationUpdateEventArgs(string key, object newConfiguration)
{
Key = key;
NewConfiguration = newConfiguration;
}
/// <summary>
/// Gets the key.
/// </summary>
/// <value>The key.</value>
public string Key { get; }
/// <summary>
/// Gets the new configuration.
/// </summary>
/// <value>The new configuration.</value>
public object NewConfiguration { get; }
}
}
@@ -0,0 +1,42 @@
using System;
using System.IO;
using MediaBrowser.Model.Configuration;
namespace MediaBrowser.Common.Configuration
{
/// <summary>
/// Class containing extension methods for working with the encoding configuration.
/// </summary>
public static class EncodingConfigurationExtensions
{
/// <summary>
/// Gets the encoding options.
/// </summary>
/// <param name="configurationManager">The configuration manager.</param>
/// <returns>The encoding options.</returns>
public static EncodingOptions GetEncodingOptions(this IConfigurationManager configurationManager)
=> configurationManager.GetConfiguration<EncodingOptions>("encoding");
/// <summary>
/// Retrieves the transcoding temp path from the encoding configuration, falling back to a default if no path
/// is specified in configuration. If the directory does not exist, it will be created.
/// </summary>
/// <param name="configurationManager">The configuration manager.</param>
/// <returns>The transcoding temp path.</returns>
/// <exception cref="UnauthorizedAccessException">If the directory does not exist, and the caller does not have the required permission to create it.</exception>
/// <exception cref="NotSupportedException">If there is a custom path transcoding path specified, but it is invalid.</exception>
/// <exception cref="IOException">If the directory does not exist, and it also could not be created.</exception>
public static string GetTranscodePath(this IConfigurationManager configurationManager)
{
// Get the configured path and fall back to a default
var transcodingTempPath = configurationManager.GetEncodingOptions().TranscodingTempPath;
if (string.IsNullOrEmpty(transcodingTempPath))
{
transcodingTempPath = Path.Combine(configurationManager.CommonApplicationPaths.CachePath, "transcodes");
}
configurationManager.CommonApplicationPaths.CreateAndCheckMarker(transcodingTempPath, "transcode", true);
return transcodingTempPath;
}
}
}
@@ -0,0 +1,113 @@
namespace MediaBrowser.Common.Configuration
{
/// <summary>
/// Interface IApplicationPaths.
/// </summary>
public interface IApplicationPaths
{
/// <summary>
/// Gets the path to the program data folder.
/// </summary>
/// <value>The program data path.</value>
string ProgramDataPath { get; }
/// <summary>
/// Gets the path to the web UI resources folder.
/// </summary>
/// <remarks>
/// This value is not relevant if the server is configured to not host any static web content.
/// </remarks>
string WebPath { get; }
/// <summary>
/// Gets the path to the program system folder.
/// </summary>
/// <value>The program data path.</value>
string ProgramSystemPath { get; }
/// <summary>
/// Gets the folder path to the data directory.
/// </summary>
/// <value>The data directory.</value>
string DataPath { get; }
/// <summary>
/// Gets the image cache path.
/// </summary>
/// <value>The image cache path.</value>
string ImageCachePath { get; }
/// <summary>
/// Gets the path to the plugin directory.
/// </summary>
/// <value>The plugins path.</value>
string PluginsPath { get; }
/// <summary>
/// Gets the path to the plugin configurations directory.
/// </summary>
/// <value>The plugin configurations path.</value>
string PluginConfigurationsPath { get; }
/// <summary>
/// Gets the path to the log directory.
/// </summary>
/// <value>The log directory path.</value>
string LogDirectoryPath { get; }
/// <summary>
/// Gets the path to the application configuration root directory.
/// </summary>
/// <value>The configuration directory path.</value>
string ConfigurationDirectoryPath { get; }
/// <summary>
/// Gets the path to the system configuration file.
/// </summary>
/// <value>The system configuration file path.</value>
string SystemConfigurationFilePath { get; }
/// <summary>
/// Gets the folder path to the cache directory.
/// </summary>
/// <value>The cache directory.</value>
string CachePath { get; }
/// <summary>
/// Gets the folder path to the temp directory within the cache folder.
/// </summary>
/// <value>The temp directory.</value>
string TempDirectory { get; }
/// <summary>
/// Gets the magic string used for virtual path manipulation.
/// </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; }
/// <summary>
/// Gets the path used for storing backup archives.
/// </summary>
/// <value>The backup path.</value>
string BackupPath { get; }
/// <summary>
/// Checks and creates all known base paths.
/// </summary>
void MakeSanityCheckOrThrow();
/// <summary>
/// Checks and creates the given path and adds it with a marker file if non existent.
/// </summary>
/// <param name="path">The path to check.</param>
/// <param name="markerName">The common marker file name.</param>
/// <param name="recursive">Check for other settings paths recursively.</param>
void CreateAndCheckMarker(string path, string markerName, bool recursive = false);
}
}
@@ -0,0 +1,17 @@
using System.Collections.Generic;
namespace MediaBrowser.Common.Configuration
{
/// <summary>
/// Provides an interface to retrieve a configuration store. Classes with this interface are scanned for at
/// application start to dynamically register configuration for various modules/plugins.
/// </summary>
public interface IConfigurationFactory
{
/// <summary>
/// Get the configuration store for this module.
/// </summary>
/// <returns>The configuration store.</returns>
IEnumerable<ConfigurationStore> GetConfigurations();
}
}
@@ -0,0 +1,97 @@
#pragma warning disable CS1591
using System;
using System.Collections.Generic;
using MediaBrowser.Model.Configuration;
namespace MediaBrowser.Common.Configuration
{
public interface IConfigurationManager
{
/// <summary>
/// Occurs when [configuration updating].
/// </summary>
event EventHandler<ConfigurationUpdateEventArgs> NamedConfigurationUpdating;
/// <summary>
/// Occurs when [configuration updated].
/// </summary>
event EventHandler<EventArgs> ConfigurationUpdated;
/// <summary>
/// Occurs when [named configuration updated].
/// </summary>
event EventHandler<ConfigurationUpdateEventArgs> NamedConfigurationUpdated;
/// <summary>
/// Gets the application paths.
/// </summary>
/// <value>The application paths.</value>
IApplicationPaths CommonApplicationPaths { get; }
/// <summary>
/// Gets the configuration.
/// </summary>
/// <value>The configuration.</value>
BaseApplicationConfiguration CommonConfiguration { get; }
/// <summary>
/// Saves the configuration.
/// </summary>
void SaveConfiguration();
/// <summary>
/// Replaces the configuration.
/// </summary>
/// <param name="newConfiguration">The new configuration.</param>
void ReplaceConfiguration(BaseApplicationConfiguration newConfiguration);
/// <summary>
/// Manually pre-loads a factory so that it is available pre system initialisation.
/// </summary>
/// <typeparam name="T">Class to register.</typeparam>
void RegisterConfiguration<T>()
where T : IConfigurationFactory;
/// <summary>
/// Gets the configuration.
/// </summary>
/// <param name="key">The key.</param>
/// <returns>System.Object.</returns>
object GetConfiguration(string key);
/// <summary>
/// Gets the array of configuration stores.
/// </summary>
/// <returns>Array of ConfigurationStore.</returns>
ConfigurationStore[] GetConfigurationStores();
/// <summary>
/// Gets the type of the configuration.
/// </summary>
/// <param name="key">The key.</param>
/// <returns>Type.</returns>
Type GetConfigurationType(string key);
/// <summary>
/// Saves the configuration.
/// </summary>
/// <param name="key">The key.</param>
/// <param name="configuration">The configuration.</param>
void SaveConfiguration(string key, object configuration);
/// <summary>
/// Adds the parts.
/// </summary>
/// <param name="factories">The factories.</param>
void AddParts(IEnumerable<IConfigurationFactory> factories);
}
public static class ConfigurationManagerExtensions
{
public static T GetConfiguration<T>(this IConfigurationManager manager, string key)
{
return (T)manager.GetConfiguration(key);
}
}
}
@@ -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);
}
}