Пример #1
0
        /// <summary>
        /// Get all Feature Toggles for the provided platform.
        /// This should be called for the specific application.
        /// </summary>
        /// <param name="platform">PlatformEnum e.g. Web, Android, iOS, etc..</param>
        /// <returns>A collection of FeatureToggles for the platform.</returns>
        public List <FeatureToggle> GetAllFeatureTogglesForPlatform(PlatformEnum platform)
        {
            var jsonFiles = GetJsonFiles();

            var result = new List <FeatureToggle>();

            foreach (var jsonFile in jsonFiles)
            {
                var featureToggle = GetFeatureToggleFromJson(jsonFile);

                if (platform.Has <PlatformEnum>(featureToggle.Platform) ||
                    (featureToggle.SubFeatureToggles != null &&
                     featureToggle.SubFeatureToggles.Where(w => w.Platform != 0 && platform.Has <PlatformEnum>(w.Platform)).Count() > 0))
                {
                    result.Add(featureToggle);
                }
            }

            return(result);
        }
Пример #2
0
        /// <summary>
        /// Get all Feature Toggles for the provided platform.
        /// This should be called for the specific application.
        /// </summary>
        /// <param name="platform">PlatformEnum e.g. Web, Android, iOS, etc..</param>
        /// <returns>A collection of FeatureToggles for the platform.</returns>
        public List <FeatureToggle> GetAllFeatureTogglesForPlatformAndApplication(PlatformEnum platform, string application)
        {
            var jsonFiles = GetJsonFiles();

            var result = new List <FeatureToggle>();

            foreach (var jsonFile in jsonFiles)
            {
                var featureToggle = GetFeatureToggleFromJson(jsonFile);

                if ((application.ToUpper() == "ALL" || string.IsNullOrEmpty(featureToggle.Application) || featureToggle.Application.ToUpper() == "ALL" || featureToggle.Application.ToUpper() == application.ToUpper()) &&
                    (platform.Has <PlatformEnum>(featureToggle.Platform) ||
                     (featureToggle.SubFeatureToggles != null &&
                      featureToggle.SubFeatureToggles.Where(w => w.Platform != 0 && platform.Has <PlatformEnum>(w.Platform)).Count() > 0)))
                {
                    result.Add(featureToggle);
                }
            }

            return(result);
        }