@ -1,6 +1,7 @@
using System ;
using System ;
using System.Collections.Generic ;
using System.Collections.Generic ;
using System.Diagnostics ;
using System.Diagnostics ;
using System.Globalization ;
using System.IO ;
using System.IO ;
using System.Linq ;
using System.Linq ;
using System.Text.RegularExpressions ;
using System.Text.RegularExpressions ;
@ -17,10 +18,8 @@ namespace NzbDrone.Core.Providers
{
{
private readonly HttpProvider _httpProvider ;
private readonly HttpProvider _httpProvider ;
private readonly ConfigProvider _configProvider ;
private readonly ConfigProvider _configProvider ;
private readonly ConfigFileProvider _configFileProvider ;
private readonly EnviromentProvider _enviromentProvider ;
private readonly EnviromentProvider _enviromentProvider ;
private readonly ArchiveProvider _archiveProvider ;
private readonly ProcessProvider _processProvider ;
private readonly DiskProvider _diskProvider ;
private readonly DiskProvider _diskProvider ;
private static readonly Logger logger = LogManager . GetCurrentClassLogger ( ) ;
private static readonly Logger logger = LogManager . GetCurrentClassLogger ( ) ;
@ -29,15 +28,12 @@ namespace NzbDrone.Core.Providers
[Inject]
[Inject]
public UpdateProvider ( HttpProvider httpProvider , ConfigProvider configProvider , ConfigFileProvider configFileProvider ,
public UpdateProvider ( HttpProvider httpProvider , ConfigProvider configProvider ,
EnviromentProvider enviromentProvider , ArchiveProvider archiveProvider , ProcessProvider processProvider , DiskProvider diskProvider )
EnviromentProvider enviromentProvider , DiskProvider diskProvider )
{
{
_httpProvider = httpProvider ;
_httpProvider = httpProvider ;
_configProvider = configProvider ;
_configProvider = configProvider ;
_configFileProvider = configFileProvider ;
_enviromentProvider = enviromentProvider ;
_enviromentProvider = enviromentProvider ;
_archiveProvider = archiveProvider ;
_processProvider = processProvider ;
_diskProvider = diskProvider ;
_diskProvider = diskProvider ;
}
}
@ -77,5 +73,23 @@ namespace NzbDrone.Core.Providers
logger . Trace ( "No updates available" ) ;
logger . Trace ( "No updates available" ) ;
return null ;
return null ;
}
}
public virtual Dictionary < DateTime , string > UpdateLogFile ( )
{
var list = new Dictionary < DateTime , string > ( ) ;
CultureInfo provider = CultureInfo . InvariantCulture ;
if ( _diskProvider . FolderExists ( _enviromentProvider . GetUpdateLogFolder ( ) ) )
{
var files = _diskProvider . GetFiles ( _enviromentProvider . GetUpdateLogFolder ( ) , SearchOption . TopDirectoryOnly ) . ToList ( ) ;
foreach ( var file in files . Select ( c = > new FileInfo ( c ) ) . OrderByDescending ( c = > c . Name ) )
{
list . Add ( DateTime . ParseExact ( file . Name . Replace ( file . Extension , string . Empty ) , "yyyy.MM.dd-H-mm" , provider ) , file . FullName ) ;
}
}
return list ;
}
}
}
}
}