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


C# PacketReader.ReadId方法代码示例

本文整理汇总了C#中System.IO.PacketReader.ReadId方法的典型用法代码示例。如果您正苦于以下问题:C# PacketReader.ReadId方法的具体用法?C# PacketReader.ReadId怎么用?C# PacketReader.ReadId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.IO.PacketReader的用法示例。


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

示例1: ReadCattrs

 CattrInfo[] ReadCattrs(PacketReader r)
 {
     CattrInfo[] res = new CattrInfo [r.ReadInt ()];
     for (int i = 0; i < res.Length; ++i) {
         CattrInfo info = new CattrInfo ();
         info.ctor_id = r.ReadId ();
         info.ctor_args = new ValueImpl [r.ReadInt ()];
         for (int j = 0; j < info.ctor_args.Length; ++j) {
             info.ctor_args [j] = r.ReadValue ();
         }
         info.named_args = new CattrNamedArgInfo [r.ReadInt ()];
         for (int j = 0; j < info.named_args.Length; ++j) {
             CattrNamedArgInfo arg = new CattrNamedArgInfo ();
             int arg_type = r.ReadByte ();
             arg.is_property = arg_type == 0x54;
             arg.id = r.ReadId ();
             arg.value = r.ReadValue ();
             info.named_args [j] = arg;
         }
         res [i] = info;
     }
     return res;
 }
开发者ID:nerzhulart,项目名称:debugger-libs,代码行数:23,代码来源:Connection.cs

