コード例 #1
0
        private static Process FindVsOrVsTestConsoleExe()
        {
            var    process    = Process.GetCurrentProcess();
            string executable = Path.GetFileName(process.MainModule.FileName).Trim().ToLower();

            while (executable != null && !ParentProcessRegex.IsMatch(executable))
            {
                process    = ParentProcessUtils.GetParentProcess(process.Id);
                executable = process != null
                    ? Path.GetFileName(process.MainModule.FileName).Trim().ToLower()
                    : null;
            }
            return(process);
        }
コード例 #2
0
        private static Process FindVsOrVsTestConsoleExe()
        {
            var    process    = Process.GetCurrentProcess();
            string executable = Path.GetFileName(process.MainModule.FileName).Trim().ToUpperInvariant();

            while (executable != null && executable != "DEVENV.EXE" && executable != "VSTEST.CONSOLE.EXE")
            {
                process    = ParentProcessUtils.GetParentProcess(process.Id);
                executable = process != null
                    ? Path.GetFileName(process.MainModule.FileName).Trim().ToUpperInvariant()
                    : null;
            }
            return(process);
        }
コード例 #3
0
        private static string GetParentProcessName()
        {
            var parentProcess = ParentProcessUtils.GetParentProcess(Process.GetCurrentProcess());

            return(parentProcess == null ? string.Empty : parentProcess.ProcessName);
        }