aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Common')
-rw-r--r--MediaBrowser.Common/Constants/Constants.cs8
-rw-r--r--MediaBrowser.Common/Extensions/BaseExtensions.cs55
-rw-r--r--MediaBrowser.Common/IO/FileSystemRepository.cs122
-rw-r--r--MediaBrowser.Common/MediaBrowser.Common.csproj2
4 files changed, 2 insertions, 185 deletions
diff --git a/MediaBrowser.Common/Constants/Constants.cs b/MediaBrowser.Common/Constants/Constants.cs
deleted file mode 100644
index d569fd8ea..000000000
--- a/MediaBrowser.Common/Constants/Constants.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-
-namespace MediaBrowser.Common.Constants
-{
- public static class Constants
- {
- public const string MbAdminUrl = "http://www.mb3admin.com/admin/";
- }
-}
diff --git a/MediaBrowser.Common/Extensions/BaseExtensions.cs b/MediaBrowser.Common/Extensions/BaseExtensions.cs
index be2fbffc6..8e96373f4 100644
--- a/MediaBrowser.Common/Extensions/BaseExtensions.cs
+++ b/MediaBrowser.Common/Extensions/BaseExtensions.cs
@@ -1,5 +1,4 @@
using System;
-using System.Globalization;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
@@ -56,28 +55,6 @@ namespace MediaBrowser.Common.Extensions
}
/// <summary>
- /// Removes the accent.
- /// </summary>
- /// <param name="text">The text.</param>
- /// <returns>System.String.</returns>
- public static string RemoveAccent(this string text)
- {
- var normalizedString = text.Normalize(NormalizationForm.FormD);
- var stringBuilder = new StringBuilder();
-
- foreach (var c in normalizedString)
- {
- var unicodeCategory = CharUnicodeInfo.GetUnicodeCategory(c);
- if (unicodeCategory != UnicodeCategory.NonSpacingMark)
- {
- stringBuilder.Append(c);
- }
- }
-
- return stringBuilder.ToString().Normalize(NormalizationForm.FormC);
- }
-
- /// <summary>
/// Gets the M d5.
/// </summary>
/// <param name="str">The STR.</param>
@@ -96,6 +73,8 @@ namespace MediaBrowser.Common.Extensions
/// <param name="str">The STR.</param>
/// <param name="type">The type.</param>
/// <returns>Guid.</returns>
+ /// <exception cref="System.ArgumentNullException">type</exception>
+ [Obsolete("Use LibraryManager.GetNewItemId")]
public static Guid GetMBId(this string str, Type type)
{
if (type == null)
@@ -107,35 +86,5 @@ namespace MediaBrowser.Common.Extensions
return key.GetMD5();
}
-
- /// <summary>
- /// Gets the attribute value.
- /// </summary>
- /// <param name="str">The STR.</param>
- /// <param name="attrib">The attrib.</param>
- /// <returns>System.String.</returns>
- /// <exception cref="System.ArgumentNullException">attrib</exception>
- public static string GetAttributeValue(this string str, string attrib)
- {
- if (string.IsNullOrEmpty(str))
- {
- throw new ArgumentNullException("str");
- }
-
- if (string.IsNullOrEmpty(attrib))
- {
- throw new ArgumentNullException("attrib");
- }
-
- string srch = "[" + attrib + "=";
- int start = str.IndexOf(srch, StringComparison.OrdinalIgnoreCase);
- if (start > -1)
- {
- start += srch.Length;
- int end = str.IndexOf(']', start);
- return str.Substring(start, end - start);
- }
- return null;
- }
}
}
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
-{
- /// <summary>
- /// 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.
- /// </summary>
- public class FileSystemRepository
- {
- /// <summary>
- /// Gets or sets the path.
- /// </summary>
- /// <value>The path.</value>
- protected string Path { get; set; }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="FileSystemRepository" /> class.
- /// </summary>
- /// <param name="path">The path.</param>
- /// <exception cref="System.ArgumentNullException"></exception>
- public FileSystemRepository(string path)
- {
- if (string.IsNullOrEmpty(path))
- {
- throw new ArgumentNullException();
- }
-
- Path = path;
- }
-
- /// <summary>
- /// Gets the full path of where a resource should be stored within the repository
- /// </summary>
- /// <param name="uniqueName">Name of the unique.</param>
- /// <param name="fileExtension">The file extension.</param>
- /// <returns>System.String.</returns>
- /// <exception cref="System.ArgumentNullException">
- /// </exception>
- 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);
- }
-
- /// <summary>
- /// Gets the resource path.
- /// </summary>
- /// <param name="filename">The filename.</param>
- /// <returns>System.String.</returns>
- /// <exception cref="System.ArgumentNullException"></exception>
- 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);
- }
-
- /// <summary>
- /// Determines if a resource is present in the repository
- /// </summary>
- /// <param name="uniqueName">Name of the unique.</param>
- /// <param name="fileExtension">The file extension.</param>
- /// <returns><c>true</c> if the specified unique name contains resource; otherwise, <c>false</c>.</returns>
- public bool ContainsResource(string uniqueName, string fileExtension)
- {
- return ContainsFilePath(GetResourcePath(uniqueName, fileExtension));
- }
-
- /// <summary>
- /// Determines if a file with a given name is present in the repository
- /// </summary>
- /// <param name="filename">The filename.</param>
- /// <returns><c>true</c> if the specified filename contains filename; otherwise, <c>false</c>.</returns>
- /// <exception cref="System.ArgumentNullException"></exception>
- public bool ContainsFilename(string filename)
- {
- if (string.IsNullOrEmpty(filename))
- {
- throw new ArgumentNullException();
- }
-
- return ContainsFilePath(GetResourcePath(filename));
- }
-
- /// <summary>
- /// Determines if a file is present in the repository
- /// </summary>
- /// <param name="path">The path.</param>
- /// <returns><c>true</c> if [contains file path] [the specified path]; otherwise, <c>false</c>.</returns>
- /// <exception cref="System.ArgumentNullException"></exception>
- public bool ContainsFilePath(string path)
- {
- if (string.IsNullOrEmpty(path))
- {
- throw new ArgumentNullException();
- }
-
- return File.Exists(path);
- }
- }
-}
diff --git a/MediaBrowser.Common/MediaBrowser.Common.csproj b/MediaBrowser.Common/MediaBrowser.Common.csproj
index 6e96feed3..9fdfccaaf 100644
--- a/MediaBrowser.Common/MediaBrowser.Common.csproj
+++ b/MediaBrowser.Common/MediaBrowser.Common.csproj
@@ -57,12 +57,10 @@
<Compile Include="Configuration\ConfigurationUpdateEventArgs.cs" />
<Compile Include="Configuration\IConfigurationManager.cs" />
<Compile Include="Configuration\IConfigurationFactory.cs" />
- <Compile Include="Constants\Constants.cs" />
<Compile Include="Events\EventHelper.cs" />
<Compile Include="Extensions\BaseExtensions.cs" />
<Compile Include="Extensions\ResourceNotFoundException.cs" />
<Compile Include="IDependencyContainer.cs" />
- <Compile Include="IO\FileSystemRepository.cs" />
<Compile Include="IO\IFileSystem.cs" />
<Compile Include="IO\ProgressStream.cs" />
<Compile Include="IO\StreamDefaults.cs" />