cleaned up parsing logic and structure.

This commit is contained in:
kay.one 2013-04-14 18:41:39 -07:00
commit 6e88f55a54
120 changed files with 2149 additions and 3064 deletions

View file

@ -24,7 +24,7 @@ namespace NzbDrone.Common
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
public virtual DateTime GetLastDirectoryWrite(string path)
public virtual DateTime GetLastFolderWrite(string path)
{
if (!FolderExists(path))
{
@ -50,6 +50,15 @@ namespace NzbDrone.Common
return new FileInfo(path).LastWriteTimeUtc;
}
public virtual void EnsureFolder(string path)
{
if (!FolderExists(path))
{
CreateFolder(path);
}
}
public virtual bool FolderExists(string path)
{
return Directory.Exists(path);
@ -84,7 +93,7 @@ namespace NzbDrone.Common
return fi.Length;
}
public virtual String CreateDirectory(string path)
public virtual String CreateFolder(string path)
{
return Directory.CreateDirectory(path).FullName;
}
@ -191,7 +200,7 @@ namespace NzbDrone.Common
File.SetAccessControl(filename, fs);
}
public virtual ulong FreeDiskSpace(string path)
public virtual ulong GetAvilableSpace(string path)
{
if (!FolderExists(path))
throw new DirectoryNotFoundException(path);
@ -237,7 +246,7 @@ namespace NzbDrone.Common
{
var files = GetFileInfos(path, "*.*", SearchOption.AllDirectories);
foreach(var fileInfo in files)
foreach (var fileInfo in files)
{
if (IsFileLocked(fileInfo))
return true;