• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ISurrogateSelector类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: SetObjectData

		public override object SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector)
		{
			base.SetObjectData(obj,info,context,selector);

			Model model = (Model) obj;
			
			model.SuspendEvents = true;
			model.Suspend();

			model.AlignGrid = info.GetBoolean("AlignGrid");
			model.DragScroll = info.GetBoolean("DragScroll");
			model.DrawGrid = info.GetBoolean("DrawGrid");
			model.DrawPageLines = info.GetBoolean("DrawPageLines");
			model.DrawSelections = info.GetBoolean("DrawSelections");
			model.GridColor = Color.FromArgb(Convert.ToInt32(info.GetString("GridColor")));
			model.GridSize = Serialize.GetSize(info.GetString("GridSize"));
			model.GridStyle = (GridStyle) Enum.Parse(typeof(GridStyle), info.GetString("GridStyle"));
			model.PageLineSize = Serialize.GetSizeF(info.GetString("PageLineSize"));

			if (Serialize.Contains(info,"DragSelect")) model.DragSelect = info.GetBoolean("DragSelect");

			mRuntime = (Runtime) info.GetValue("Runtime",typeof(Runtime));

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


示例17: ObjectManager

 internal ObjectManager(ISurrogateSelector selector, StreamingContext context, bool checkSecurity, bool isCrossAppDomain)
 {
     _objects = new ObjectHolder[DefaultInitialSize];
     _selector = selector;
     _context = context;
     _isCrossAppDomain = isCrossAppDomain;
 }
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:ObjectManager.cs


示例18: ChainSelector

        public void ChainSelector (ISurrogateSelector! selector) {
        /*
            CodeContract.Requires(selector != null);
            CodeContract.Requires(selector != this);
            */

        }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:7,代码来源:System.Runtime.Serialization.SurrogateSelector.cs


示例19: SetObjectData

 public object SetObjectData(Object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector)
 {
   ModelStencil modelStencil = (ModelStencil)obj;
   try
   {
     modelStencil.Groups = (ArrayList)info.GetValue("groups", typeof(ArrayList));
   }
   catch
   {
     modelStencil.Groups = new ArrayList();
     modelStencil.Groups.Add((String)info.GetValue("groupName", typeof(String)));
   }
   modelStencil.Anchors = (ArrayList)info.GetValue("anchors", typeof(ArrayList));
   modelStencil.Decorations = (ArrayList)info.GetValue("decorations", typeof(ArrayList));
   modelStencil.Elements = (ArrayList)info.GetValue("elements", typeof(ArrayList));
   modelStencil.Tag = (String)info.GetValue("tag", typeof(String));
   try
   {
     modelStencil.DefaultSize = (Size)info.GetValue("defaultSize", typeof(String));
   }
   catch
   {
     modelStencil.DefaultSize = new Size(10.0, 10.0);
   }
   return modelStencil;
 }
开发者ID:ChrisMoreton,项目名称:Test3,代码行数:26,代码来源:ModelStencil.cs


示例20: SetObjectData

        public object SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector)
        {
            typeof(Point).GetField("X").SetValue(obj, info.GetString("X"));
            typeof(Point).GetField("Y").SetValue(obj, info.GetString("Y"));

            return null;
        }
开发者ID:Haedrian,项目名称:Divine-Right,代码行数:7,代码来源:PointSerializationSurrogate.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ISymUnmanagedDocument类代码示例发布时间:2022-05-24
下一篇:
C# ISurfaceHolder类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap