/// <summary>
        /// Perform actual item tracing.
        /// </summary>
        /// <param name="tracer"></param>
        /// <param name="itemType"></param>
        /// <param name="message"></param>
        static public void DoTrace(Tracer tracer, TracerItem.TypeEnum itemType, TracerItem.PriorityEnum priority, string message)
        {
            if (tracer != null && tracer.Enabled)
            {
                string threadId   = Thread.CurrentThread.ManagedThreadId.ToString();
                string threadName = Thread.CurrentThread.Name;

                MethodBase method = ReflectionHelper.GetExternalCallingMethod(3, OwnerTypes);

                MethodTracerItem item = new MethodTracerItem(itemType, priority, message, method);
                tracer.Add(item);
            }
        }
        /// <summary>
        /// Perform actual item tracing.
        /// </summary>
        /// <param name="tracer"></param>
        /// <param name="itemType"></param>
        /// <param name="message"></param>
        public static void DoTrace(Tracer tracer, TracerItem.TypeEnum itemType, TracerItem.PriorityEnum priority, string message)
        {
            if (tracer != null && tracer.Enabled)
            {
                string threadId = Thread.CurrentThread.ManagedThreadId.ToString();
                string threadName = Thread.CurrentThread.Name;

                MethodBase method = ReflectionHelper.GetExternalCallingMethod(3, OwnerTypes);

                MethodTracerItem item = new MethodTracerItem(itemType, priority, message, method);
                tracer.Add(item);
            }
        }
Esempio n. 3
0
        private void markAllFromThisModuleToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (listView.SelectedIndices.Count == 0 || _itemKeeperSink == null)
            {
                return;
            }

            MethodTracerItem item = _itemKeeperSink.GetFilteredItem(listView.SelectedIndices[0]) as MethodTracerItem;

            if (item != null)
            {
                MarkingMatch = item.MethodBase.DeclaringType.Module.Name.Substring(0, item.MethodBase.DeclaringType.Module.Name.LastIndexOf(".")) + ".";
            }
        }
Esempio n. 4
0
        private void ofThisModuleToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            if (listView.SelectedIndices.Count == 0 || _itemKeeperSink == null)
            {
                return;
            }

            MethodTracerItem item = _itemKeeperSink.GetFilteredItem(listView.SelectedIndices[0]) as MethodTracerItem;

            if (item != null)
            {
                _stringFilter.PositiveFilterString = "[" + item.MethodBase.DeclaringType.Module.Name.Substring(0, item.MethodBase.DeclaringType.Module.Name.LastIndexOf(".")) + ".";
                //toolStripTextBoxSearch.Text = "[" + item.MethodBase.DeclaringType.Module.Name.Substring(0, item.MethodBase.DeclaringType.Module.Name.LastIndexOf(".")) + ".";
            }

            //toolStripButtonSearch_Click(sender, e);
        }
        /// <summary>
        ///
        /// </summary>
        public override bool FilterItem(TracerItem item)
        {
            if (item is MethodTracerItem == false)
            {
                return(true);
            }

            bool updated = false;
            bool result  = false;

            lock (this)
            {
                MethodTracerItem actualItem = (MethodTracerItem)item;
                if (_assemblies.ContainsKey(actualItem.MethodBase.DeclaringType.Assembly) == false)
                {// Add assembly.
                    _assemblies.Add(actualItem.MethodBase.DeclaringType.Assembly, new AssemblyTracingInformation());
                    updated = true;
                }

                if (_assemblies[actualItem.MethodBase.DeclaringType.Assembly].Enabled == false)
                {// Entire assembly stopped.
                    return(false);
                }

                if (_assemblies[actualItem.MethodBase.DeclaringType.Assembly].Types.ContainsKey(actualItem.MethodBase.DeclaringType) == false)
                {// Add type.
                    _assemblies[actualItem.MethodBase.DeclaringType.Assembly].Types.Add(actualItem.MethodBase.DeclaringType, true);
                    updated = true;
                    result  = true;
                }
                else
                {
                    return(_assemblies[actualItem.MethodBase.DeclaringType.Assembly].Types[actualItem.MethodBase.DeclaringType]);
                }
            }

            if (updated)
            {
                RaiseFilterUpdatedEvent();
            }

            return(result);
        }
        private void ofThisModuleToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            if (listView.SelectedIndices.Count == 0 || _itemKeeperSink == null)
            {
                return;
            }

            MethodTracerItem item = null;

            lock (_itemKeeperSink)
            {
                item = _itemKeeperSink.FilteredItemsUnsafe[listView.SelectedIndices[0]] as MethodTracerItem;
            }

            if (item != null)
            {
                toolStripTextBoxSearch.Text = "[" + item.MethodBase.DeclaringType.Module.Name.Substring(0, item.MethodBase.DeclaringType.Module.Name.LastIndexOf(".")) + ".";
            }

            toolStripButtonSearch_Click(sender, e);
        }
        private void markAllFromThisMethodToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (listView.SelectedIndices.Count == 0 || _itemKeeperSink == null)
            {
                return;
            }

            MethodTracerItem item = null;

            lock (_itemKeeperSink)
            {
                item = _itemKeeperSink.FilteredItemsUnsafe[listView.SelectedIndices[0]] as MethodTracerItem;
            }

            if (item != null)
            {
                toolStripTextBoxSearch.Text = item.MethodBase.DeclaringType.Name + "." + item.MethodBase.Name;
            }

            toolStripButtonMark_Click(sender, e);
        }