use IFileSystem interface to get creation time

This commit is contained in:
Luke Pulverenti
2013-10-30 19:15:58 -04:00
parent d5baaa1f67
commit 579b507f7f
9 changed files with 52 additions and 31 deletions

View File

@@ -30,27 +30,6 @@ namespace MediaBrowser.Controller.IO
}
}
/// <summary>
/// Gets the creation time UTC.
/// </summary>
/// <param name="info">The info.</param>
/// <param name="logger">The logger.</param>
/// <returns>DateTime.</returns>
public static DateTime GetCreationTimeUtc(FileSystemInfo info, ILogger logger)
{
// This could throw an error on some file systems that have dates out of range
try
{
return info.CreationTimeUtc;
}
catch (Exception ex)
{
logger.ErrorException("Error determining CreationTimeUtc for {0}", ex, info.FullName);
return DateTime.MinValue;
}
}
/// <summary>
/// Copies all.
/// </summary>

View File

@@ -1,4 +1,5 @@
using System.IO;
using System;
using System.IO;
namespace MediaBrowser.Controller.IO
{
@@ -41,5 +42,12 @@ namespace MediaBrowser.Controller.IO
/// <param name="filename">The filename.</param>
/// <returns>System.String.</returns>
string GetValidFilename(string filename);
/// <summary>
/// Gets the creation time UTC.
/// </summary>
/// <param name="info">The info.</param>
/// <returns>DateTime.</returns>
DateTime GetCreationTimeUtc(FileSystemInfo info);
}
}