Exemple #1
0
        /// <summary>
        /// Init constructor of DebugViewData.
        /// </summary>
        public DebugViewData(uint pid, string message)
        {
            this.pid     = pid;
            this.message = message;
            creation     = DateTime.Now;

            ProcessData dbgProcess = ProcessDataCache.GetByID(pid);

            if (dbgProcess != null)
            {
                processName = dbgProcess.Name;
                processPath = dbgProcess.MainModuleFileName;
            }
        }
Exemple #2
0
        /// <summary>
        /// Process received message.
        /// </summary>
        static void SourceDataReceived(IDbgSource source, uint pid, string message)
        {
            lock (syncItems)
            {
                DateTime creation = DateTime.Now;
                string[] msgs;

                if (string.IsNullOrEmpty(message))
                {
                    msgs = new string[] { string.Empty };
                }
                else
                {
                    message = message.Replace("\t", TabReplace);
                    msgs    = message.Replace("\r\n", "\r").Replace("\n", "\r").Split('\r');
                }

                // check if this element has already the name:
                if (pid == 0 && (!string.IsNullOrEmpty(source.Name) || !string.IsNullOrEmpty(source.Module)))
                {
                    foreach (string m in msgs)
                    {
                        storedItems.Enqueue(new DebugViewData(0, source.Name, source.Module, creation, m.TrimEnd(null)));
                    }
                }
                else
                {
                    ProcessData dbgProcess = ProcessDataCache.GetByID(pid);
                    if (dbgProcess != null)
                    {
                        foreach (string m in msgs)
                        {
                            storedItems.Enqueue(new DebugViewData(pid, dbgProcess.Name,
                                                                  dbgProcess.MainModuleFileName, creation,
                                                                  m.TrimEnd(null)));
                        }
                    }
                }

                // avoid data flooding, by adding 1-sec delays
                // when sending to the receiver:
                if (!isRefreshing)
                {
                    isRefreshing = true;
                    refreshTimer.Change(1000, Timeout.Infinite);
                }
            }
        }