From 6c8d9192985036acb3d1fe626ed57980bb862d6a Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 31 Oct 2013 10:03:23 -0400 Subject: replace file system calls with IFileSystem when needed --- MediaBrowser.Controller/IO/FileSystem.cs | 71 -------------------------------- 1 file changed, 71 deletions(-) delete mode 100644 MediaBrowser.Controller/IO/FileSystem.cs (limited to 'MediaBrowser.Controller/IO/FileSystem.cs') diff --git a/MediaBrowser.Controller/IO/FileSystem.cs b/MediaBrowser.Controller/IO/FileSystem.cs deleted file mode 100644 index b08e8da27..000000000 --- a/MediaBrowser.Controller/IO/FileSystem.cs +++ /dev/null @@ -1,71 +0,0 @@ -using MediaBrowser.Model.Logging; -using System; -using System.IO; - -namespace MediaBrowser.Controller.IO -{ - /// - /// Class FileSystem - /// - public static class FileSystem - { - /// - /// Gets the creation time UTC. - /// - /// The info. - /// The logger. - /// DateTime. - public static DateTime GetLastWriteTimeUtc(FileSystemInfo info, ILogger logger) - { - // This could throw an error on some file systems that have dates out of range - - try - { - return info.LastWriteTimeUtc; - } - catch (Exception ex) - { - logger.ErrorException("Error determining LastAccessTimeUtc for {0}", ex, info.FullName); - return DateTime.MinValue; - } - } - - /// - /// Copies all. - /// - /// The source. - /// The target. - /// source - /// The source and target directories are the same - public static void CopyAll(string source, string target) - { - if (string.IsNullOrEmpty(source)) - { - throw new ArgumentNullException("source"); - } - if (string.IsNullOrEmpty(target)) - { - throw new ArgumentNullException("target"); - } - - if (source.Equals(target, StringComparison.OrdinalIgnoreCase)) - { - throw new ArgumentException("The source and target directories are the same"); - } - - // Check if the target directory exists, if not, create it. - Directory.CreateDirectory(target); - - foreach (var file in Directory.EnumerateFiles(source)) - { - File.Copy(file, Path.Combine(target, Path.GetFileName(file)), true); - } - - // Copy each subdirectory using recursion. - foreach (var dir in Directory.EnumerateDirectories(source)) - { - CopyAll(dir, Path.Combine(target, Path.GetFileName(dir))); - } - } - } -} -- cgit v1.2.3