Exemplo n.º 1
0
 /// <summary>
 /// Adds the specified <see cref="T:System.Runtime.Serialization.ISurrogateSelector"/> that
 /// can handle a particular object type to the list of surrogates.
 /// </summary>
 /// <param name="selector">The surrogate selector to add.</param>
 /// <exception cref="T:System.ArgumentNullException">The
 /// <paramref name="selector"/>parameter is null.</exception>
 /// <exception cref="T:System.Runtime.Serialization.SerializationException">The selector is
 /// already on the list of selectors.</exception>
 /// <exception cref="T:System.Security.SecurityException">The caller does not have the
 /// required permission.</exception>
 public virtual void ChainSelector(ISurrogateSelector selector) {
     if (selector == null)
         throw new ArgumentNullException("Selector is null.");
     if (_nextSelector != null)
         selector.ChainSelector(_nextSelector);
     _nextSelector = selector;
 }
 public virtual void ChainSelector(ISurrogateSelector selector)
 {
     if (_next != null)
     {
         selector.ChainSelector(_next);
     }
     _next = selector;
 }
 /// <inheritdoc/>
 public void ChainSelector(ISurrogateSelector selector)
 {
     if (_chainedSelector is null)
     {
         _chainedSelector = selector;
     }
     else
     {
         _chainedSelector.ChainSelector(selector);
     }
 }
Exemplo n.º 4
0
 public void ChainSelector(ISurrogateSelector selector)
 {
     if (nextSelector != null)
     {
         nextSelector.ChainSelector(selector);
     }
     else
     {
         nextSelector = selector;
     }
 }
 public virtual void ChainSelector(ISurrogateSelector selector)
 {
     if (selector == null)
     {
         throw new ArgumentNullException("Selector is null.");
     }
     if (this._nextSelector != null)
     {
         selector.ChainSelector(this._nextSelector);
     }
     this._nextSelector = selector;
 }
 /// <summary>Adds the specified <see cref="T:System.Runtime.Serialization.ISurrogateSelector" /> that can handle a particular object type to the list of surrogates.</summary>
 /// <param name="selector">The surrogate selector to add. </param>
 /// <exception cref="T:System.ArgumentNullException">The <paramref name="selector" /> parameter is null. </exception>
 /// <exception cref="T:System.Runtime.Serialization.SerializationException">The selector is already on the list of selectors. </exception>
 /// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
 public virtual void ChainSelector(ISurrogateSelector selector)
 {
     if (selector == null)
     {
         throw new ArgumentNullException("Selector is null.");
     }
     if (this.nextSelector != null)
     {
         selector.ChainSelector(this.nextSelector);
     }
     this.nextSelector = selector;
 }
Exemplo n.º 7
0
		public virtual void ChainSelector (ISurrogateSelector selector)
		{
			if (selector == null)
				throw new ArgumentNullException ("Selector is null.");

			// Chain the selector at the beggining of the chain
			// since "The last selector added to the list will be the first one checked"
			// (from MS docs)

			if (nextSelector != null)
				selector.ChainSelector (nextSelector);

			nextSelector = selector;
		}
Exemplo n.º 8
0
 public void ChainSelector(ISurrogateSelector selector)
 {
     if (selector == this)
     {
         throw new ArgumentException("Cannot allow Cyclical Surrogates");
     }
     if (_next == null)
     {
         _next = selector;
     }
     else
     {
         _next.ChainSelector(selector);
     }
 }
        public void ChainSelector(ISurrogateSelector selector)
        {
            if (selector == this)
            {
                throw new System.ArgumentException("Cyclical SurrogateSelector");
            }

            if (_nextSelector == null)
            {
                _nextSelector = selector;
            }
            else
            {
                _nextSelector.ChainSelector(selector);
            }
        }
Exemplo n.º 10
0
        public virtual void ChainSelector(ISurrogateSelector selector)
        {
            if (selector == null)
            {
                throw new ArgumentNullException("Selector is null.");
            }

            // Chain the selector at the beggining of the chain
            // since "The last selector added to the list will be the first one checked"
            // (from MS docs)

            if (nextSelector != null)
            {
                selector.ChainSelector(nextSelector);
            }

            nextSelector = selector;
        }
