当前位置: 首页>>代码示例>>C#>>正文


C# ISurrogateSelector类代码示例

本文整理汇总了C#中ISurrogateSelector的典型用法代码示例。如果您正苦于以下问题:C# ISurrogateSelector类的具体用法?C# ISurrogateSelector怎么用?C# ISurrogateSelector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ISurrogateSelector类属于命名空间,在下文中一共展示了ISurrogateSelector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetObjectData

        public object SetObjectData( object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector )
        {
            var data = info.GetInt32( "data" );
            ( ( GenericParameterHelper )obj ).Data = data;

            return obj;
        }
开发者ID:RadicalFx,项目名称:Radical,代码行数:7,代码来源:GenericParameterHelperSerializationSurrogate.cs

示例2: NotSupportedException

            /// <summary>
            /// Populates the object using the information in the SerializationInfo
            /// </summary>
            /// <param name="obj">The object to populate.</param>
            /// <param name="info">The information to populate the object.</param>
            /// <param name="context">The source from which the object is deserialized.</param>
            /// <param name="selector">The surrogate selector where the search for a compatible surrogate begins.</param>
            /// <returns></returns>
            Object ISerializationSurrogate.SetObjectData(Object obj, SerializationInfo info, StreamingContext context,
                ISurrogateSelector selector)
            {
                throw new NotSupportedException();
                /*
                _hatchBrush = new HatchBrush(
                    (HatchStyle)info.GetValue("HatchStyle", typeof(HatchStyle)),
                    (Color)info.GetValue("ForegroundColor", typeof(Color)),
                    (Color)info.GetValue("BackgroundColor", typeof(Color)));

                return _hatchBrush;
                 */
                /*
                Utility.SetPropertyValue(ref obj, "HatchStyle", Utility.PrivateInstance,
                    (HatchStyle)info.GetValue("HatchStyle", typeof(HatchStyle)));

                Console.WriteLine(((HatchBrush)obj).HatchStyle);
                Utility.SetFieldValue(ref obj, "ForegroundColor", Utility.PrivateInstance,
                    );

                Utility.SetFieldValue(ref obj, "BackgroundColor", Utility.PrivateInstance,
                    (Color)info.GetValue("BackgroundColor", typeof(Color)));

                return null;
                 */
            }
开发者ID:geobabbler,项目名称:SharpMap,代码行数:34,代码来源:Surrogates.Brushes.cs

