Beispiel #1
0
        public static string GetFilePath(
            this DotNetProcess process)
        {
            if (process == null)
            {
                throw new ArgumentNullException(nameof(process));
            }

            var result = process.GetProcessMainModule().FileName;

            return(result);
        }
Beispiel #2
0
        public static string GetName(
            this DotNetProcess process)
        {
            if (process == null)
            {
                throw new ArgumentNullException(nameof(process));
            }

            var result = process.ProcessName;

            return(result);
        }
Beispiel #3
0
        public static string GetProductVersion(
            this DotNetProcess process)
        {
            if (process == null)
            {
                throw new ArgumentNullException(nameof(process));
            }

            var result = process.GetProcessMainModule().FileVersionInfo.ProductVersion;

            return(result);
        }
Beispiel #4
0
        private static ProcessModule GetProcessMainModule(
            this DotNetProcess process)
        {
            if (process == null)
            {
                throw new ArgumentNullException(nameof(process));
            }

            var result = process.MainModule;

            if (result == null)
            {
                throw new ArgumentNullException(Invariant($"{nameof(process)}.{nameof(result)}"));
            }

            return(result);
        }
Beispiel #5
0
        public static DotNetProcess GetRunningProcess()
        {
            var result = DotNetProcess.GetCurrentProcess();

            return(result);
        }