System.Diagnostics.ProcessManager.ThrowIfRemoteMachine C# (CSharp) Method

ThrowIfRemoteMachine() static private method

static private ThrowIfRemoteMachine ( string machineName ) : void
machineName string
return void
        internal static void ThrowIfRemoteMachine(string machineName)
        {
            if (IsRemoteMachine(machineName))
            {
                throw new PlatformNotSupportedException(SR.RemoteMachinesNotSupported);
            }
        }
        public static IntPtr GetMainWindowHandle(int processId)

Usage Example

Example #1
0
        public static Process[] GetProcessesByName(string?processName, string machineName)
        {
            ProcessManager.ThrowIfRemoteMachine(machineName);

            int[] procIds   = ProcessManager.GetProcessIds();
            var   processes = new ArrayBuilder <Process>(string.IsNullOrEmpty(processName) ? procIds.Length : 0);

            // Iterate through all process IDs to load information about each process
            foreach (int pid in procIds)
            {
                ProcessInfo?processInfo = ProcessManager.CreateProcessInfo(pid, processName);
                if (processInfo != null)
                {
                    processes.Add(new Process(machineName, isRemoteMachine: false, pid, processInfo));
                }
            }

            return(processes.ToArray());
        }
All Usage Examples Of System.Diagnostics.ProcessManager::ThrowIfRemoteMachine