示例3: SoapFormatter

 public SoapFormatter(ISurrogateSelector selector, StreamingContext context)
 {
     this.m_assemblyFormat = FormatterAssemblyStyle.Full;
     this.m_securityLevel = TypeFilterLevel.Full;
     this.m_surrogates = selector;
     this.m_context = context;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:SoapFormatter.cs

示例4: GetSurrogate

 public virtual ISerializationSurrogate GetSurrogate(Type type, StreamingContext context, out ISurrogateSelector ssout)
 {
     if (type == null)
     {
         throw new ArgumentNullException("type");
     }
     if (type.IsMarshalByRef)
     {
         ssout = this;
         return this._remotingSurrogate;
     }
     if (s_IMethodCallMessageType.IsAssignableFrom(type) || s_IMethodReturnMessageType.IsAssignableFrom(type))
     {
         ssout = this;
         return this._messageSurrogate;
     }
     if (s_ObjRefType.IsAssignableFrom(type))
     {
         ssout = this;
         return this._objRefSurrogate;
     }
     if (this._next != null)
     {
         return this._next.GetSurrogate(type, context, out ssout);
     }
     ssout = null;
     return null;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:RemotingSurrogateSelector.cs

示例5: SetObjectData

        public object SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector)
        {
            Keyframe[] keyframes;

            AnimationCurve curve=new AnimationCurve();

            //	curve.preWrapMode=(WrapMode)info.GetValue("preWrapMode",typeof(WrapMode));
            //	curve.postWrapMode=(WrapMode)info.GetValue("postWrapMode",typeof(WrapMode));

            int numKeys=info.GetInt32("keysn");

            keyframes=new Keyframe[numKeys];

            Keyframe keyframeCurrent;
            for (int i=0; i<numKeys; i++) {
                keyframeCurrent=keyframes[i]=new Keyframe(info.GetSingle("keyt"+i),
                info.GetSingle("keyv"+i));
                keyframeCurrent.tangentMode=info.GetInt32("keymod"+i);
                keyframeCurrent.inTangent=info.GetSingle("keyin"+i);
                keyframeCurrent.outTangent=info.GetSingle("keyout"+i);
            }

            curve.keys = keyframes;

            // don't know how to make connection between AnimaitonCurver and Keyframes surrogate
            // AnimationCurve surrogate keys are constructed before thoose in Keyframe surrogate resulting in 0,0 Keyframes
            //return new AnimationCurve((Keyframe[])info.GetValue ("keys", typeof(Keyframe[])));

            return curve;
        }
开发者ID:osmanzeki,项目名称:bmachine,代码行数:30,代码来源:AnimationCurveSurrogate.cs

示例6: SetObjectData

		public virtual object SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector)
		{
			Diagram diagram = (Diagram) obj;

			diagram.SuspendEvents = true;
			diagram.Suspend();
			
			mShapes = (Elements) info.GetValue("Shapes",typeof(Elements));
			mLines = (Elements) info.GetValue("Lines",typeof(Elements));
			mLayers = (Layers) info.GetValue("Layers",typeof(Layers));
			
			//Diagram is created without a constructor, so need to do some initialization
			diagram.SetRender(new Render());

			diagram.DiagramSize = Serialize.GetSize(info.GetString("DiagramSize"));
			diagram.Zoom = info.GetSingle("Zoom");
			diagram.ShowTooltips = info.GetBoolean("ShowTooltips");
			diagram.Paged = info.GetBoolean("Paged");
			diagram.CheckBounds = info.GetBoolean("CheckBounds");
			diagram.Margin = (Margin) info.GetValue("Margin",typeof(Margin));
			diagram.WorkspaceColor = Color.FromArgb(Convert.ToInt32(info.GetString("WorkspaceColor")));
			if (Serialize.Contains(info,"Animator", typeof(Animator))) diagram.Animator = (Animator) info.GetValue("Animator", typeof(Animator));

			diagram.Resume();
			diagram.SuspendEvents = false;
			return diagram;
		}
开发者ID:savagemat,项目名称:arcgis-diagrammer,代码行数:27,代码来源:DiagramSerialize.cs

示例7: SetObjectData

		public object SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector)
		{
			int @int = info.GetInt32("value");
			LayerMask layerMask = default(LayerMask);
			layerMask.value = @int;
			return layerMask;
		}
开发者ID:fuboss,项目名称:aiProject,代码行数:7,代码来源:LayerMaskSurrogate.cs

示例8: ChainSelector

 /// <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;
 }
开发者ID:Boxxxx,项目名称:clicker,代码行数:18,代码来源:DictionarySurrogateSelector.cs

示例9: GetSurrogate

        /// <summary>
        /// Returns the surrogate for a particular type.
        /// </summary>
        ///
        /// <returns>The surrogate for a particular type.</returns>
        /// <param name="type">The <see cref="T:System.Type"/> for which the surrogate is
        /// requested.</param>
        /// <param name="context">The streaming context.</param>
        /// <param name="selector">The surrogate to use.</param>
        /// <exception cref="T:System.ArgumentNullException">The
        /// <paramref name="type"/>parameter is null.</exception>
        /// <exception cref="T:System.Security.SecurityException">The caller does not have the
        /// required permission.</exception>
        /// <PermissionSet><IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="SerializationFormatter"/></PermissionSet>
        public virtual ISerializationSurrogate GetSurrogate(Type type, StreamingContext context, out ISurrogateSelector selector) {
            if (type == null) {
                throw new ArgumentNullException("type is null.");
            }

            Dictionary<StreamingContextStates, ISerializationSurrogate> surrogates;
            ISerializationSurrogate serializationSurrogate = null;
            if (_surrogates.TryGetValue(type, out surrogates)) {
                surrogates.TryGetValue(context.State, out serializationSurrogate);
            }

            if (serializationSurrogate != null) {
                selector = this;
                return serializationSurrogate;
            }

            else {
                if (_nextSelector != null) {
                    return _nextSelector.GetSurrogate(type, context, out selector);
                }

                selector = null;
                return null;
            }
        }
