PlatformHelper.IsWindows C# (CSharp) Method

IsWindows() public static method

public static IsWindows ( this platform ) : bool
platform this
return bool
    public static bool IsWindows(this RuntimePlatform platform)
    {
        return platform == RuntimePlatform.WindowsEditor ||
               platform == RuntimePlatform.WindowsPlayer ||
               platform == RuntimePlatform.WindowsWebPlayer;
    }

Usage Example

        public /* for test purposes */ static bool ExecuteProcessorRunner(AnalysisConfig config, ILogger logger, string exeFileName, IEnumerable <string> userCmdLineArguments, string propertiesFileName, IProcessRunner runner)
        {
            Debug.Assert(File.Exists(exeFileName), "The specified exe file does not exist: " + exeFileName);
            Debug.Assert(File.Exists(propertiesFileName), "The specified properties file does not exist: " + propertiesFileName);

            logger.LogInfo(Resources.MSG_TFSProcessorCalling);

            Debug.Assert(!string.IsNullOrWhiteSpace(config.SonarScannerWorkingDirectory), "The working dir should have been set in the analysis config");
            Debug.Assert(Directory.Exists(config.SonarScannerWorkingDirectory), "The working dir should exist");

            var converterArgs = new ProcessRunnerArguments(exeFileName, !PlatformHelper.IsWindows())
            {
                CmdLineArgs      = userCmdLineArguments,
                WorkingDirectory = config.SonarScannerWorkingDirectory,
            };

            var success = runner.Execute(converterArgs);

            if (success)
            {
                logger.LogInfo(Resources.MSG_TFSProcessorCompleted);
            }
            else
            {
                logger.LogError(Resources.ERR_TFSProcessorExecutionFailed);
            }
            return(success);
        }
All Usage Examples Of PlatformHelper::IsWindows
PlatformHelper