Exemplo n.º 11
0
        // Implement the ISurrogateSelector interface.
        public virtual void ChainSelector(ISurrogateSelector selector)
        {
            // Validate the parameter.
            if (selector == null)
            {
                throw new ArgumentNullException("selector");
            }
            else if (IsInList(this, selector))
            {
                throw new ArgumentException
                          (_("Security_SelectorCycle"));
            }
            ISurrogateSelector temp = selector;
            ISurrogateSelector last = null;

            while (temp != null)
            {
                if (IsInList(temp, this))
                {
                    throw new ArgumentException
                              (_("Security_SelectorCycle"));
                }
                last = temp;
                temp = temp.GetNextSelector();
            }

            // Add the selector just after this one.
            temp         = nextSelector;
            nextSelector = selector;

            // Move the original "next selector" to the end
            // of the list for "selector".
            if (temp != null)
            {
                last.ChainSelector(temp);
            }
        }
Exemplo n.º 12
0
		public virtual void ChainSelector (ISurrogateSelector selector)
		{
			if (_next != null) selector.ChainSelector (_next);
			_next = selector;
		}
Exemplo n.º 13
0
        // Adds another selector to check if we don't have  match within this selector.
        // The logic is:"Add this onto the list as the first thing that you check after yourself."
        public virtual void ChainSelector(ISurrogateSelector selector)
        {
            if (selector == null)
            {
                throw new ArgumentNullException(nameof(selector));
            }

            // Verify that we don't try and add ourself twice.
            if (selector == this)
            {
                throw new SerializationException(SR.Serialization_SurrogateCycle);
            }

            // Verify that the argument doesn't contain a cycle.
            if (!HasCycle(selector))
            {
                throw new ArgumentException(SR.Serialization_SurrogateCycleInArgument, nameof(selector));
            }

            // Check for a cycle that would lead back to this.  We find the end of the list that we're being asked to
            // insert for use later.
            ISurrogateSelector tempCurr = selector.GetNextSelector();
            ISurrogateSelector tempEnd  = selector;

            while (tempCurr != null && tempCurr != this)
            {
                tempEnd  = tempCurr;
                tempCurr = tempCurr.GetNextSelector();
            }
            if (tempCurr == this)
            {
                throw new ArgumentException(SR.Serialization_SurrogateCycle, nameof(selector));
            }

            // Check for a cycle later in the list which would be introduced by this insertion.
            tempCurr = selector;
            ISurrogateSelector tempPrev = selector;

            while (tempCurr != null)
            {
                if (tempCurr == tempEnd)
                {
                    tempCurr = GetNextSelector();
                }
                else
                {
                    tempCurr = tempCurr.GetNextSelector();
                }
                if (tempCurr == null)
                {
                    break;
                }
                if (tempCurr == tempPrev)
                {
                    throw new ArgumentException(SR.Serialization_SurrogateCycle, nameof(selector));
                }

                if (tempCurr == tempEnd)
                {
                    tempCurr = GetNextSelector();
                }
                else
                {
                    tempCurr = tempCurr.GetNextSelector();
                }


                if (tempPrev == tempEnd)
                {
                    tempPrev = GetNextSelector();
                }
                else
                {
                    tempPrev = tempPrev.GetNextSelector();
                }
                if (tempCurr == tempPrev)
                {
                    throw new ArgumentException(SR.Serialization_SurrogateCycle, nameof(selector));
                }
            }

            // Add the new selector and it's entire chain of selectors as the next thing that we check.
            ISurrogateSelector temp = _nextSelector;

            _nextSelector = selector;
            if (temp != null)
            {
                tempEnd.ChainSelector(temp);
            }
        }
