mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-20 15:55:25 +03:00
add more methods to IFileSystem
This commit is contained in:
@@ -2,26 +2,37 @@
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using MediaBrowser.Common.IO;
|
||||
|
||||
namespace MediaBrowser.MediaEncoding.Configuration
|
||||
{
|
||||
public class EncodingConfigurationFactory : IConfigurationFactory
|
||||
{
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
||||
public EncodingConfigurationFactory(IFileSystem fileSystem)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
|
||||
public IEnumerable<ConfigurationStore> GetConfigurations()
|
||||
{
|
||||
return new[]
|
||||
{
|
||||
new EncodingConfigurationStore()
|
||||
new EncodingConfigurationStore(_fileSystem)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public class EncodingConfigurationStore : ConfigurationStore, IValidatingConfiguration
|
||||
{
|
||||
public EncodingConfigurationStore()
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
||||
public EncodingConfigurationStore(IFileSystem fileSystem)
|
||||
{
|
||||
ConfigurationType = typeof(EncodingOptions);
|
||||
Key = "encoding";
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
|
||||
public void Validate(object oldConfig, object newConfig)
|
||||
@@ -35,7 +46,7 @@ namespace MediaBrowser.MediaEncoding.Configuration
|
||||
&& !string.Equals(oldEncodingConfig.TranscodingTempPath ?? string.Empty, newPath))
|
||||
{
|
||||
// Validate
|
||||
if (!_fileSystem.DirectoryExists(newPath))
|
||||
if (!_fileSystem.DirectoryExists(newPath))
|
||||
{
|
||||
throw new DirectoryNotFoundException(string.Format("{0} does not exist.", newPath));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user