From bfcd1b520fd79b893e721ba916ae5e1656407d2f Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 16 Aug 2017 02:43:41 -0400 Subject: merge common implementations and server implementations --- .../IO/SharpCifs/Util/Sharpen/AbstractMap.cs | 151 --------------------- 1 file changed, 151 deletions(-) delete mode 100644 Emby.Common.Implementations/IO/SharpCifs/Util/Sharpen/AbstractMap.cs (limited to 'Emby.Common.Implementations/IO/SharpCifs/Util/Sharpen/AbstractMap.cs') diff --git a/Emby.Common.Implementations/IO/SharpCifs/Util/Sharpen/AbstractMap.cs b/Emby.Common.Implementations/IO/SharpCifs/Util/Sharpen/AbstractMap.cs deleted file mode 100644 index 2868a840ad..0000000000 --- a/Emby.Common.Implementations/IO/SharpCifs/Util/Sharpen/AbstractMap.cs +++ /dev/null @@ -1,151 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; - -namespace SharpCifs.Util.Sharpen -{ - public abstract class AbstractMap : IDictionary - { - public virtual void Clear () - { - EntrySet ().Clear (); - } - - public virtual bool ContainsKey (object name) - { - return EntrySet ().Any (p => p.Key.Equals ((T)name)); - } - - public abstract ICollection> EntrySet (); - - public virtual TU Get (object key) - { - return EntrySet ().Where (p => p.Key.Equals (key)).Select (p => p.Value).FirstOrDefault (); - } - - protected virtual IEnumerator> InternalGetEnumerator () - { - return EntrySet ().GetEnumerator (); - } - - public virtual bool IsEmpty () - { - return !EntrySet ().Any (); - } - - public virtual TU Put (T key, TU value) - { - throw new NotSupportedException (); - } - - public virtual TU Remove (object key) - { - Iterator iterator = EntrySet () as Iterator; - if (iterator == null) { - throw new NotSupportedException (); - } - while (iterator.HasNext ()) { - TU local = iterator.Next (); - if (local.Equals ((T)key)) { - iterator.Remove (); - return local; - } - } - return default(TU); - } - - void ICollection>.Add (KeyValuePair item) - { - Put (item.Key, item.Value); - } - - bool ICollection>.Contains (KeyValuePair item) - { - throw new NotImplementedException (); - } - - void ICollection>.CopyTo (KeyValuePair[] array, int arrayIndex) - { - EntrySet ().CopyTo (array, arrayIndex); - } - - bool ICollection>.Remove (KeyValuePair item) - { - Remove (item.Key); - return true; - } - - void IDictionary.Add (T key, TU value) - { - Put (key, value); - } - - bool IDictionary.ContainsKey (T key) - { - return ContainsKey (key); - } - - bool IDictionary.Remove (T key) - { - if (ContainsKey (key)) { - Remove (key); - return true; - } - return false; - } - - bool IDictionary.TryGetValue (T key, out TU value) - { - if (ContainsKey (key)) { - value = Get (key); - return true; - } - value = default(TU); - return false; - } - - IEnumerator> IEnumerable>.GetEnumerator () - { - return InternalGetEnumerator (); - } - - IEnumerator IEnumerable.GetEnumerator () - { - return InternalGetEnumerator (); - } - - public virtual int Count { - get { return EntrySet ().Count; } - } - - public TU this[T key] { - get { return Get (key); } - set { Put (key, value); } - } - - public virtual IEnumerable Keys { - get { return EntrySet ().Select (p => p.Key); } - } - - int ICollection>.Count { - get { return Count; } - } - - bool ICollection>.IsReadOnly { - get { return false; } - } - - ICollection IDictionary.Keys { - get { return Keys.ToList (); } - } - - ICollection IDictionary.Values { - get { return Values.ToList (); } - } - - public virtual IEnumerable Values { - get { return EntrySet ().Select (p => p.Value); } - } - } -} -- cgit v1.2.3