Esempio n. 1
0
        public IEnumerable <Recipe> HarvestRecipes(string extensionId)
        {
            var recipes = new List <Recipe>();

            var extension = _extensionManager.GetExtension(extensionId);

            if (extension != null)
            {
                var recipeLocation = Path.Combine(extension.Location, extensionId, "Recipes");
                var recipeFiles    = _webSiteFolder.ListFiles(recipeLocation, true);

                recipeFiles.Where(r => r.EndsWith(".recipe.xml", StringComparison.OrdinalIgnoreCase)).ToList().ForEach(r => {
                    try {
                        recipes.Add(_recipeParser.ParseRecipe(_webSiteFolder.ReadFile(r)));
                    }
                    catch (Exception ex) {
                        Logger.Error(ex, "Error while parsing recipe file '{0}'.", r);
                    }
                });
            }
            else
            {
                Logger.Error("Could not discover recipes because module '{0}' was not found.", extensionId);
            }

            return(recipes);
        }
Esempio n. 2
0
        private IEnumerable <Recipe> HarvestRecipes(ExtensionDescriptor extension)
        {
            var recipes = new List <Recipe>();

            var recipeLocation = Path.Combine(extension.Location, extension.Id, "Recipes");
            var recipeFiles    = _webSiteFolder.ListFiles(recipeLocation, true);

            recipeFiles.Where(r => r.EndsWith(".recipe.xml", StringComparison.OrdinalIgnoreCase)).ToList().ForEach(r => {
                try {
                    recipes.Add(_recipeParser.ParseRecipe(_webSiteFolder.ReadFile(r)));
                }
                catch (Exception ex) {
                    Logger.Error(ex, "Error while parsing recipe file '{0}'.", r);
                }
            });

            return(recipes);
        }
        public IEnumerable <Recipe> HarvestRecipes(string extensionId)
        {
            var recipes   = new List <Recipe>();
            var extension = _extensionManager.GetExtension(extensionId);

            if (extension != null)
            {
                var recipeLocation = Path.Combine(extension.Location, extensionId, "Recipes");
                var recipeFiles    = _webSiteFolder.ListFiles(recipeLocation, true);
                recipes.AddRange(
                    from recipeFile in recipeFiles
                    where recipeFile.EndsWith(".recipe.xml", StringComparison.OrdinalIgnoreCase)
                    select _recipeParser.ParseRecipe(_webSiteFolder.ReadFile(recipeFile)));
            }
            else
            {
                Logger.Error("Could not discover recipes because module '{0}' was not found.", extensionId);
            }

            return(recipes);
        }