Exemplo n.º 1
0
        public static string GetFilePath(
            this DotNetProcess process)
        {
            if (process == null)
            {
                throw new ArgumentNullException(nameof(process));
            }

            var result = process.GetProcessMainModule().FileName;

            return(result);
        }
Exemplo n.º 2
0
        public static string GetName(
            this DotNetProcess process)
        {
            if (process == null)
            {
                throw new ArgumentNullException(nameof(process));
            }

            var result = process.ProcessName;

            return(result);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 5
0
        public static DotNetProcess GetRunningProcess()
        {
            var result = DotNetProcess.GetCurrentProcess();

            return(result);
        }