Exemplo n.º 14
0
        // Adds another selector to check if we don't have  match within this selector.
        // The logic is:"Add this onto the list as the first thing that you check after yourself."
        // [System.Security.SecurityCritical]  // auto-generated_required
        public virtual void ChainSelector(ISurrogateSelector selector)
        {
            ISurrogateSelector temp;
            ISurrogateSelector tempCurr;
            ISurrogateSelector tempPrev;
            ISurrogateSelector tempEnd;

            if (selector == null)
            {
                throw new ArgumentNullException("selector");
            }
            Contract.EndContractBlock();

            //
            // Verify that we don't try and add ourself twice.
            //
            if (selector == this)
            {
                throw new SerializationException(Ssz.Runtime.Serialization.Environment.GetResourceString("Serialization_DuplicateSelector"));
            }

            //
            // Verify that the argument doesn't contain a cycle.
            //
            if (!HasCycle(selector))
            {
                throw new ArgumentException(Ssz.Runtime.Serialization.Environment.GetResourceString("Serialization_SurrogateCycleInArgument"), "selector");
            }

            //
            // Check for a cycle that would lead back to this.  We find the end of the list that we're being asked to
            // insert for use later.
            //
            tempCurr = selector.GetNextSelector();
            tempEnd  = selector;
            while (tempCurr != null && tempCurr != this)
            {
                tempEnd  = tempCurr;
                tempCurr = tempCurr.GetNextSelector();
            }
            if (tempCurr == this)
            {
                throw new ArgumentException(Ssz.Runtime.Serialization.Environment.GetResourceString("Serialization_SurrogateCycle"), "selector");
            }

            //
            // Check for a cycle later in the list which would be introduced by this insertion.
            //
            tempCurr = selector;
            tempPrev = selector;
            while (tempCurr != null)
            {
                if (tempCurr == tempEnd)
                {
                    tempCurr = this.GetNextSelector();
                }
                else
                {
                    tempCurr = tempCurr.GetNextSelector();
                }
                if (tempCurr == null)
                {
                    break;
                }
                if (tempCurr == tempPrev)
                {
                    throw new ArgumentException(Ssz.Runtime.Serialization.Environment.GetResourceString("Serialization_SurrogateCycle"), "selector");
                }

                if (tempCurr == tempEnd)
                {
                    tempCurr = this.GetNextSelector();
                }
                else
                {
                    tempCurr = tempCurr.GetNextSelector();
                }


                if (tempPrev == tempEnd)
                {
                    tempPrev = this.GetNextSelector();
                }
                else
                {
                    tempPrev = tempPrev.GetNextSelector();
                }
                if (tempCurr == tempPrev)
                {
                    throw new ArgumentException(Ssz.Runtime.Serialization.Environment.GetResourceString("Serialization_SurrogateCycle"), "selector");
                }
            }

            //
            // Add the new selector and it's entire chain of selectors as the next thing that
            // we check.
            //
            temp           = m_nextSelector;
            m_nextSelector = selector;
            if (temp != null)
            {
                tempEnd.ChainSelector(temp);
            }
        }
        public virtual void ChainSelector(ISurrogateSelector selector)
        {
            if (selector == null)
            {
                throw new ArgumentNullException("selector");
            }
            if (selector == this)
            {
                throw new SerializationException(Environment.GetResourceString("Serialization_DuplicateSelector"));
            }
            if (!SurrogateSelector.HasCycle(selector))
            {
                throw new ArgumentException(Environment.GetResourceString("Serialization_SurrogateCycleInArgument"), "selector");
            }
            ISurrogateSelector surrogateSelector  = selector.GetNextSelector();
            ISurrogateSelector surrogateSelector2 = selector;

            while (surrogateSelector != null && surrogateSelector != this)
            {
                surrogateSelector2 = surrogateSelector;
                surrogateSelector  = surrogateSelector.GetNextSelector();
            }
            if (surrogateSelector == this)
            {
                throw new ArgumentException(Environment.GetResourceString("Serialization_SurrogateCycle"), "selector");
            }
            surrogateSelector = selector;
            ISurrogateSelector surrogateSelector3 = selector;

            while (surrogateSelector != null)
            {
                if (surrogateSelector == surrogateSelector2)
                {
                    surrogateSelector = this.GetNextSelector();
                }
                else
                {
                    surrogateSelector = surrogateSelector.GetNextSelector();
                }
                if (surrogateSelector == null)
                {
                    break;
                }
                if (surrogateSelector == surrogateSelector3)
                {
                    throw new ArgumentException(Environment.GetResourceString("Serialization_SurrogateCycle"), "selector");
                }
                if (surrogateSelector == surrogateSelector2)
                {
                    surrogateSelector = this.GetNextSelector();
                }
                else
                {
                    surrogateSelector = surrogateSelector.GetNextSelector();
                }
                if (surrogateSelector3 == surrogateSelector2)
                {
                    surrogateSelector3 = this.GetNextSelector();
                }
                else
                {
                    surrogateSelector3 = surrogateSelector3.GetNextSelector();
                }
                if (surrogateSelector == surrogateSelector3)
                {
                    throw new ArgumentException(Environment.GetResourceString("Serialization_SurrogateCycle"), "selector");
                }
            }
            ISurrogateSelector nextSelector = this.m_nextSelector;

            this.m_nextSelector = selector;
            if (nextSelector != null)
            {
                surrogateSelector2.ChainSelector(nextSelector);
            }
        }
