コード例 #1
0
 /// <summary>
 /// Creates a copy of specified notification, usefull if one wishes
 /// to provide same information binding wise as debug wise
 /// </summary>
 /// <param name="aMsg">
 /// Notification which must be copied <see cref="DebugNotification"/>
 /// </param>
 /// <returns>
 /// Copy of notification, null if original was null <see cref="DebugNotification"/>
 /// </returns>
 public static DebugNotification Copy(DebugNotification aMsg)
 {
     if (aMsg == null)
     {
         return(null);
     }
     return(new DebugNotification(aMsg.MsgType, aMsg.TitleString, aMsg.Text, aMsg.AttachedObject));
 }
コード例 #2
0
 /// <summary>
 /// Pushes application message
 /// </summary>
 /// <param name="aMessage">
 /// Message to be pushed in queue <see cref="AppNotification"/>
 /// </param>
 public static void Push(DebugNotification aMessage)
 {
     if (aMessage == null)
     {
         return;
     }
     if (Debug.Active == true)
     {
         if (onMessagePush != null)
         {
             onMessagePush(aMessage);
         }
     }
 }
コード例 #3
0
        /// <summary>
        /// Consoledebug main method
        /// </summary>
        /// <param name="aNotification">
        /// Notification to display <see cref="DebugNotification"/>
        /// </param>
        public static void ConsoleDebugger(DebugNotification aNotification)
        {
//#if DEBUG
            if (aNotification == null)
            {
                return;
            }
            bool   pushfound = false;
            string type      = aNotification.MsgType.ToString();

            Console.Error.WriteLine(type.ToUpper() + ": " +
                                    aNotification.Title + "\n" +
                                    "   " + aNotification.Text);
            if (Debug.Level > 5)
            {
                StackTrace st          = new StackTrace(true);
                string     stackIndent = "     ";
                for (int i = 0; i < st.FrameCount; i++)
                {
                    // Note that at this level, there are four
                    // stack frames, one for each method invocation.
                    StackFrame sf     = st.GetFrame(i);
                    string     method = sf.GetMethod().ToString();
                    if (method == "Void Push(System.DebugInformation.DebugNotification)")
                    {
                        pushfound = true;
                        continue;
                    }
                    if (method == "Void Critical(System.String, System.String, System.Object)")
                    {
                        continue;
                    }
                    if (method == "Void Critical(System.String, System.String)")
                    {
                        continue;
                    }
                    if (method == "Void Critical(System.String)")
                    {
                        continue;
                    }
                    if (method == "Void Error(System.String, System.String, System.Object)")
                    {
                        continue;
                    }
                    if (method == "Void Error(System.String, System.String)")
                    {
                        continue;
                    }
                    if (method == "Void Error(System.String)")
                    {
                        continue;
                    }
                    if (method == "Void ForceError(System.String, System.String, System.Object)")
                    {
                        continue;
                    }
                    if (method == "Void ForceError(System.String, System.String)")
                    {
                        continue;
                    }
                    if (method == "Void ForceError(System.String)")
                    {
                        continue;
                    }
                    if (method == "Void Suggestion(System.String, System.String, System.Object)")
                    {
                        continue;
                    }
                    if (method == "Void Suggestion(System.String, System.String)")
                    {
                        continue;
                    }
                    if (method == "Void Suggestion(System.String)")
                    {
                        continue;
                    }
                    if (method == "Void Warning(System.String, System.String, System.Object)")
                    {
                        continue;
                    }
                    if (method == "Void Warning(System.String, System.String)")
                    {
                        continue;
                    }
                    if (method == "Void Warning(System.String)")
                    {
                        continue;
                    }
                    if (pushfound == false)
                    {
                        continue;
                    }
                    Console.Error.WriteLine();
                    Console.Error.WriteLine(stackIndent + " Method: {0}", method);
                    Console.Error.WriteLine(stackIndent + " File: {0}", sf.GetFileName());
                    Console.Error.WriteLine(stackIndent + " Line Number: {0}", sf.GetFileLineNumber());
                    stackIndent += "  ";
                }
            }
//#endif
        }