aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Persistence/TypeMapper.cs
diff options
context:
space:
mode:
authorLukePulverenti <luke.pulverenti@gmail.com>2013-02-25 22:43:04 -0500
committerLukePulverenti <luke.pulverenti@gmail.com>2013-02-25 22:43:04 -0500
commit2d06095447b972c8c7239277428e2c67c8b7ca86 (patch)
tree14278bd4c0732ee962b73ff4845e5022e157a0a3 /MediaBrowser.Controller/Persistence/TypeMapper.cs
parent364fbb9e0c7586afa296ddd7d739df086f4c3533 (diff)
plugin security fixes and other abstractions
Diffstat (limited to 'MediaBrowser.Controller/Persistence/TypeMapper.cs')
-rw-r--r--MediaBrowser.Controller/Persistence/TypeMapper.cs47
1 files changed, 0 insertions, 47 deletions
diff --git a/MediaBrowser.Controller/Persistence/TypeMapper.cs b/MediaBrowser.Controller/Persistence/TypeMapper.cs
deleted file mode 100644
index 2b9ec9e5e..000000000
--- a/MediaBrowser.Controller/Persistence/TypeMapper.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-using System;
-using System.Collections.Concurrent;
-using System.Linq;
-
-namespace MediaBrowser.Controller.Persistence
-{
- /// <summary>
- /// Class TypeMapper
- /// </summary>
- public class TypeMapper
- {
- /// <summary>
- /// This holds all the types in the running assemblies so that we can de-serialize properly when we don't have strong types
- /// </summary>
- private readonly ConcurrentDictionary<string, Type> _typeMap = new ConcurrentDictionary<string, Type>();
-
- /// <summary>
- /// Gets the type.
- /// </summary>
- /// <param name="typeName">Name of the type.</param>
- /// <returns>Type.</returns>
- /// <exception cref="System.ArgumentNullException"></exception>
- public Type GetType(string typeName)
- {
- if (string.IsNullOrEmpty(typeName))
- {
- throw new ArgumentNullException();
- }
-
- return _typeMap.GetOrAdd(typeName, LookupType);
- }
-
- /// <summary>
- /// Lookups the type.
- /// </summary>
- /// <param name="typeName">Name of the type.</param>
- /// <returns>Type.</returns>
- private Type LookupType(string typeName)
- {
- return AppDomain
- .CurrentDomain
- .GetAssemblies()
- .Select(a => a.GetType(typeName, false))
- .FirstOrDefault(t => t != null);
- }
- }
-}