aboutsummaryrefslogtreecommitdiff
path: root/SocketHttpListener.Portable/Net/HttpListenerPrefixCollection.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2017-05-24 15:12:55 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2017-05-24 15:12:55 -0400
commitf07af448fa11330db93dd7ddcabac37ef9e014c7 (patch)
tree1b52a4f73d674a48258c2f14c94117b96ca4a678 /SocketHttpListener.Portable/Net/HttpListenerPrefixCollection.cs
parent27c3acb2bfde9025c33f584c759a4038020cb702 (diff)
update main projects
Diffstat (limited to 'SocketHttpListener.Portable/Net/HttpListenerPrefixCollection.cs')
-rw-r--r--SocketHttpListener.Portable/Net/HttpListenerPrefixCollection.cs97
1 files changed, 0 insertions, 97 deletions
diff --git a/SocketHttpListener.Portable/Net/HttpListenerPrefixCollection.cs b/SocketHttpListener.Portable/Net/HttpListenerPrefixCollection.cs
deleted file mode 100644
index 0b05539ee..000000000
--- a/SocketHttpListener.Portable/Net/HttpListenerPrefixCollection.cs
+++ /dev/null
@@ -1,97 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using MediaBrowser.Model.Logging;
-
-namespace SocketHttpListener.Net
-{
- public class HttpListenerPrefixCollection : ICollection<string>, IEnumerable<string>, IEnumerable
- {
- List<string> prefixes = new List<string>();
- HttpListener listener;
-
- private ILogger _logger;
-
- internal HttpListenerPrefixCollection(ILogger logger, HttpListener listener)
- {
- _logger = logger;
- this.listener = listener;
- }
-
- public int Count
- {
- get { return prefixes.Count; }
- }
-
- public bool IsReadOnly
- {
- get { return false; }
- }
-
- public bool IsSynchronized
- {
- get { return false; }
- }
-
- public void Add(string uriPrefix)
- {
- listener.CheckDisposed();
- ListenerPrefix.CheckUri(uriPrefix);
- if (prefixes.Contains(uriPrefix))
- return;
-
- prefixes.Add(uriPrefix);
- if (listener.IsListening)
- EndPointManager.AddPrefix(_logger, uriPrefix, listener);
- }
-
- public void Clear()
- {
- listener.CheckDisposed();
- prefixes.Clear();
- if (listener.IsListening)
- EndPointManager.RemoveListener(_logger, listener);
- }
-
- public bool Contains(string uriPrefix)
- {
- listener.CheckDisposed();
- return prefixes.Contains(uriPrefix);
- }
-
- public void CopyTo(string[] array, int offset)
- {
- listener.CheckDisposed();
- prefixes.CopyTo(array, offset);
- }
-
- public void CopyTo(Array array, int offset)
- {
- listener.CheckDisposed();
- ((ICollection)prefixes).CopyTo(array, offset);
- }
-
- public IEnumerator<string> GetEnumerator()
- {
- return prefixes.GetEnumerator();
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- return prefixes.GetEnumerator();
- }
-
- public bool Remove(string uriPrefix)
- {
- listener.CheckDisposed();
- if (uriPrefix == null)
- throw new ArgumentNullException("uriPrefix");
-
- bool result = prefixes.Remove(uriPrefix);
- if (result && listener.IsListening)
- EndPointManager.RemovePrefix(_logger, uriPrefix, listener);
-
- return result;
- }
- }
-}