private void gridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { try { if (gridViewPackets.IsGroupRow(e.FocusedRowHandle)) { txtCallStack.Text = string.Empty; esParametersBindingSource.DataSource = null; txtSQL.Text = string.Empty; txtException.Text = string.Empty; return; } int index = gridViewPackets.ViewRowHandleToDataSourceIndex(e.FocusedRowHandle); esTracePacket packet = currentChannel.ChannelData[index]; txtSQL.Text = packet.Sql; SetParserSyntax(packet.Syntax); parser.SqlText.Text = packet.Sql; txtSQL.Rtf = parser.ToRTF(TOutputFmt.ofrtf); txtException.Text = packet.Exception; txtCallStack.Text = packet.CallStack; if (packet.SqlParameters != null) { esParametersBindingSource.DataSource = packet.SqlParameters; } } catch { } }
private void AddEntryToList(Channel channel, esTracePacket entry) { if (!IsDisposed) { lock (channel.TheLock) { channel.IncomingPackets.Add(entry); if (channel.IncomingPackets.Count == 1) { channel.NavBarItem.SmallImageIndex = 7; } if (channel.IncomingPackets.Count == 10) { // If called from a seperate thread, rejoin so that be can update form elements. if (InvokeRequired && !IsDisposed) { try { // onClosing messages may fail if the form is being disposed. Invoke((MethodInvoker) delegate() { AddEntriesToList(channel); }); } catch (ObjectDisposedException) { } } else { AddEntriesToList(channel); } } } } }
private void OnMessageReceived(object sender, XDMessageEventArgs e) { try { esTracePacket entry = new esTracePacket(); string[] fields = e.DataGram.Message.Split('±'); if (fields[0].Length > 0) { entry.TransactionId = Convert.ToInt32(fields[0]); } if (fields[1].Length > 0) { entry.ObjectType = fields[1]; } entry.CallStack = fields[2]; entry.ApplicationName = fields[3]; entry.TraceChannel = fields[4]; entry.ThreadId = Convert.ToInt32(fields[5]); entry.Sql = fields[6]; entry.Duration = Convert.ToInt64(fields[7]); entry.Ticks = Convert.ToInt64(fields[8]); entry.PacketOrder = Convert.ToInt64(fields[9]); entry.Action = fields[10]; entry.Syntax = fields[11]; entry.Exception = fields[12]; if (fields[13].Length > 0) { // Parse Parameters string[] parameters = fields[13].Split('«'); esParameter param = null; for (int i = 0; i < parameters.Length; i += 5) { if (param == null) { param = new esParameter(); } param.Name = parameters[i]; param.Direction = parameters[i + 1]; param.ParamType = parameters[i + 2]; if (parameters[i + 3] != "null") { param.BeforeValue = parameters[i + 3]; } if (parameters[i + 4] != "null") { param.AfterValue = parameters[i + 4]; } entry.SqlParameters.Add(param); param = null; } } switch (entry.TraceChannel) { case Channels.Channel_1: AddEntryToList(channel_1, entry); break; case Channels.Channel_2: AddEntryToList(channel_2, entry); break; case Channels.Channel_3: AddEntryToList(channel_3, entry); break; case Channels.Channel_4: AddEntryToList(channel_4, entry); break; case Channels.Channel_5: AddEntryToList(channel_5, entry); break; case Channels.Channel_6: AddEntryToList(channel_6, entry); break; case Channels.Channel_7: AddEntryToList(channel_7, entry); break; case Channels.Channel_8: AddEntryToList(channel_8, entry); break; case Channels.Channel_9: AddEntryToList(channel_9, entry); break; case Channels.Channel_10: AddEntryToList(channel_10, entry); break; } } catch { } }
private void OnMessageReceived(object sender, XDMessageEventArgs e) { #if PROFILER_TRIAL if (++mod % 1000 == 0) { Licensing license = new Licensing(); string id = license.getUniqueID("C"); int result = licensing.ValidateLicense("trial", "b69e3783-9f56-47a7-82e0-6eee6d0779bf", System.Environment.MachineName, id, version, proxySettings); if (1 != result) { result = licensing.RegisterLicense("trial", "b69e3783-9f56-47a7-82e0-6eee6d0779bf", System.Environment.MachineName, id, version, proxySettings); } if (result != 1) { listener.UnRegisterChannel(Channels.Channel_1); listener.UnRegisterChannel(Channels.Channel_2); listener.UnRegisterChannel(Channels.Channel_3); listener.UnRegisterChannel(Channels.Channel_4); listener.UnRegisterChannel(Channels.Channel_5); listener.UnRegisterChannel(Channels.Channel_6); listener.UnRegisterChannel(Channels.Channel_7); listener.UnRegisterChannel(Channels.Channel_8); listener.UnRegisterChannel(Channels.Channel_9); listener.UnRegisterChannel(Channels.Channel_10); return; } } #endif try { esTracePacket entry = new esTracePacket(); string[] fields = e.DataGram.Message.Split('±'); if (fields[0].Length > 0) { entry.TransactionId = Convert.ToInt32(fields[0]); } if (fields[1].Length > 0) { entry.ObjectType = fields[1]; } entry.CallStack = fields[2]; entry.ApplicationName = fields[3]; entry.TraceChannel = fields[4]; entry.ThreadId = Convert.ToInt32(fields[5]); entry.Sql = fields[6]; entry.Duration = Convert.ToInt64(fields[7]); entry.Ticks = Convert.ToInt64(fields[8]); entry.PacketOrder = Convert.ToInt64(fields[9]); entry.Action = fields[10]; entry.Syntax = fields[11]; entry.Exception = fields[12]; if (fields[13].Length > 0) { // Parse Parameters string[] parameters = fields[13].Split('«'); esParameter param = null; for (int i = 0; i < parameters.Length; i += 5) { if (param == null) { param = new esParameter(); } param.Name = parameters[i]; param.Direction = parameters[i + 1]; param.ParamType = parameters[i + 2]; if (parameters[i + 3] != "null") { param.BeforeValue = parameters[i + 3]; } if (parameters[i + 4] != "null") { param.AfterValue = parameters[i + 4]; } entry.SqlParameters.Add(param); param = null; } } switch (entry.TraceChannel) { case Channels.Channel_1: AddEntryToList(channel_1, entry); break; case Channels.Channel_2: AddEntryToList(channel_2, entry); break; case Channels.Channel_3: AddEntryToList(channel_3, entry); break; case Channels.Channel_4: AddEntryToList(channel_4, entry); break; case Channels.Channel_5: AddEntryToList(channel_5, entry); break; case Channels.Channel_6: AddEntryToList(channel_6, entry); break; case Channels.Channel_7: AddEntryToList(channel_7, entry); break; case Channels.Channel_8: AddEntryToList(channel_8, entry); break; case Channels.Channel_9: AddEntryToList(channel_9, entry); break; case Channels.Channel_10: AddEntryToList(channel_10, entry); break; } } catch { } }