开发者ID:Boxxxx,项目名称:clicker,代码行数:39,代码来源:DictionarySurrogateSelector.cs

示例10: typeof

 object ISerializationSurrogate.SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector)
 {
     var blend = (ColorBlend)obj;
     blend.Colors = (Color[])info.GetValue("Colors", typeof(Color[]));
     blend.Positions = (float[])info.GetValue("Positions", typeof(float[]));
     return null;
 }
开发者ID:PedroMaitan,项目名称:sharpmap,代码行数:7,代码来源:Surrogates.Helper.cs

示例11: SetObjectData

 public object SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector)
 {
     var res = (Resolution)obj;
     res.Id = info.GetString("id");
     res.UnitsPerPixel = info.GetDouble("upp");
     return res;
 }
开发者ID:galchen,项目名称:brutile,代码行数:7,代码来源:ResolutionSurrogate.cs

示例12: typeof

 object ISerializationSurrogate.SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector)
 {
     var blend = (ColorMap)obj;
     blend.OldColor = (Color)info.GetValue("old", typeof(Color));
     blend.NewColor = (Color)info.GetValue("new", typeof(Color));
     return null;
 }
开发者ID:geobabbler,项目名称:SharpMap,代码行数:7,代码来源:Surrogates.Helper.cs

示例13: SetObjectData

 /// <summary>
 /// Populates the object using the information in the SerializationInfo
 /// </summary>
 /// <param name="obj">The object to populate.</param>
 /// <param name="info">The information to populate the object.</param>
 /// <param name="context">The source from which the object is deserialized.</param>
 /// <param name="selector">The surrogate selector where the search for a compatible surrogate begins.</param>
 /// <returns></returns>
 public Object SetObjectData(Object obj, SerializationInfo info, StreamingContext context,
                             ISurrogateSelector selector)
 {
     float[] elements = (float[]) info.GetValue("Elements", typeof (float[]));
     Matrix mat = new Matrix(elements[0], elements[1], elements[2], elements[3], elements[4], elements[5]);
     return null;
 }
开发者ID:goranpavlovic,项目名称:Gis,代码行数:15,代码来源:Surrogates.cs

示例14: HasCycle

        [System.Security.SecurityCritical]  // auto-generated
        private static bool HasCycle(ISurrogateSelector selector) {
            ISurrogateSelector head;
            ISurrogateSelector tail; 

            Contract.Assert(selector!=null, "[HasCycle]selector!=null"); 
 

            head = selector; 
            tail = selector;

            while (head!=null) {
                head = head.GetNextSelector(); 
                if (head==null) {
                    return true; 
                } 
                if (head==tail) {
                    return false; 
                }
                head = head.GetNextSelector();
                tail = tail.GetNextSelector();
 
                if (head==tail) {
                    return false; 
                } 
            }
 
            return true;

        }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:30,代码来源:SurrogateSelector.cs

示例15: SetObjectData

        public object SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector)
        {
            var session = getSession(context);

            //Return a reference to a tracked object if available.
            var rawInternalId = info.GetValue(AggregateReferenceSurrogate.ReferenceInfoKey, typeof(InternalId));

            if (rawInternalId == null)
                throw new InvalidOperationException("Expected SerializationInfo to contain an internal id for an aggregate");

            var internalId = (InternalId)rawInternalId;

            if(session.GraphIsTracked(internalId))
                return session.TrackedGraphForInternalId(internalId);

            //To avoid circular references in separate deserialisation sessions, we track active deserialisations.
            session.RecordActiveDeserialization(internalId, obj);

            //If we are not tracking already, then deserialise.
            var data =
                getSerializableMembers(obj, context)
                    .Select(_ => info.GetValue(_.Name, ((FieldInfo)_).FieldType))
                    .ToArray();

            //Returns the passed in obj ref.
            return FormatterServices.PopulateObjectMembers(obj, getSerializableMembers(obj, context), data);
        }
开发者ID:AndyHitchman,项目名称:Stash,代码行数:27,代码来源:AggregateRootSurrogate.cs


注:本文中的ISurrogateSelector类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。