private IEnumerable <Cookie> findCookie(Cookie cookie)
        {
            string name   = cookie.Name;
            string domain = cookie.Domain;
            string path   = cookie.Path;

            if (_cookies == null)
            {
                yield break;
            }
            IEnumerator enumerator = _cookies.GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    Cookie c = (Cookie)enumerator.Current;
                    if (c.Name.Equals(name, StringComparison.OrdinalIgnoreCase) && c.Domain.Equals(domain, StringComparison.OrdinalIgnoreCase) && c.Path.Equals(path, StringComparison.Ordinal))
                    {
                        yield return(c);
                    }
                }
            }
            finally
            {
                IDisposable disposable;
                IDisposable disposable2 = (disposable = enumerator as IDisposable);
                if (disposable != null)
                {
                    disposable2.Dispose();
                }
            }
        }
Exemple #2
0
        public void Add(CookieCollection cookies)
        {
            if (cookies == null)
            {
                throw new ArgumentNullException("cookies");
            }
            IEnumerator enumerator = cookies.GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    Cookie current = (Cookie)enumerator.Current;
                    this.Add(current);
                }
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
        }
Exemple #3
0
        internal void SetOrRemove(CookieCollection cookies)
        {
            IEnumerator enumerator = cookies.GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    Cookie current = (Cookie)enumerator.Current;
                    this.SetOrRemove(current);
                }
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
        }
Exemple #4
0
        internal void SetOrRemove(CookieCollection cookies)
        {
            IEnumerator enumerator = cookies.GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    object obj      = enumerator.Current;
                    Cookie orRemove = (Cookie)obj;
                    this.SetOrRemove(orRemove);
                }
            }
            finally
            {
                IDisposable disposable;
                if ((disposable = (enumerator as IDisposable)) != null)
                {
                    disposable.Dispose();
                }
            }
        }