Exemple #1
0
        protected override bool KeyEquals(object key, object item)
        {
            SurrogateKey key2 = (SurrogateKey)item;
            SurrogateKey key3 = (SurrogateKey)key;

            return(((key3.m_type == key2.m_type) && ((key3.m_context.m_state & key2.m_context.m_state) == key2.m_context.m_state)) && (key3.m_context.Context == key2.m_context.Context));
        }
        // Token: 0x060051D4 RID: 20948 RVA: 0x0011F028 File Offset: 0x0011D228
        protected override bool KeyEquals(object key, object item)
        {
            SurrogateKey surrogateKey  = (SurrogateKey)item;
            SurrogateKey surrogateKey2 = (SurrogateKey)key;

            return(surrogateKey2.m_type == surrogateKey.m_type && (surrogateKey2.m_context.m_state & surrogateKey.m_context.m_state) == surrogateKey.m_context.m_state && surrogateKey2.m_context.Context == surrogateKey.m_context.Context);
        }
Exemple #3
0
        // Removes the surrogate associated with a given type.  Does not
        // check chained surrogates.
        public virtual void RemoveSurrogate(Type type, StreamingContext context)
        {
            ArgumentNullException.ThrowIfNull(type);

            SurrogateKey key = new SurrogateKey(type, context);

            _surrogates.Remove(key);
        }
Exemple #4
0
        public virtual void AddSurrogate(Type type, StreamingContext context, ISerializationSurrogate surrogate)
        {
            ArgumentNullException.ThrowIfNull(type);
            ArgumentNullException.ThrowIfNull(surrogate);

            var key = new SurrogateKey(type, context);

            _surrogates.Add(key, surrogate); // Hashtable does duplicate checking.
        }
        // Must return true if the context to serialize for (givenContext)
        // is a subset of the context for which the serialization selector is provided (presentContext)
        // Note: This is done by overriding KeyEquals rather than overriding Equals() in the SurrogateKey
        // class because Equals() method must be commutative.
        protected override bool KeyEquals(object key, object item)
        {
            SurrogateKey givenValue   = (SurrogateKey)item;
            SurrogateKey presentValue = (SurrogateKey)key;

            return(presentValue._type == givenValue._type &&
                   (presentValue._context.State & givenValue._context.State) == givenValue._context.State &&
                   presentValue._context.Context == givenValue._context.Context);
        }
        public virtual void RemoveSurrogate(Type type, StreamingContext context)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }
            SurrogateKey key = new SurrogateKey(type, context);

            this.m_surrogates.Remove(key);
        }
Exemple #7
0
     // Adds a surrogate to the list of surrogates checked.
     /// <include file='doc\SurrogateSelector.uex' path='docs/doc[@for="SurrogateSelector.AddSurrogate"]/*' />
     public virtual void AddSurrogate(Type type, StreamingContext context, ISerializationSurrogate surrogate) {
         if (type==null) {
             throw new ArgumentNullException("type");
         }
         if (surrogate==null) {
             throw new ArgumentNullException("surrogate");
         }
 
         SurrogateKey key = new SurrogateKey(type, context);
         m_surrogates.Add(key, surrogate);  // Hashtable does duplicate checking.
     }
        public virtual void AddSurrogate(Type type, StreamingContext context, ISerializationSurrogate surrogate)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }
            if (surrogate == null)
            {
                throw new ArgumentNullException("surrogate");
            }
            SurrogateKey key = new SurrogateKey(type, context);

            this.m_surrogates.Add(key, surrogate);
        }
        public override bool Equals(Object obj)
        {
            if (obj == null || !(obj is SurrogateKey))
            {
                return(false);
            }
            SurrogateKey other = (SurrogateKey)obj;

            if (m_type == other.m_type && m_context.Equals(other.m_context))
            {
                return(true);
            }
            return(false);
        }
        public virtual void AddSurrogate(Type type, StreamingContext context, ISerializationSurrogate surrogate)
        {
            if (type == null)
            {
                throw new ArgumentNullException(nameof(type));
            }
            if (surrogate == null)
            {
                throw new ArgumentNullException(nameof(surrogate));
            }

            var key = new SurrogateKey(type, context);

            _surrogates.Add(key, surrogate); // Hashtable does duplicate checking.
        }
        // Adds a surrogate to the list of surrogates checked.
        public virtual void AddSurrogate(Type type, StreamingContext context, ISerializationSurrogate surrogate)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }
            if (surrogate == null)
            {
                throw new ArgumentNullException("surrogate");
            }
            Contract.EndContractBlock();

            SurrogateKey key = new SurrogateKey(type, context);

            m_surrogates.Add(key, surrogate);  // Hashtable does duplicate checking.
        }