Exemplo n.º 16
0
        [System.Security.SecurityCritical]  // auto-generated_required 
        public virtual void ChainSelector(ISurrogateSelector selector) {
            ISurrogateSelector temp; 
            ISurrogateSelector tempCurr;
            ISurrogateSelector tempPrev;
            ISurrogateSelector tempEnd;
 
            if (selector==null) {
                throw new ArgumentNullException("selector"); 
            } 
            Contract.EndContractBlock();
 
            //
            // Verify that we don't try and add ourself twice.
            //
            if (selector==this) { 
                throw new SerializationException(Environment.GetResourceString("Serialization_DuplicateSelector"));
            } 
 
            //
            // Verify that the argument doesn't contain a cycle. 
            //
            if (!HasCycle(selector)) {
                throw new ArgumentException(Environment.GetResourceString("Serialization_SurrogateCycleInArgument"), "selector");
            } 

            // 
            // Check for a cycle that would lead back to this.  We find the end of the list that we're being asked to 
            // insert for use later.
            // 
            tempCurr = selector.GetNextSelector();
            tempEnd = selector;
            while (tempCurr!=null && tempCurr!=this) {
                tempEnd = tempCurr; 
                tempCurr = tempCurr.GetNextSelector();
            } 
            if (tempCurr==this) { 
                throw new ArgumentException(Environment.GetResourceString("Serialization_SurrogateCycle"), "selector");
            } 

            //
            // Check for a cycle later in the list which would be introduced by this insertion.
            // 
            tempCurr = selector;
            tempPrev = selector; 
            while(tempCurr!=null) { 
                if (tempCurr==tempEnd) {
                    tempCurr = this.GetNextSelector(); 
                } else {
                    tempCurr = tempCurr.GetNextSelector();
                }
                if (tempCurr==null) { 
                    break;
                } 
                if (tempCurr==tempPrev) { 
                    throw new ArgumentException(Environment.GetResourceString("Serialization_SurrogateCycle"), "selector");
                } 

                if (tempCurr==tempEnd) {
                    tempCurr = this.GetNextSelector();
                } else { 
                    tempCurr = tempCurr.GetNextSelector();
                } 
 

                if (tempPrev==tempEnd) { 
                    tempPrev = this.GetNextSelector();
                } else {
                    tempPrev = tempPrev.GetNextSelector();
                } 
                if (tempCurr==tempPrev) {
                    throw new ArgumentException(Environment.GetResourceString("Serialization_SurrogateCycle"), "selector"); 
                } 
            }
 
            //
            // Add the new selector and it's entire chain of selectors as the next thing that
            // we check.
            // 
            temp = m_nextSelector;
            m_nextSelector = selector; 
            if (temp!=null) { 
                tempEnd.ChainSelector(temp);
            } 
        }
        public virtual void ChainSelector(ISurrogateSelector selector)
        {
            if (selector == null)
            {
                throw new ArgumentNullException("selector");
            }
            if (selector == this)
            {
                throw new SerializationException(Environment.GetResourceString("Serialization_DuplicateSelector"));
            }
            if (!HasCycle(selector))
            {
                throw new ArgumentException(Environment.GetResourceString("Serialization_SurrogateCycleInArgument"), "selector");
            }
            ISurrogateSelector nextSelector = selector.GetNextSelector();
            ISurrogateSelector selector5    = selector;

            while ((nextSelector != null) && (nextSelector != this))
            {
                selector5    = nextSelector;
                nextSelector = nextSelector.GetNextSelector();
            }
            if (nextSelector == this)
            {
                throw new ArgumentException(Environment.GetResourceString("Serialization_SurrogateCycle"), "selector");
            }
            nextSelector = selector;
            ISurrogateSelector selector4 = selector;

            while (nextSelector != null)
            {
                if (nextSelector == selector5)
                {
                    nextSelector = this.GetNextSelector();
                }
                else
                {
                    nextSelector = nextSelector.GetNextSelector();
                }
                if (nextSelector == null)
                {
                    break;
                }
                if (nextSelector == selector4)
                {
                    throw new ArgumentException(Environment.GetResourceString("Serialization_SurrogateCycle"), "selector");
                }
                if (nextSelector == selector5)
                {
                    nextSelector = this.GetNextSelector();
                }
                else
                {
                    nextSelector = nextSelector.GetNextSelector();
                }
                if (selector4 == selector5)
                {
                    selector4 = this.GetNextSelector();
                }
                else
                {
                    selector4 = selector4.GetNextSelector();
                }
                if (nextSelector == selector4)
                {
                    throw new ArgumentException(Environment.GetResourceString("Serialization_SurrogateCycle"), "selector");
                }
            }
            ISurrogateSelector selector2 = this.m_nextSelector;

            this.m_nextSelector = selector;
            if (selector2 != null)
            {
                selector5.ChainSelector(selector2);
            }
        }
