GetPlatform() public static method

The platform we're currently executing on.
public static GetPlatform ( ) : System.Platform
return System.Platform
コード例 #1
0
        protected virtual List <int> GetChildren(int pid)
        {
            if (string.IsNullOrEmpty(Configuration.ChildProcessAlgorithm))
            {
                switch (Configuration.GetPlatform())
                {
                case Platform.Mac:
                    return(GetChildrenImplPS(pid));

                case Platform.Linux:
                default:
                    return(GetChildrenImplPgrep(pid));
                }
            }
            else
            {
                switch (Configuration.ChildProcessAlgorithm.ToLowerInvariant())
                {
                case "pgrep":
                    return(GetChildrenImplPgrep(pid));

                case "ps":
                default:
                    return(GetChildrenImplPS(pid));
                }
            }
        }
コード例 #2
0
        private static IProcessHelper GetHelper()
        {
            if (helper == null)
            {
                switch (Configuration.GetPlatform())
                {
                case Platform.Windows:
                    helper = new ProcessHelperWindows();
                    break;

                case Platform.Mac:
                    helper = new ProcessHelperMac();
                    break;

                case Platform.Linux:
                default:
                    if (Configuration.IsCygwin)
                    {
                        helper = new ProcessHelperWindows();
                    }
                    else
                    {
                        helper = new ProcessHelperLinux();
                    }
                    break;
                }
            }
            return(helper);
        }
コード例 #3
0
        public static Job CreateJob()
        {
            if (Configuration.GetPlatform() == Platform.Windows || Configuration.IsCygwin)
            {
                return(new JobWindows());
            }

            return(new Job());
        }