Example #1
0
        //----------------------------------------------------------------------

        /// <summary>
        /// Send a 'reflected' representation of the given type
        /// </summary>
        /// <param name="leftMsg">The message to display</param>
        /// <param name="oType">The type to inspect</param>
        /// <param name="flags">flags to limit information to send</param>
        /// <returns>the new node</returns>
        public TraceNode SendType(string leftMsg, Type oType, TraceDisplayFlags flags)
        {
            if (Enabled == false)
            {
                return(new TraceNode(this));
            }

            TraceNodeEx result = new TraceNodeEx(this, true);  // create a node with same properties as "this" with new ID

            List <string> commandList = PrepareNewNode(leftMsg, result.Id);

            // detect null type
            if (oType == null)
            {
                TMemberNode node = new TMemberNode("Null Type")
                {
                    ViewerKind = TraceConst.CST_VIEWER_OBJECT
                };
                result.Members.Add(node);
                result.Members.AddToStringList(commandList);
                TTrace.SendToWinTraceClient(commandList, WinTraceId);
                return(new TraceNode(result));
            }

            // information are added to the Members array of the new created object the actual object
            // the current instance can be the public 'Warning' node for example used by multi thread application
            result.AddTypeObject(null, oType, flags);
            result.Members.AddToStringList(commandList); // convert all groups and nested items/group to strings

            TTrace.SendToWinTraceClient(commandList, WinTraceId);
            return(new TraceNode(result));
        }