From dc8fb33a1f5ad474fed88d58a19c1098c68b815f Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 1 Dec 2014 07:43:34 -0500 Subject: updated nuget --- MediaBrowser.Common/IO/FileSystemRepository.cs | 122 ------------------------- 1 file changed, 122 deletions(-) delete mode 100644 MediaBrowser.Common/IO/FileSystemRepository.cs (limited to 'MediaBrowser.Common/IO/FileSystemRepository.cs') diff --git a/MediaBrowser.Common/IO/FileSystemRepository.cs b/MediaBrowser.Common/IO/FileSystemRepository.cs deleted file mode 100644 index 07328d72d..000000000 --- a/MediaBrowser.Common/IO/FileSystemRepository.cs +++ /dev/null @@ -1,122 +0,0 @@ -using MediaBrowser.Common.Extensions; -using System; -using System.IO; - -namespace MediaBrowser.Common.IO -{ - /// - /// This is a wrapper for storing large numbers of files within a directory on a file system. - /// Simply pass a filename into GetResourcePath and it will return a full path location of where the file should be stored. - /// - public class FileSystemRepository - { - /// - /// Gets or sets the path. - /// - /// The path. - protected string Path { get; set; } - - /// - /// Initializes a new instance of the class. - /// - /// The path. - /// - public FileSystemRepository(string path) - { - if (string.IsNullOrEmpty(path)) - { - throw new ArgumentNullException(); - } - - Path = path; - } - - /// - /// Gets the full path of where a resource should be stored within the repository - /// - /// Name of the unique. - /// The file extension. - /// System.String. - /// - /// - public string GetResourcePath(string uniqueName, string fileExtension) - { - if (string.IsNullOrEmpty(uniqueName)) - { - throw new ArgumentNullException("uniqueName"); - } - - if (string.IsNullOrEmpty(fileExtension)) - { - throw new ArgumentNullException("fileExtension"); - } - - var filename = uniqueName.GetMD5() + fileExtension; - - return GetResourcePath(filename); - } - - /// - /// Gets the resource path. - /// - /// The filename. - /// System.String. - /// - public string GetResourcePath(string filename) - { - if (string.IsNullOrEmpty(filename)) - { - throw new ArgumentNullException("filename"); - } - - var prefix = filename.Substring(0, 1); - - var path = System.IO.Path.Combine(Path, prefix); - - return System.IO.Path.Combine(path, filename); - } - - /// - /// Determines if a resource is present in the repository - /// - /// Name of the unique. - /// The file extension. - /// true if the specified unique name contains resource; otherwise, false. - public bool ContainsResource(string uniqueName, string fileExtension) - { - return ContainsFilePath(GetResourcePath(uniqueName, fileExtension)); - } - - /// - /// Determines if a file with a given name is present in the repository - /// - /// The filename. - /// true if the specified filename contains filename; otherwise, false. - /// - public bool ContainsFilename(string filename) - { - if (string.IsNullOrEmpty(filename)) - { - throw new ArgumentNullException(); - } - - return ContainsFilePath(GetResourcePath(filename)); - } - - /// - /// Determines if a file is present in the repository - /// - /// The path. - /// true if [contains file path] [the specified path]; otherwise, false. - /// - public bool ContainsFilePath(string path) - { - if (string.IsNullOrEmpty(path)) - { - throw new ArgumentNullException(); - } - - return File.Exists(path); - } - } -} -- cgit v1.2.3