internal ApplicationSettings()

in sources/Google.Solutions.IapDesktop.Application/Profile/Settings/ApplicationSettingsRepository.cs [161:287]


            internal ApplicationSettings(
                ISettingsStore store,
                UserProfile.SchemaVersion schemaVersion)
            {
                //
                // Settings that can be overridden by policy.
                //
                // NB. Default values must be kept consistent with the
                //     ADMX policy templates!
                //
                this.IsPreviewFeatureSetEnabled = store.Read<bool>(
                    "IsPreviewFeatureSetEnabled",
                    "IsPreviewFeatureSetEnabled",
                    null,
                    null,
                    false);
                this.IsUpdateCheckEnabled = store.Read<bool>(
                    "IsUpdateCheckEnabled",
                    "IsUpdateCheckEnabled",
                    null,
                    null,
                    true);
                this.IsTelemetryEnabled = store.Read<bool>(
                    "IsTelemetryEnabled",
                    "IsTelemetryEnabled",
                    null,
                    null,
                    schemaVersion >= UserProfile.SchemaVersion.Version240); // Auto opt-in new profiles
                this.ProxyUrl = store.Read<string?>(
                    "ProxyUrl",
                    "ProxyUrl",
                    null,
                    null,
                    null,
                    url => url == null || Uri.TryCreate(url, UriKind.Absolute, out var _));
                this.ProxyPacUrl = store.Read<string?>(
                    "ProxyPacUrl",
                    "ProxyPacUrl",
                    null,
                    null,
                    null,
                    url => url == null || Uri.TryCreate(url, UriKind.Absolute, out var _));
                this.ProxyAuthenticationRetries = store.Read<int>(
                    "ProxyAuthenticationRetries",
                    "ProxyAuthenticationRetries",
                    null,
                    null,
                    2,              // A single retry might not be sufficient (b/323465182).
                    Predicate.InRange(0, 8));
                this.TlsVersions = store.Read<SecurityProtocolType>(
                    "TlsVersions",
                    "TlsVersions",
                    null,
                    null,
                    OSCapabilities.SupportedTlsVersions);

                //
                // User preferences. These cannot be overridden by policy.
                //
                this.IsMainWindowMaximized = store.Read<bool>(
                    "IsMainWindowMaximized",
                    "IsMainWindowMaximized",
                    null,
                    null,
                    false);
                this.MainWindowHeight = store.Read<int>(
                    "MainWindowHeight",
                    "MainWindowHeight",
                    null,
                    null,
                    0,
                    Predicate.InRange(0, ushort.MaxValue));
                this.MainWindowWidth = store.Read<int>(
                    "WindowWidth",
                    "WindowWidth",
                    null,
                    null,
                    0,
                    Predicate.InRange(0, ushort.MaxValue));
                this.LastUpdateCheck = store.Read<long>(
                    "LastUpdateCheck",
                    "LastUpdateCheck",
                    null,
                    null,
                    0,
                    Predicate.InRange(0, long.MaxValue));
                this.ProxyUsername = store.Read<string?>(
                    "ProxyUsername",
                    "ProxyUsername",
                    null,
                    null,
                    null,
                    _ => true);
                this.ProxyPassword = store.Read<SecureString?>(
                    "ProxyPassword",
                    "ProxyPassword",
                    null,
                    null,
                    null);
                this.FullScreenDevices = store.Read<string?>(
                    "FullScreenDevices",
                    "FullScreenDevices",
                    null,
                    null,
                    null,
                    _ => true);
                this.CollapsedProjects = store.Read<string?>(
                    "CollapsedProjects",
                    "CollapsedProjects",
                    null,
                    null,
                    null,
                    _ => true);
                this.IsSurveyEnabled = store.Read<bool>(
                    "IsSurveyEnabled",
                    "IsSurveyEnabled",
                    null,
                    null,
                    true);
                this.LastSurveyVersion = store.Read<string?>(
                    "LastSurveyVersion",
                    "LastSurveyVersion",
                    null,
                    null,
                    null,
                    _ => true);
            }