/// <summary>
 /// 
 /// </summary>
 /// <param name="tracer"></param>
 public TypeTracerFilter(Tracer tracer)
     : base(tracer)
 {
     // Load the basic types.
     Array items = Enum.GetValues(typeof(TracerItem.TypeEnum));
     for (int i = 0; i < items.Length; i++)
     {
         _itemTypes.Add((TracerItem.TypeEnum)items.GetValue(i), true);
     }
 }
        /// <summary>
        /// Constructor.
        /// </summary>
        public TracerControl()
        {
            InitializeComponent();
            _tracer = new Tracer();

            listView.VirtualItemsSelectionRangeChanged += new ListViewVirtualItemsSelectionRangeChangedEventHandler(listView_VirtualItemsSelectionRangeChanged);

            listView.AdvancedColumnManagement.Add(0, new VirtualListViewEx.ColumnManagementInfo() { AutoResizeMode = ColumnHeaderAutoResizeStyle.ColumnContent });
            listView.AdvancedColumnManagement.Add(1, new VirtualListViewEx.ColumnManagementInfo() { FillWhiteSpace = true });
        }
 /// <summary>
 /// Constructor.
 /// </summary>
 public EnumItemTracerFilter(Tracer tracer)
     : base(tracer)
 {
     // Find all candidate enum types and assemblies they reside in.
     List<Type> possibleEnumTypes = ReflectionHelper.GatherTypeChildrenTypesFromAssemblies(typeof(Enum), ReflectionHelper.GetApplicationEntryAssemblyAndReferencedAssemblies());
     for (int i = possibleEnumTypes.Count - 1; i >= 0; i--)
     {
         object[] attributes = possibleEnumTypes[i].GetCustomAttributes(typeof(TracerEnumAttribute), true);
         if (attributes == null || attributes.Length == 0)
         {
             possibleEnumTypes.RemoveAt(i);
         }
         else
         {
             _assemblies.Add(possibleEnumTypes[i].Assembly);
         }
     }
 }
        /// <summary>
        /// Constructor.
        /// </summary>
        public MethodTracerFilter(Tracer tracer)
            : base(tracer)
        {
            foreach (Assembly assembly in ReflectionHelper.GetApplicationEntryAssemblyAndReferencedAssemblies())
            {
                object[] copyright = assembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), true);
                if (copyright != null && copyright.Length > 0)
                {// Skip system assemblies.
                    AssemblyCopyrightAttribute attribute = (AssemblyCopyrightAttribute)copyright[0];
                    if (attribute.Copyright.Contains("Microsoft"))
                    {
                        continue;
                    }
                }

                _assemblies.Add(assembly, new AssemblyTracingInformation());
            }
        }
        /// <summary>
        /// 
        /// </summary>
        public void Load(Control ownerControl, Timer timer, Tracer tracer, StatusStrip targetStatusStrip)
        {
            _timer = timer;
            _timer.Tick += new EventHandler(_timer_Tick);

            _tracer = tracer;
            _tracer.ItemAddedEvent += new Tracer.ItemUpdateDelegate(_tracer_ItemAddedEvent);

            _itemKeeperSink = (TracerItemKeeperSink)_tracer.GetSinkByType(typeof(TracerItemKeeperSink));

            _targetStatusStrip = targetStatusStrip;

            _ownerControl = ownerControl;

            separator1 = new ToolStripSeparator();
            separator2 = new ToolStripSeparator();

            this.toolStripStatusLabelSystemReport = new System.Windows.Forms.ToolStripStatusLabel();
            this.toolStripStatusLabelReport = new System.Windows.Forms.ToolStripStatusLabel();
            this.toolStripStatusLabelReportsLink = new System.Windows.Forms.ToolStripStatusLabel();
            this.toolStripStatusLabelWarningsLink = new System.Windows.Forms.ToolStripStatusLabel();
            this.toolStripStatusLabelErrorsLink = new System.Windows.Forms.ToolStripStatusLabel();

            //
            // toolStripStatusLabelSystemReport
            //
            this.toolStripStatusLabelSystemReport.ForeColor = System.Drawing.SystemColors.InactiveCaptionText;
            this.toolStripStatusLabelSystemReport.Name = "toolStripStatusLabelSystemReport";
            this.toolStripStatusLabelSystemReport.Size = new System.Drawing.Size(78, 17);
            this.toolStripStatusLabelSystemReport.Text = "System Report";
            //
            // toolStripStatusLabelReport
            //
            //this.toolStripStatusLabelReport.Image = ((System.Drawing.Image)(resources.GetObject("toolStripStatusLabelReport.Image")));
            this.toolStripStatusLabelReport.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.toolStripStatusLabelReport.IsLink = false;
            this.toolStripStatusLabelReport.LinkColor = System.Drawing.SystemColors.HighlightText;
            this.toolStripStatusLabelReport.Name = "toolStripStatusLabelReport";
            this.toolStripStatusLabelReport.Size = new System.Drawing.Size(127, 17);
            this.toolStripStatusLabelReport.Spring = true;
            this.toolStripStatusLabelReport.Text = "toolStripStatusLabel1";
            this.toolStripStatusLabelReport.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            //
            // toolStripStatusLabelReportsLink
            //
            this.toolStripStatusLabelReportsLink.IsLink = false;
            this.toolStripStatusLabelReportsLink.LinkColor = System.Drawing.SystemColors.HighlightText;
            this.toolStripStatusLabelReportsLink.Name = "toolStripStatusLabelReportsLink";
            this.toolStripStatusLabelReportsLink.Size = new System.Drawing.Size(54, 17);
            this.toolStripStatusLabelReportsLink.Text = "0 Reports";
            //
            // toolStripStatusLabelWarningsLink
            //
            this.toolStripStatusLabelWarningsLink.IsLink = false;
            this.toolStripStatusLabelWarningsLink.LinkColor = System.Drawing.SystemColors.HighlightText;
            this.toolStripStatusLabelWarningsLink.Name = "toolStripStatusLabelWarningsLink";
            this.toolStripStatusLabelWarningsLink.Size = new System.Drawing.Size(61, 17);
            this.toolStripStatusLabelWarningsLink.Text = "0 Warnings";
            //
            // toolStripStatusLabelErrorsLink
            //
            this.toolStripStatusLabelErrorsLink.IsLink = false;
            this.toolStripStatusLabelErrorsLink.LinkColor = System.Drawing.SystemColors.HighlightText;
            this.toolStripStatusLabelErrorsLink.Name = "toolStripStatusLabelErrorsLink";
            this.toolStripStatusLabelErrorsLink.Size = new System.Drawing.Size(45, 17);
            this.toolStripStatusLabelErrorsLink.Text = "0 Errors";

            targetStatusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[]
            {
            //                separator1,
                this.toolStripStatusLabelSystemReport,
                this.toolStripStatusLabelReport,
                separator2,
                this.toolStripStatusLabelErrorsLink,
                this.toolStripStatusLabelWarningsLink,
                this.toolStripStatusLabelReportsLink,
            });

            ShowItem(null);
        }
        void _tracer_ItemAddedEvent(Tracer tracer, TracerItem item)
        {
            if ((item.FullType & _filterItemType) != 0)
            {
                lock (this)
                {
                    if (_pendingMessageItems.Count > MaxPendingItems)
                    {
                        _pendingMessageItems.RemoveAt(0);
                    }

                    _pendingMessageItems.Add(item);
                }
            }
        }
        /// <summary>
        /// 
        /// </summary>
        public void UnLoad()
        {
            if (_timer != null)
            {
                _timer.Tick -= new EventHandler(_timer_Tick);
                _timer = null;
            }

            if (_tracer != null)
            {
                _tracer.ItemAddedEvent -= new Tracer.ItemUpdateDelegate(_tracer_ItemAddedEvent);
                _tracer = null;
            }

            if (_targetStatusStrip != null)
            {
                _targetStatusStrip.Items.Remove(separator1);
                _targetStatusStrip.Items.Remove(separator2);
                _targetStatusStrip.Items.Remove(this.toolStripStatusLabelSystemReport);
                _targetStatusStrip.Items.Remove(this.toolStripStatusLabelReport);
                _targetStatusStrip.Items.Remove(this.toolStripStatusLabelReportsLink);
                _targetStatusStrip.Items.Remove(this.toolStripStatusLabelWarningsLink);
                _targetStatusStrip.Items.Remove(this.toolStripStatusLabelErrorsLink);

                _targetStatusStrip = null;
            }

            _ownerControl = null;
            _itemKeeperSink = null;

            lock (this)
            {
                _pendingMessageItems.Clear();
            }
        }
 /// <summary>
 /// Detailed constructor.
 /// </summary>
 public FileTracerItemSink(Tracer tracer, string filePath)
     : base(tracer)
 {
     FilePath = filePath;
 }
