Exemple #1
0
        private Process GetProcess(LogEventInfo logEventInfo)
        {
            var processId         = ProcessId?.Render(logEventInfo);
            var processName       = ProcessName?.Render(logEventInfo);
            var processTitle      = ProcessTitle?.Render(logEventInfo);
            var processExecutable = ProcessExecutable?.Render(logEventInfo);
            var processThreadId   = ProcessThreadId?.Render(logEventInfo);

            if (string.IsNullOrEmpty(processId) &&
                string.IsNullOrEmpty(processName) &&
                string.IsNullOrEmpty(processTitle) &&
                string.IsNullOrEmpty(processExecutable) &&
                string.IsNullOrEmpty(processThreadId))
            {
                return(null);
            }

            return(new Process
            {
                Title = processTitle,
                Name = processName,
                Pid = !string.IsNullOrEmpty(processId) ? long.Parse(processId) : 0,
                Executable = processExecutable,
                Thread = !string.IsNullOrEmpty(processThreadId) ? new ProcessThread {
                    Id = long.Parse(processThreadId)
                } : null
            });
        }