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


C# TraceEvent.GetInt32At方法代码示例

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


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

示例1: ReadProcessStopEvent

        private void ReadProcessStopEvent(TraceEvent traceEvent)
        {
            switch (traceEvent.Version)
            {
                case 0:
                case 1:
                    // Both version 0 and version 1 have the same initial fields:
                    //
                    // <data name="ProcessID" inType="win:UInt32" outType="win:PID"></data>
                    // <data name="CreateTime" inType="win:FILETIME" outType="xs:dateTime"></data>
                    // <data name="ExitTime" inType="win:FILETIME" outType="xs:dateTime"></data>
                    // <data name="ExitCode" inType="win:UInt32" outType="xs:unsignedInt"></data>
                    EventHandler<ProcessEventArgs> handler = this.ProcessStopped;
                    if (handler != null)
                    {
                        int processId = traceEvent.GetInt32At(0);
                        DateTime exitTime = DateTime.FromFileTime(traceEvent.GetInt64At(12));
                        int exitCode = traceEvent.GetInt32At(20);
                        ProcessEventArgs e = new ProcessEventArgs()
                        {
                            ExitCode = exitCode,
                            Id = processId,
                            Timestamp = exitTime
                        };

                        handler(this, e);
                    }

                    break;
            }
        }
开发者ID:knightfall,项目名称:writeasync,代码行数:31,代码来源:KernelProcessSession.cs

示例2: ReadProcessStartEvent

        private void ReadProcessStartEvent(TraceEvent traceEvent)
        {
            if (traceEvent.Version == 0)
            {
                // <data name="ProcessID" inType="win:UInt32" outType="win:PID"></data>
                // <data name="CreateTime" inType="win:FILETIME" outType="xs:dateTime"></data>
                // <data name="ParentProcessID" inType="win:UInt32" outType="win:PID"></data>
                // <data name="SessionID" inType="win:UInt32" outType="xs:unsignedInt"></data>
                // <data name="ImageName" inType="win:UnicodeString" outType="xs:string"></data>
                EventHandler<ProcessEventArgs> handler = this.ProcessStarted;
                if (handler != null)
                {
                    int processId = traceEvent.GetInt32At(0);
                    DateTime createTime = DateTime.FromFileTime(traceEvent.GetInt64At(4));
                    string imageName = traceEvent.GetUnicodeStringAt(20);
                    ProcessEventArgs e = new ProcessEventArgs()
                    {
                        Id = processId,
                        ImageName = imageName,
                        Timestamp = createTime
                    };

                    handler(this, e);
                }
            }
        }
开发者ID:knightfall,项目名称:writeasync,代码行数:26,代码来源:KernelProcessSession.cs


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