Ejemplo n.º 9
0
        /// <summary>
        /// 
        /// </summary>
        public bool Initialize(Tracer tracer)
        {
            if (_tracer != null)
            {
                SystemMonitor.OperationError("Filter already initialized.");
                return false;
            }

            _tracer = tracer;
            return true;
        }
 /// <summary>
 /// Constructor.
 /// </summary>
 public PriorityFilter(Tracer tracer)
     : base(tracer)
 {
 }
 /// <summary>
 /// 
 /// </summary>
 public SystemTracerItemSink(Tracer tracer)
     : base(tracer)
 {
 }
 public override void OnDeserialization(object sender)
 {
     base.OnDeserialization(sender);
     _tracer = new Tracer();
     _tracer.Add(new TracerItemKeeperSink(_tracer));
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 public StringTracerFilter(Tracer tracer)
     : base(tracer)
 {
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 public TracerItemKeeperSink(Tracer tracer)
     : base(tracer)
 {
     SetupItemsByType();
 }
 /// <summary>
 /// 
 /// </summary>
 public virtual void Dispose()
 {
     Clear();
     _tracer = null;
 }
 /// <summary>
 /// 
 /// </summary>
 public TracerItemSink(Tracer tracer)
 {
     _tracer = tracer;
 }
Ejemplo n.º 17
0
 public void OnDeserialization(object sender)
 {
     _tracer = TracerHelper.Tracer;
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 public FileTracerItemSink(Tracer tracer)
     : base(tracer)
 {
 }
Ejemplo n.º 19
0
 /// <summary>
 /// 
 /// </summary>
 public TracerFilter(Tracer tracer)
 {
     _tracer = tracer;
 }