|
|
@ -33,27 +33,22 @@ namespace NzbDrone.Core.Providers
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public virtual void Add(RootDir rootDir)
|
|
|
|
public virtual void Add(RootDir rootDir)
|
|
|
|
{
|
|
|
|
|
|
|
|
ValidatePath(rootDir);
|
|
|
|
|
|
|
|
_database.Insert(rootDir);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public virtual void Remove(int rootDirId)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_database.Delete<RootDir>(rootDirId);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void ValidatePath(RootDir rootDir)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (String.IsNullOrWhiteSpace(rootDir.Path) || !Path.IsPathRooted(rootDir.Path))
|
|
|
|
if (String.IsNullOrWhiteSpace(rootDir.Path) || !Path.IsPathRooted(rootDir.Path))
|
|
|
|
{
|
|
|
|
|
|
|
|
throw new ArgumentException("Invalid path");
|
|
|
|
throw new ArgumentException("Invalid path");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!_diskProvider.FolderExists(rootDir.Path))
|
|
|
|
if (!_diskProvider.FolderExists(rootDir.Path))
|
|
|
|
{
|
|
|
|
|
|
|
|
throw new DirectoryNotFoundException("Can't add root directory that doesn't exist.");
|
|
|
|
throw new DirectoryNotFoundException("Can't add root directory that doesn't exist.");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (GetAll().Exists(r => DiskProvider.PathEquals(r.Path, rootDir.Path)))
|
|
|
|
|
|
|
|
throw new InvalidOperationException("Root directory already exist.");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_database.Insert(rootDir);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public virtual void Remove(int rootDirId)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_database.Delete<RootDir>(rootDirId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<String> GetUnmappedFolders(string path)
|
|
|
|
public List<String> GetUnmappedFolders(string path)
|
|
|
|