static ElectiveReport CheckGraphicsAPI(SupportedConfiguration config)
        {
            var report = new ElectiveReport();

            if (config.SupportedGraphicsAPIs == null || config.SupportedGraphicsAPIs.Length == 0)
            {
                return(report);
            }

            if (config.SupportedGraphicsAPIs.Any(api => api == SystemInfo.graphicsDeviceType))
            {
                if (config.SupportedGraphicsAPIsIsOrdered &&
                    config.SupportedGraphicsAPIs[0] != SystemInfo.graphicsDeviceType)
                {
                    report.AddMessageFail(Messages.UnsupportedGraphicsSupportedVersionsAre +
                                          config.SupportedGraphicsAPIs.Stringify() +
                                          Messages.DetectedVersionIs + SystemInfo.graphicsDeviceType +
                                          Messages.EndQuoteNewLine + Messages.GraphicsApiIsUnsupportedOrder);
                }
                else
                {
                    report.AddMessagePass(Messages.GraphicsApiIsSupported +
                                          config.SupportedGraphicsAPIs.Stringify() + Messages.EndQuoteNewLine);
                }
            }
            else
            {
                report.AddMessageFail(Messages.UnsupportedGraphicsSupportedVersionsAre +
                                      config.SupportedGraphicsAPIs.Stringify() +
                                      Messages.DetectedVersionIs + SystemInfo.graphicsDeviceType +
                                      Messages.EndQuoteNewLine + Messages.GraphicsApiIsUnsupported);
            }

            return(report);
        }
        static ElectiveReport CheckDefineSymbols(SupportedConfiguration config)
        {
            var report = new ElectiveReport();

            if (config.DefineSymbols == null || config.DefineSymbols.Length == 0)
            {
                return(report);
            }

            var definesAreMissing = false;

            foreach (var define in config.DefineSymbols)
            {
                if (define.Required && !define.Present)
                {
                    definesAreMissing = true;
                }
            }

            if (!definesAreMissing)
            {
                report.AddMessagePass(Messages.DefineSymbolsFoundAll);
            }
            else
            {
                report.AddMessageFail(Messages.DefineSymbolsNotFoundHeader);
            }

            foreach (var define in config.DefineSymbols)
            {
                if (define.Present)
                {
                    report.AddMessagePass(Messages.DefineSymbolsFound + define.Name + Messages.EndQuoteNewLine);
                }
                else
                {
                    if (define.Required)
                    {
                        report.AddMessageFail(Messages.DefineSymbolsMissed + define.Name + Messages.EndQuoteNewLine);
                    }

                    else
                    {
                        report.AddMessagePass(Messages.DefineSymbolsMissedNotRequired + define.Name +
                                              Messages.EndQuoteNewLine);
                    }
                }
            }

            if (definesAreMissing)
            {
                var suggestedString = string.Join(";", config.DefineSymbols.Select(m => m.Name).ToArray());
                report.MessageFail += Messages.DefineSymbolsExampleHeader + suggestedString + Environment.NewLine;
            }

            return(report);
        }
        static ElectiveReport ComparePackagesForReport(MatchedPackagePair pair, ElectiveReport report)
        {
            var installedPackage = pair.installedPackage;
            var dependency       = pair.dependencyPackage;

            if (pair.foundNameMatch)
            {
                if (dependency.Required)
                {
                    if (CheckSinglePackageVersion(installedPackage.version,
                                                  new[] { dependency.Version }))
                    {
                        report.AddMessagePass(
                            Messages.PackageVersionIsSupported + dependency.Name +
                            " : " + dependency.Version + Messages.DetectedVersionIs +
                            installedPackage.name + " : " +
                            installedPackage.version + Messages.EndQuoteNewLine);
                    }
                    else
                    {
                        report.AddMessageFail(Messages.PackageVersionIsUnsupported +
                                              dependency.Name + " : " +
                                              dependency.Version + Messages.DetectedVersionIs +
                                              installedPackage.name + " : " +
                                              installedPackage.version +
                                              Messages.EndQuoteNewLine);
                    }
                }
                else
                {
                    report.AddMessagePass(Messages.PackageVersionIsOptional +
                                          dependency.Name + " : " +
                                          dependency.Version + Messages.DetectedVersionIs +
                                          installedPackage.name + " : " +
                                          installedPackage.version + Messages.EndQuoteNewLine);
                }
            }
            else
            {
                if (dependency.Required)
                {
                    report.AddMessageFail(Messages.PackageVersionIsMissing + dependency.Name +
                                          " : " + dependency.Version + Messages.EndQuoteNewLine);
                }
                else
                {
                    report.AddMessagePass(Messages.PackageVersionIsMissingAndOptional +
                                          dependency.Name + " : " +
                                          dependency.Version + Messages.EndQuoteNewLine);
                }
            }

            return(report);
        }
        static ElectiveReport CheckPackageVersions(SupportedConfiguration config)
        {
            var report = new ElectiveReport();

            if (config.Dependencies == null || config.Dependencies.Length == 0)
            {
                return(report);
            }

            var installedPackages = InstalledPackages.Infos;
            var pairs             = new List <MatchedPackagePair>();

            foreach (var dependency in config.Dependencies)
            {
                var pair = new MatchedPackagePair {
                    dependencyPackage = dependency
                };
                foreach (var installedPackage in installedPackages)
                {
                    if (dependency.Name == installedPackage.name)
                    {
                        pair.installedPackage = installedPackage;
                        pair.foundNameMatch   = true;
                        break;
                    }
                }
                pairs.Add(pair);
            }

            foreach (var pair in pairs)
            {
                report = ComparePackagesForReport(pair, report);
            }

            return(report);
        }