Exemplo n.º 1
0
        private StatusReportItem ReportResolutionSelected(InstallationLocation location, DCSOptions options)
        {
            string status = $"{location.DescribeOptionsPath} has 'Resolution' set to {options.Graphics.Width}x{options.Graphics.Height}";

            if ((long)Math.Round(_parent.Rendered.Width) == options.Graphics.Width &&
                (long)Math.Round(_parent.Rendered.Height) == options.Graphics.Height)
            {
                // exact match
                return(new StatusReportItem
                {
                    Status = status,
                    Flags = StatusReportItem.StatusFlags.ConfigurationUpToDate
                });
            }

            if (_parent.MonitorLayoutMode != MonitorLayoutMode.FromTopLeftCorner)
            {
                // inexact match is not permitted in any of these modes
                return(new StatusReportItem
                {
                    Status = status,
                    Recommendation =
                        $"Using DCS, please make sure the 'Resolution' in the 'System' options is set to {_parent.Rendered.Width}x{_parent.Rendered.Height}",
                    // not a warning, because the user may simply not have configured DCS yet.  once we do that automatically,
                    // this can be an out of date warning
                    Flags = StatusReportItem.StatusFlags.ConfigurationUpToDate
                });
            }

            if (_parent.Rendered.Width > options.Graphics.Width ||
                _parent.Rendered.Height > options.Graphics.Height)
            {
                return(new StatusReportItem
                {
                    Status = status,
                    Recommendation =
                        $"Using DCS, choose a 'Resolution' in the 'System' options that is at least {_parent.Rendered.Width} pixels wide and at least {_parent.Rendered.Height} pixels high",
                    // not a warning, because the user may simply not have configured DCS yet.  once we do that automatically,
                    // this can be an out of date warning
                    Flags = StatusReportItem.StatusFlags.ConfigurationUpToDate
                });
            }

            return(new StatusReportItem
            {
                Status = status,
                Flags = StatusReportItem.StatusFlags.ConfigurationUpToDate
            });
        }
Exemplo n.º 2
0
        private StatusReportItem ReportMonitorSetupSelected(InstallationLocation location, DCSOptions options, string monitorSetupName)
        {
            string status = $"{location.DescribeOptionsPath} has 'Monitors' set to '{options.Graphics.MultiMonitorSetup}'";

            if (options.Graphics.MultiMonitorSetup.Equals(monitorSetupName, StringComparison.InvariantCultureIgnoreCase))
            {
                // selection is correct for current profile
                return(new StatusReportItem
                {
                    Status = status,
                    Flags = StatusReportItem.StatusFlags.ConfigurationUpToDate
                });
            }

            return(new StatusReportItem
            {
                Status = status,
                Recommendation =
                    $"Using DCS, please make sure 'Monitors' in the 'System' options is set to '{monitorSetupName}'",
                // not a warning, because the user may simply not have configured DCS yet.  once we do that automatically,
                // this can be an out of date warning
                Flags = StatusReportItem.StatusFlags.ConfigurationUpToDate
            });
        }
