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); }
/// <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); } }
/// <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); } }