Exemplo n.º 18
0
 public void ChainSelector(ISurrogateSelector selector)
 {
     underlyingSelector.ChainSelector(selector);
 }
Exemplo n.º 19
0
 public void ChainSelector(ISurrogateSelector next)
 {
     _deleg.ChainSelector(next);
 }
Exemplo n.º 20
0
        public virtual void ChainSelector(ISurrogateSelector selector)
        {
            if (selector == null)
            {
                throw new ArgumentNullException("selector");
            }
            if (selector == this)
            {
                throw new SerializationException(Environment.GetResourceString("Serialization_DuplicateSelector"));
            }
            if (!SurrogateSelector.HasCycle(selector))
            {
                throw new ArgumentException(Environment.GetResourceString("Serialization_SurrogateCycleInArgument"), "selector");
            }
            ISurrogateSelector nextSelector       = selector.GetNextSelector();
            ISurrogateSelector surrogateSelector1 = selector;

            for (; nextSelector != null && nextSelector != this; nextSelector = nextSelector.GetNextSelector())
            {
                surrogateSelector1 = nextSelector;
            }
            if (nextSelector == this)
            {
                throw new ArgumentException(Environment.GetResourceString("Serialization_SurrogateCycle"), "selector");
            }
            ISurrogateSelector surrogateSelector2 = selector;
            ISurrogateSelector surrogateSelector3 = selector;

            while (surrogateSelector2 != null)
            {
                ISurrogateSelector surrogateSelector4 = surrogateSelector2 != surrogateSelector1?surrogateSelector2.GetNextSelector() : this.GetNextSelector();

                if (surrogateSelector4 != null)
                {
                    if (surrogateSelector4 == surrogateSelector3)
                    {
                        throw new ArgumentException(Environment.GetResourceString("Serialization_SurrogateCycle"), "selector");
                    }
                    surrogateSelector2 = surrogateSelector4 != surrogateSelector1?surrogateSelector4.GetNextSelector() : this.GetNextSelector();

                    surrogateSelector3 = surrogateSelector3 != surrogateSelector1?surrogateSelector3.GetNextSelector() : this.GetNextSelector();

                    if (surrogateSelector2 == surrogateSelector3)
                    {
                        throw new ArgumentException(Environment.GetResourceString("Serialization_SurrogateCycle"), "selector");
                    }
                }
                else
                {
                    break;
                }
            }
            ISurrogateSelector selector1 = this.m_nextSelector;

            this.m_nextSelector = selector;
            if (selector1 == null)
            {
                return;
            }
            surrogateSelector1.ChainSelector(selector1);
        }