Пример #1
0
        public Process Add(Process aProcess)
        {
            lock (process) {
                var result = process.Where(x => x.id == aProcess.id).LastOrDefault();
                if (result != null) {
                    throw new Exception("Duplicate Process IDs in Trace file not permitted.");
                }

                process.Add(aProcess);
                return aProcess;
            }
        }
Пример #2
0
        public void SetParentProcessId(Process proc, int ppid)
        {
            if (proc.id == 0 || ppid == 0) {
                return;
            }
            lock (process) {
                var newParent = process.Traverse(c => c.process).Where(x => x.id == ppid).LastOrDefault();
                proc.ParentCollection.Remove(proc);
                proc.ParentCollection = newParent.process;

                newParent.process.Add(proc);
            }
        }
Пример #3
0
        public Process this[int pid]
        {
            get {
                lock (_processList) {
                    var result = _processList.Traverse(c => c.process).Where(x => x.id == pid).LastOrDefault();

                    if (result == null) {
                        result = new Process {id = pid, ParentCollection = _processList};

                        _processList.Add(result);
                    }
                    return result;
                }
            }
        }