Exemple #12
0
        // Gets the surrogate for a particular type.  If this selector can't
        // provide a surrogate, it checks with all of it's children before returning null.
        public virtual ISerializationSurrogate?GetSurrogate(Type type, StreamingContext context, out ISurrogateSelector selector)
        {
            ArgumentNullException.ThrowIfNull(type);

            selector = this;

            SurrogateKey            key  = new SurrogateKey(type, context);
            ISerializationSurrogate?temp = (ISerializationSurrogate?)_surrogates[key];

            if (temp != null)
            {
                return(temp);
            }
            if (_nextSelector != null)
            {
                return(_nextSelector.GetSurrogate(type, context, out selector));
            }
            return(null);
        }
        public virtual ISerializationSurrogate GetSurrogate(Type type, StreamingContext context, out ISurrogateSelector selector)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }
            selector = this;
            SurrogateKey            key       = new SurrogateKey(type, context);
            ISerializationSurrogate surrogate = (ISerializationSurrogate)this.m_surrogates[key];

            if (surrogate != null)
            {
                return(surrogate);
            }
            if (this.m_nextSelector != null)
            {
                return(this.m_nextSelector.GetSurrogate(type, context, out selector));
            }
            return(null);
        }
        [System.Security.SecurityCritical]  // auto-generated_required
        public virtual ISerializationSurrogate GetSurrogate(Type type, StreamingContext context, out ISurrogateSelector selector)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }
            Contract.EndContractBlock();

            selector = this;

            SurrogateKey            key  = new SurrogateKey(type, context);
            ISerializationSurrogate temp = (ISerializationSurrogate)m_surrogates[key];

            if (temp != null)
            {
                return(temp);
            }
            if (m_nextSelector != null)
            {
                return(m_nextSelector.GetSurrogate(type, context, out selector));
            }
            return(null);
        }
        [System.Security.SecurityCritical]  // auto-generated_required
        public virtual ISerializationSurrogate GetSurrogate(Type type, StreamingContext context, out ISurrogateSelector selector) {
            if (type==null) { 
                throw new ArgumentNullException("type");
            } 
            Contract.EndContractBlock(); 

            selector = this; 

            SurrogateKey key = new SurrogateKey(type, context);
            ISerializationSurrogate temp = (ISerializationSurrogate)m_surrogates[key];
            if (temp!=null) { 
                return temp;
            } 
            if (m_nextSelector!=null) { 
                return m_nextSelector.GetSurrogate(type, context, out selector);
            } 
            return null;
        }
        // Removes the surrogate associated with a given type.  Does not 
        // check chained surrogates.
        public virtual void RemoveSurrogate(Type type, StreamingContext context) { 
            if (type==null) { 
                throw new ArgumentNullException("type");
            } 

            Contract.EndContractBlock();

            SurrogateKey key = new SurrogateKey(type, context); 
            m_surrogates.Remove(key);
        } 
Exemple #17
0
        // Removes the surrogate associated with a given type.  Does not
        // check chained surrogates.  
        public virtual void RemoveSurrogate(Type type, StreamingContext context)
        {
            if (type == null)
            {
                throw new ArgumentNullException(nameof(type));
            }

            SurrogateKey key = new SurrogateKey(type, context);
            _surrogates.Remove(key);
        }
Exemple #18
0
        // Gets the surrogate for a particular type.  If this selector can't
        // provide a surrogate, it checks with all of it's children before returning null.
        public virtual ISerializationSurrogate GetSurrogate(Type type, StreamingContext context, out ISurrogateSelector selector)
        {
            if (type == null)
            {
                throw new ArgumentNullException(nameof(type));
            }

            selector = this;

            SurrogateKey key = new SurrogateKey(type, context);
            ISerializationSurrogate temp = (ISerializationSurrogate)_surrogates[key];
            if (temp != null)
            {
                return temp;
            }
            if (_nextSelector != null)
            {
                return _nextSelector.GetSurrogate(type, context, out selector);
            }
            return null;
        }
 public virtual ISerializationSurrogate GetSurrogate(Type type, StreamingContext context, out ISurrogateSelector selector)
 {
     if (type == null)
     {
         throw new ArgumentNullException("type");
     }
     selector = this;
     SurrogateKey key = new SurrogateKey(type, context);
     ISerializationSurrogate surrogate = (ISerializationSurrogate) this.m_surrogates[key];
     if (surrogate != null)
     {
         return surrogate;
     }
     if (this.m_nextSelector != null)
     {
         return this.m_nextSelector.GetSurrogate(type, context, out selector);
     }
     return null;
 }