Beispiel #1
0
        private void RedrawMessage()
        {
            if (InvokeRequired)
            {
                Invoke((MethodInvoker)RedrawMessage);
                return;
            }

            TBox_Message.Clear();

            lock (draw_msg_sync_) {
                /* 表示待ちのログと表示済みメッセージリストを結合させる */
                while (draw_msg_queue_.Count > 0)
                {
                    msg_list_all_.Add(draw_msg_queue_.Dequeue());
                }

                /* 表示待ちメッセージキューを初期化 */
                draw_msg_queue_ = new Queue <DebugMessageInfo>();
                draw_msg_last_  = null;

                /* 全メッセージを表示待ちにする */
                msg_list_all_.ForEach(minfo => draw_msg_queue_.Enqueue(minfo));

                /* 表示済みメッセージリストを初期化 */
                msg_list_all_ = new List <DebugMessageInfo>();
            }
        }
Beispiel #2
0
        private string BuildMessage(DebugMessageInfo minfo, DebugMessageInfo minfo_prev, DrawItemAttr draw_item_attr = (DrawItemAttr)(-1))
        {
            var str = new StringBuilder();

            if (minfo_prev == null)
            {
                minfo_prev = minfo;
            }

            /* DateTime - Local */
            if (draw_item_attr.HasFlag(DrawItemAttr.DateTime))
            {
                str.AppendFormat("{0} ", minfo.DateTime.ToLocalTime().ToString("yyyy-MM-dd hh:mm:ss.ffffff"));
            }

            /* DeltaTime */
            if (draw_item_attr.HasFlag(DrawItemAttr.DeltaTime))
            {
                str.AppendFormat("{{{0,10}}} ", (minfo.TickTime - minfo_prev.TickTime));
            }

            /* Thread ID */
            if (draw_item_attr.HasFlag(DrawItemAttr.ThreadID))
            {
                str.AppendFormat("[{0}] ", minfo.ThreadID);
                str.Append(" ");
            }

            /* Message */
            str.Append(minfo.Message);

            return(str.ToString());
        }
Beispiel #3
0
        private void ClearMessage()
        {
            if (InvokeRequired)
            {
                Invoke((MethodInvoker)ClearMessage);
                return;
            }

            TBox_Message.Clear();

            lock (draw_msg_sync_) {
                msg_list_all_   = new List <DebugMessageInfo>();
                draw_msg_queue_ = new Queue <DebugMessageInfo>();
                draw_msg_last_  = null;
            }
        }
Beispiel #4
0
        private void OnDrawTimer(object sender, EventArgs e)
        {
            DebugMessageInfo msg;

            draw_time_.Restart();

            while ((draw_msg_enable_) && ((msg = PopMessage()) != null))
            {
                msg_list_all_.Add(msg);

                if (((draw_msg_sender_ & msg.Sender) != 0) && ((draw_msg_type_ & msg.Type) != 0))
                {
                    TBox_Message.AppendText(BuildMessage(msg, draw_msg_last_, draw_item_attr_) + Environment.NewLine);
                    draw_msg_last_ = msg;
                }

                if (draw_time_.ElapsedMilliseconds >= (DRAW_INTERVAL / 2))
                {
                    break;
                }
            }
        }
Beispiel #5
0
 public void MessageOut(DebugMessageInfo mi)
 {
     lock (draw_msg_sync_) {
         draw_msg_queue_.Enqueue(mi);
     }
 }