mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-01-24 07:30:57 +01:00
add more methods to IFileSystem
This commit is contained in:
parent
6cb184fcf8
commit
8cf45a3e4a
64 changed files with 296 additions and 149 deletions
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue