26 lines
713 B
C#
26 lines
713 B
C#
using dy.net.model.dto;
|
|
|
|
namespace dy.net.storage
|
|
{
|
|
public class MediaStorageRouter
|
|
{
|
|
private readonly LocalMediaStorage _local;
|
|
private readonly WebDavMediaStorage _webDav;
|
|
private readonly OpenListMediaStorage _openList;
|
|
|
|
public MediaStorageRouter(LocalMediaStorage local, WebDavMediaStorage webDav, OpenListMediaStorage openList)
|
|
{
|
|
_local = local;
|
|
_webDav = webDav;
|
|
_openList = openList;
|
|
}
|
|
|
|
public IMediaStorage Resolve(StorageType storageType) => storageType switch
|
|
{
|
|
StorageType.WebDav => _webDav,
|
|
StorageType.OpenList => _openList,
|
|
_ => _local
|
|
};
|
|
}
|
|
}
|