protected virtual FeaturesManager CreateFeaturesManager()
        {
            IList <string> flightsFromQueryString = this.GetFlightsFromQueryString(this.currentFlightsOverride);
            VariantConfigurationSnapshot configurationSnapshot = string.IsNullOrWhiteSpace(this.rampId) ? VariantConfiguration.GetSnapshot(this.recipient.GetContext(null), null, flightsFromQueryString) : VariantConfiguration.GetSnapshot(this.recipient.GetContext(this.rampId, this.isFirstRelease), null, flightsFromQueryString);

            return(FeaturesManager.Create(configurationSnapshot, this.configurationContext, this.featureStateOverrideFactory));
        }
Beispiel #2
0
        // Token: 0x060026B4 RID: 9908 RVA: 0x0008C318 File Offset: 0x0008A518
        public static FeaturesManager Create(VariantConfigurationSnapshot configurationSnapshot, IConfigurationContext context, Func <VariantConfigurationSnapshot, IFeaturesStateOverride> featuresStateOverrideFactory)
        {
            IFeaturesStateOverride featureStateOverride = featuresStateOverrideFactory(configurationSnapshot);
            Func <IFeature, bool>  isEnabled            = (IFeature f) => (featureStateOverride == null || featureStateOverride.IsFeatureEnabled(f.Name)) && f.Enabled;
            HashSet <string>       hashSet = new HashSet <string>();

            foreach (object obj in Enum.GetValues(typeof(Feature)))
            {
                if (context.IsFeatureEnabled((Feature)obj))
                {
                    hashSet.Add(obj.ToString());
                }
            }
            foreach (KeyValuePair <string, IFeature> keyValuePair in configurationSnapshot.OwaClient.GetObjectsOfType <IFeature>())
            {
                if (isEnabled(keyValuePair.Value))
                {
                    hashSet.Add(keyValuePair.Value.Name);
                }
            }
            foreach (KeyValuePair <string, IFeature> keyValuePair2 in configurationSnapshot.OwaClientServer.GetObjectsOfType <IFeature>())
            {
                if (isEnabled(keyValuePair2.Value))
                {
                    hashSet.Add(keyValuePair2.Value.Name);
                }
            }
            FeaturesManager result;

            try
            {
                IDictionary <string, IFeature> objectsOfType = configurationSnapshot.OwaClient.GetObjectsOfType <IFeature>();
                HashSet <string> enabledClientOnlyFeature    = new HashSet <string>(from f in objectsOfType.Values
                                                                                    where isEnabled(f)
                                                                                    select f.Name);
                IDictionary <string, IFeature> objectsOfType2 = configurationSnapshot.OwaServer.GetObjectsOfType <IFeature>();
                HashSet <string> enabledServerOnlyFeature     = new HashSet <string>(from f in objectsOfType2.Values
                                                                                     where isEnabled(f)
                                                                                     select f.Name);
                IDictionary <string, IFeature> objectsOfType3   = configurationSnapshot.OwaClientServer.GetObjectsOfType <IFeature>();
                HashSet <string> enabledClientServerOnlyFeature = new HashSet <string>(from f in objectsOfType3.Values
                                                                                       where isEnabled(f)
                                                                                       select f.Name);
                result = new FeaturesManager(configurationSnapshot, hashSet, enabledClientOnlyFeature, enabledServerOnlyFeature, enabledClientServerOnlyFeature);
            }
            catch (KeyNotFoundException ex)
            {
                string message = string.Format("VariantConfigurationSnapshot could not find OWA component settings. Exception {0} {1}.", ex.GetType(), ex.Message);
                ExTraceGlobals.CoreTracer.TraceError(0L, message);
                throw new FlightConfigurationException(message);
            }
            return(result);
        }
        protected override string[] GetEnabledFeatures()
        {
            FeaturesManager featuresManager = UserContextManager.GetUserContext(base.Context).FeaturesManager;

            return(featuresManager.GetClientEnabledFeatures());
        }