Ejemplo n.º 1
0
        private void OnMesssageDispatched(MessageDispatcher dispatcher, Message message)
        {
            if (IsPaused && !OnTheFly)
            {
                return;
            }

            var            dumper = new TreeDumper(message);
            ObjectDumpNode tree   = dumper.GetDumpTree();

            NetworkMessage networkMessage = message as NetworkMessage;

            if (networkMessage != null)
            {
                tree.TimeStamp = DateTime.Now;
                tree.Id        = networkMessage.MessageId;
                tree.From      = networkMessage.From;

                foreach (ObjectDumpNode child in tree.Childrens)
                {
                    if (m_seeProperties)
                    {
                        child.IsVisible = true;
                    }
                    else if (child.IsProperty)
                    {
                        child.IsVisible = false;
                    }
                }

                if (!IsPaused)
                {
                    m_messages.Add(tree);

                    #region Cleaning : avoid memory overflow on a long run
                    if (NbMessagesToKeep > 0 && m_messages.Count > NbMessagesToKeep)
                    {
                        m_messages.RemoveAt(0);
                    }
                    #endregion Cleaning : avoid memory overflow on a long run
                }
                #region Record On the fly
                if (OnTheFly)
                {
                    FlushOnTheFly(tree.ExportToString(true));
                }
                #endregion Record On the fly
            }
            else
            if (OnTheFly)
            {
                if (message is InformationMessage)
                {
                    #region Record On the fly
                    if (OnTheFly)
                    {
                        FlushOnTheFly((message as InformationMessage).Message + "\n");
                    }
                    #endregion Record On the fly
                }
            }
        }