예제 #1
0
        /// <summary>
        /// Logs a component message to the messaging profiler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="type"></param>
        /// <param name="args"></param>
        private void LogComponentMessage(object sender, ComponentMessageType type, params object[] args)
        {
            if (!_messageProfiling)
            {
                return;
            }
            var senderfamily = ComponentFamily.Generic;
            var uid          = 0;
            var sendertype   = "";

            //if (sender.GetType().IsAssignableFrom(typeof(Component)))
            if (typeof(Component).IsAssignableFrom(sender.GetType()))
            {
                var realsender = (Component)sender;
                senderfamily = realsender.Family;

                uid        = realsender.Owner.Uid;
                sendertype = realsender.GetType().ToString();
            }
            else
            {
                sendertype = sender.GetType().ToString();
            }
            //Log the message
            IMessageLogger logger = IoCManager.Resolve <IMessageLogger>();

            logger.LogComponentMessage(uid, senderfamily, sendertype, type);
        }