예제 #1
0
        /// <summary>
        /// Enumerates all the processes running on a port. (http://msdn.microsoft.com/en-us/library/bb161302.aspx)
        /// </summary>
        /// <param name="ppEnum"> Returns an IEnumDebugProcesses2 object that contains a list of all the processes running on a port. </param>
        /// <returns> VSConstants.S_OK. </returns>
        public int EnumProcesses(out IEnumDebugProcesses2 ppEnum)
        {
            if (this.m_IP == "")
            {
                processes = new IDebugProcess2[0];
            }
            else
            {
                DateTime now = DateTime.Now;

                TimeSpan diff    = now - lastTimeRefresh;
                double   seconds = diff.TotalSeconds;

                if (seconds > 1)
                {
                    IEnumerable <AD7Process> procList = GetProcesses();
                    processes = new IDebugProcess2[procList.Count()];
                    int i = 0;
                    foreach (var debugProcess in procList)
                    {
                        processes[i] = debugProcess;
                        i++;
                    }
                    lastTimeRefresh = DateTime.Now;
                }
            }
            ppEnum = new AD7ProcessEnum(processes);

            return(VSConstants.S_OK);
        }
예제 #2
0
        /// <summary>
        /// Enumerates all the processes running on a port. (http://msdn.microsoft.com/en-us/library/bb161302.aspx)
        /// </summary>
        /// <param name="ppEnum"> Returns an IEnumDebugProcesses2 object that contains a list of all the processes running on a port. </param>
        /// <returns> VSConstants.S_OK. </returns>
        public int EnumProcesses(out IEnumDebugProcesses2 ppEnum)
        {
            IEnumerable <AD7Process> procList = GetProcesses();

            IDebugProcess2[] processes = new IDebugProcess2[procList.Count()];
            int i = 0;

            foreach (var debugProcess in procList)
            {
                processes[i] = debugProcess;
                i++;
            }
            ppEnum = new AD7ProcessEnum(processes);
            return(VSConstants.S_OK);
        }