Ejemplo n.º 1
0
        internal void StartEvent(TickType type, uint bytes, string channelName, string messageType)
        {
            TickEvent tickEvent = new TickEvent()
            {
                Bytes       = bytes,
                ChannelName = string.IsNullOrEmpty(channelName) ? "NONE" : channelName,
                MessageType = string.IsNullOrEmpty(messageType) ? "NONE" : messageType,
                EventType   = type,
                Closed      = false
            };

            Events.Add(tickEvent);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a ProfilerTick from data in the provided stream
        /// </summary>
        /// <param name="stream">The stream containing the ProfilerTick data</param>
        /// <returns>The ProfilerTick with data read from the stream</returns>
        public static ProfilerTick FromStream(Stream stream)
        {
            ProfilerTick tick = new ProfilerTick();

            using (PooledBitReader reader = PooledBitReader.Get(stream))
            {
                ushort count = reader.ReadUInt16Packed();
                for (int i = 0; i < count; i++)
                {
                    tick.Events.Add(TickEvent.FromStream(stream));
                }

                return(tick);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Creates a TickEvent from data in the provided stream
 /// </summary>
 /// <param name="stream">The stream containing the TickEvent data</param>
 /// <returns>The TickEvent with data read from the stream</returns>
 public static TickEvent FromStream(Stream stream)
 {
     using (PooledBitReader reader = PooledBitReader.Get(stream))
     {
         TickEvent @event = new TickEvent
         {
             EventType   = (TickType)reader.ReadByte(),
             Bytes       = reader.ReadUInt32Packed(),
             ChannelName = reader.ReadStringPacked().ToString(),
             MessageType = reader.ReadStringPacked().ToString(),
             Closed      = reader.ReadBool()
         };
         return(@event);
     }
 }