示例2: ReceivePacket

        bool ReceivePacket()
        {
            byte[] packet = ReadPacket ();

                if (packet.Length == 0) {
                    return false;
                }

                if (IsReplyPacket (packet)) {
                    int id = GetPacketId (packet);
                    ReplyCallback cb = null;
                    lock (reply_packets_monitor) {
                        reply_cbs.TryGetValue (id, out cb);
                        if (cb == null) {
                            reply_packets [id] = packet;
                            Monitor.PulseAll (reply_packets_monitor);
                        } else {
                            int c = reply_cb_counts [id];
                            c --;
                            if (c == 0) {
                                reply_cbs.Remove (id);
                                reply_cb_counts.Remove (id);
                            }
                        }
                    }

                    if (cb != null)
                        cb.Invoke (id, packet);
                } else {
                    PacketReader r = new PacketReader (packet);

                    if (r.CommandSet == CommandSet.EVENT && r.Command == (int)CmdEvent.COMPOSITE) {
                        int spolicy = r.ReadByte ();
                        int nevents = r.ReadInt ();

                        SuspendPolicy suspend_policy = decode_suspend_policy (spolicy);

                        EventInfo[] events = new EventInfo [nevents];

                        for (int i = 0; i < nevents; ++i) {
                            EventKind kind = (EventKind)r.ReadByte ();
                            int req_id = r.ReadInt ();

                            EventType etype = (EventType)kind;

                            long thread_id = r.ReadId ();
                            if (kind == EventKind.VM_START) {
                                events [i] = new EventInfo (etype, req_id) { ThreadId = thread_id };
                                //EventHandler.VMStart (req_id, thread_id, null);
                            } else if (kind == EventKind.VM_DEATH) {
                                int exit_code = 0;
                                if (Version.AtLeast (2, 27))
                                    exit_code = r.ReadInt ();
                                //EventHandler.VMDeath (req_id, 0, null);
                                events [i] = new EventInfo (etype, req_id) { ExitCode = exit_code };
                            } else if (kind == EventKind.THREAD_START) {
                                events [i] = new EventInfo (etype, req_id) { ThreadId = thread_id, Id = thread_id };
                                //EventHandler.ThreadStart (req_id, thread_id, thread_id);
                            } else if (kind == EventKind.THREAD_DEATH) {
                                events [i] = new EventInfo (etype, req_id) { ThreadId = thread_id, Id = thread_id };
                                //EventHandler.ThreadDeath (req_id, thread_id, thread_id);
                            } else if (kind == EventKind.ASSEMBLY_LOAD) {
                                long id = r.ReadId ();
                                events [i] = new EventInfo (etype, req_id) { ThreadId = thread_id, Id = id };
                                //EventHandler.AssemblyLoad (req_id, thread_id, id);
                            } else if (kind == EventKind.ASSEMBLY_UNLOAD) {
                                long id = r.ReadId ();
                                events [i] = new EventInfo (etype, req_id) { ThreadId = thread_id, Id = id };
                                //EventHandler.AssemblyUnload (req_id, thread_id, id);
                            } else if (kind == EventKind.TYPE_LOAD) {
                                long id = r.ReadId ();
                                events [i] = new EventInfo (etype, req_id) { ThreadId = thread_id, Id = id };
                                //EventHandler.TypeLoad (req_id, thread_id, id);
                            } else if (kind == EventKind.METHOD_ENTRY) {
                                long id = r.ReadId ();
                                events [i] = new EventInfo (etype, req_id) { ThreadId = thread_id, Id = id };
                                //EventHandler.MethodEntry (req_id, thread_id, id);
                            } else if (kind == EventKind.METHOD_EXIT) {
                                long id = r.ReadId ();
                                events [i] = new EventInfo (etype, req_id) { ThreadId = thread_id, Id = id };
                                //EventHandler.MethodExit (req_id, thread_id, id);
                            } else if (kind == EventKind.BREAKPOINT) {
                                long id = r.ReadId ();
                                long loc = r.ReadLong ();
                                events [i] = new EventInfo (etype, req_id) { ThreadId = thread_id, Id = id, Location = loc };
                                //EventHandler.Breakpoint (req_id, thread_id, id, loc);
                            } else if (kind == EventKind.STEP) {
                                long id = r.ReadId ();
                                long loc = r.ReadLong ();
                                events [i] = new EventInfo (etype, req_id) { ThreadId = thread_id, Id = id, Location = loc };
                                //EventHandler.Step (req_id, thread_id, id, loc);
                            } else if (kind == EventKind.EXCEPTION) {
                                long id = r.ReadId ();
                                long loc = 0; // FIXME
                                events [i] = new EventInfo (etype, req_id) { ThreadId = thread_id, Id = id, Location = loc };
                                //EventHandler.Exception (req_id, thread_id, id, loc);
                            } else if (kind == EventKind.APPDOMAIN_CREATE) {
                                long id = r.ReadId ();
                                events [i] = new EventInfo (etype, req_id) { ThreadId = thread_id, Id = id };
                                //EventHandler.AppDomainCreate (req_id, thread_id, id);
//.........这里部分代码省略.........
开发者ID:nerzhulart,项目名称:debugger-libs,代码行数:101,代码来源:Connection.cs

示例3: ReceivePacket

		bool ReceivePacket () {
				byte[] packet = ReadPacket ();

				if (packet.Length == 0) {
					return false;
				}

				if (IsReplyPacket (packet)) {
					int id = GetPacketId (packet);
					ReplyCallback cb = null;
					lock (reply_packets_monitor) {
						reply_cbs.TryGetValue (id, out cb);
						if (cb == null) {
							reply_packets [id] = packet;
							Monitor.PulseAll (reply_packets_monitor);
						}
					}

					if (cb != null)
						cb.Invoke (id, packet);
				} else {
					PacketReader r = new PacketReader (packet);

					if (r.CommandSet == CommandSet.EVENT && r.Command == (int)CmdEvent.COMPOSITE) {
						r.ReadByte (); // suspend_policy
						int nevents = r.ReadInt ();

						for (int i = 0; i < nevents; ++i) {
							EventKind kind = (EventKind)r.ReadByte ();
							int req_id = r.ReadInt ();

							if (kind == EventKind.VM_START) {
								long thread_id = r.ReadId ();
								EventHandler.VMStart (req_id, thread_id, null);
							} else if (kind == EventKind.VM_DEATH) {
								EventHandler.VMDeath (req_id, 0, null);
							} else if (kind == EventKind.THREAD_START) {
								long thread_id = r.ReadId ();
								EventHandler.ThreadStart (req_id, thread_id, thread_id);
							} else if (kind == EventKind.THREAD_DEATH) {
								long thread_id = r.ReadId ();
								EventHandler.ThreadDeath (req_id, thread_id, thread_id);
							} else if (kind == EventKind.ASSEMBLY_LOAD) {
								long thread_id = r.ReadId ();
								long id = r.ReadId ();
								EventHandler.AssemblyLoad (req_id, thread_id, id);
							} else if (kind == EventKind.ASSEMBLY_UNLOAD) {
								long thread_id = r.ReadId ();
								long id = r.ReadId ();
								EventHandler.AssemblyUnload (req_id, thread_id, id);
							} else if (kind == EventKind.TYPE_LOAD) {
								long thread_id = r.ReadId ();
								long id = r.ReadId ();
								EventHandler.TypeLoad (req_id, thread_id, id);
							} else if (kind == EventKind.METHOD_ENTRY) {
								long thread_id = r.ReadId ();
								long id = r.ReadId ();
								EventHandler.MethodEntry (req_id, thread_id, id);
							} else if (kind == EventKind.METHOD_EXIT) {
								long thread_id = r.ReadId ();
								long id = r.ReadId ();
								EventHandler.MethodExit (req_id, thread_id, id);
							} else if (kind == EventKind.BREAKPOINT) {
								long thread_id = r.ReadId ();
								long id = r.ReadId ();
								long loc = r.ReadLong ();
								EventHandler.Breakpoint (req_id, thread_id, id, loc);
							} else if (kind == EventKind.STEP) {
								long thread_id = r.ReadId ();
								long id = r.ReadId ();
								long loc = r.ReadLong ();
								EventHandler.Step (req_id, thread_id, id, loc);
							} else if (kind == EventKind.EXCEPTION) {
								long thread_id = r.ReadId ();
								long id = r.ReadId ();
								long loc = 0; // FIXME
								EventHandler.Exception (req_id, thread_id, id, loc);
							} else if (kind == EventKind.APPDOMAIN_CREATE) {
								long thread_id = r.ReadId ();
								long id = r.ReadId ();
								EventHandler.AppDomainCreate (req_id, thread_id, id);
							} else if (kind == EventKind.APPDOMAIN_UNLOAD) {
								long thread_id = r.ReadId ();
								long id = r.ReadId ();
								EventHandler.AppDomainUnload (req_id, thread_id, id);
							} else {
								throw new NotImplementedException ("Unknown event kind: " + kind);
							}
						}
					}
				}

				return true;
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:94,代码来源:Connection.cs


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