Exemplo n.º 3
0
        public override IEnumerable <StatusReportItem> PerformReadyCheck()
        {
            // while we do not have the ability to measure the DPI setting for each screen, we just report the system dpi and an advisory message
            // we always include this advisory because it is affecting basically all our widescreen users right now
            int dpi = ConfigManager.DisplayManager.DPI;

            yield return(new StatusReportItem
            {
                Status = $"Windows reports a scaling value of {Math.Round(dpi / 0.96d)}% ({dpi} dpi)",
                Recommendation = "This version of Helios does not support using different display scaling (DPI) on different monitors.  Make sure you use the same scaling value for all displays.",
                Flags = StatusReportItem.StatusFlags.ConfigurationUpToDate | StatusReportItem.StatusFlags.Verbose
            });

            if (!_parent.CheckMonitorsValid)
            {
                yield return(new StatusReportItem
                {
                    Status = "Monitor configuration in profile does not match this computer",
                    Recommendation = "Perform 'Reset Monitors' function from the 'Profile' menu",
                    Link = StatusReportItem.ProfileEditor,
                    Severity = StatusReportItem.SeverityCode.Error
                });

                yield break;
            }

            if (string.IsNullOrWhiteSpace(_parent.Profile.Path))
            {
                yield return(new StatusReportItem
                {
                    Status =
                        "You must save the profile before you can use Monitor Setup, because it needs to know the profile name",
                    Recommendation = "Save the profile at least once before configuring Monitor Setup",
                    Link = StatusReportItem.ProfileEditor,
                    Severity = StatusReportItem.SeverityCode.Error
                });

                yield break;
            }

            // check if DCS install folders are configured
            InstallationLocations locations = InstallationLocations.Singleton;

            if (!locations.Active.Any())
            {
                yield return(new StatusReportItem
                {
                    Status = "No DCS installation locations are configured for monitor setup",
                    Recommendation = "Configure any DCS installation location you use",
                    Link = StatusReportItem.ProfileEditor,
                    Severity = StatusReportItem.SeverityCode.Error
                });
            }

            // gather viewport providers from this profile
            List <IViewportProvider> viewportProviders =
                _parent.Profile.Interfaces.OfType <IViewportProvider>().ToList();

            if (!_parent.UsingViewportProvider)
            {
                foreach (HeliosInterface viewportProvider in viewportProviders.OfType <HeliosInterface>())
                {
                    yield return(new StatusReportItem
                    {
                        Status = $"interface '{viewportProvider.Name}' is providing additional viewport patches but this profile uses a third-party solution for those",
                        Severity = StatusReportItem.SeverityCode.Warning,
                        Recommendation = $"Remove the '{viewportProvider.Name}' interface since this profile is configured to expect a third-party solution to provide viewport modifications"
                    });
                }
            }

            // check if any referenced viewports require patches to work
            foreach (IViewportExtent viewport in _parent.Viewports
                     .Select(shadow => shadow.Viewport)
                     .Where(v => v.RequiresPatches))
            {
                if (!_parent.UsingViewportProvider)
                {
                    yield return(new StatusReportItem
                    {
                        Status =
                            $"viewport '{viewport.ViewportName}' must be provided by third-party solution for additional viewports",
                        Recommendation =
                            "Verify that your third-party viewport modifications match the viewport names for this profile",
                        Flags = StatusReportItem.StatusFlags.Verbose |
                                StatusReportItem.StatusFlags.ConfigurationUpToDate
                    });

                    continue;
                }
                bool found = false;
                foreach (IViewportProvider provider in viewportProviders)
                {
                    if (provider.IsViewportAvailable(viewport.ViewportName))
                    {
                        yield return(new StatusReportItem
                        {
                            Status =
                                $"viewport '{viewport.ViewportName}' is provided by '{((HeliosInterface) provider).Name}'",
                            Flags = StatusReportItem.StatusFlags.Verbose |
                                    StatusReportItem.StatusFlags.ConfigurationUpToDate
                        });

                        found = true;
                        break;
                    }
                }

                if (!found)
                {
                    yield return(new StatusReportItem
                    {
                        Status = $"viewport '{viewport.ViewportName}' requires patches to be installed",
                        Recommendation =
                            "Add an Additional Viewports interface or configure the viewport extent not to require patches",
                        Link = StatusReportItem.ProfileEditor,
                        Severity = StatusReportItem.SeverityCode.Error,
                        Flags = StatusReportItem.StatusFlags.ConfigurationUpToDate
                    });
                }
            }

            bool updated = true;
            bool hasFile = false;

            // calculate shared monitor config
            // and see if it is up to date in all locations
            MonitorSetupTemplate combinedTemplate = CreateCombinedTemplate();
            string monitorSetupName = combinedTemplate.MonitorSetupName;

            foreach (StatusReportItem item in UpdateMonitorSetup(combinedTemplate, true))
            {
                yield return(item);
            }

            foreach (StatusReportItem item in EnumerateMonitorSetupFiles(CheckSetupFile, combinedTemplate))
            {
                if (!item.Flags.HasFlag(StatusReportItem.StatusFlags.ConfigurationUpToDate))
                {
                    updated = false;
                }

                hasFile = true;
                yield return(item);
            }

            // also calculate separate config, if applicable
            // and see if it is up to date in all locations
            if (!_parent.GenerateCombined)
            {
                MonitorSetupTemplate separateTemplate = CreateSeparateTemplate();
                monitorSetupName = separateTemplate.MonitorSetupName;
                foreach (StatusReportItem item in UpdateMonitorSetup(separateTemplate, false))
                {
                    yield return(item);
                }

                foreach (StatusReportItem item in EnumerateMonitorSetupFiles(CheckSetupFile, separateTemplate))
                {
                    if (!item.Flags.HasFlag(StatusReportItem.StatusFlags.ConfigurationUpToDate))
                    {
                        updated = false;
                    }

                    hasFile = true;
                    yield return(item);
                }
            }

            foreach (InstallationLocation location in locations.Active)
            {
                if (DCSOptions.TryReadOptions(location, out DCSOptions options))
                {
                    // check if correct monitor resolution selected in DCS
                    yield return(ReportResolutionSelected(location, options));

                    // don't tell the user to do this yet if the file isn't done
                    if (hasFile && updated)
                    {
                        // check if monitor setup selected in DCS
                        yield return(ReportMonitorSetupSelected(location, options, monitorSetupName));
                    }
                }
                else
                {
                    // report that the user has to check this themselves (we may not have access and that's ok)
                    string qualifier = _parent.MonitorLayoutMode == MonitorLayoutMode.FromTopLeftCorner ? "at least " : "";
                    yield return(new StatusReportItem
                    {
                        Status = $"Helios was unable to check the DCS settings stored in {location.DescribeOptionsPath}",
                        Recommendation =
                            $"Using DCS, please make sure the 'Resolution' in the 'System' options is set to {qualifier}{_parent.Rendered.Width}x{_parent.Rendered.Height}",
                        Severity = StatusReportItem.SeverityCode.Info,
                        Flags = StatusReportItem.StatusFlags.ConfigurationUpToDate
                    });

                    // don't tell the user to do this yet if the file isn't done
                    if (hasFile && updated)
                    {
                        yield return(new StatusReportItem
                        {
                            Status = $"Helios was unable to check the DCS monitor setup selection stored in {location.DescribeOptionsPath}",
                            Recommendation =
                                $"Using DCS, please make sure 'Monitors' in the 'System' options is set to '{monitorSetupName}'",
                            Severity = StatusReportItem.SeverityCode.Info,
                            Flags = StatusReportItem.StatusFlags.ConfigurationUpToDate
                        });
                    }
                }
            }

            if (_parent.GenerateCombined)
            {
                yield break;
            }

            yield return(new StatusReportItem
            {
                Status = "This profile requires a specific monitor setup file",
                Recommendation =
                    "You will need to switch 'Monitors' in DCS when you switch Helios Profile",
                Severity = StatusReportItem.SeverityCode.Info,
                Flags = StatusReportItem.StatusFlags.ConfigurationUpToDate
            });
        }