using System; using System.Collections.Generic; using System.Linq; using System.IO; using System.IO.Compression; using System.Text; using System.Xml; using Newtonsoft.Json; namespace Packager { public abstract class BaseBlueprintPackager { protected string _blueprintRoot; protected IList _excludeBlueprints; /// /// Construct a new BaseBlueprintPackager. /// /// root to look for blueprint-manifest.json in /// names of blueprints to exclude from this BaseBlueprintPackager public BaseBlueprintPackager(string blueprintRoot, IList excludeBlueprints = null) { if (excludeBlueprints == null) { excludeBlueprints = new List(); } this._blueprintRoot = blueprintRoot; this._excludeBlueprints = excludeBlueprints; } protected IList SearchForblueprintManifests() { var temp = Directory.GetFiles(_blueprintRoot, "blueprint-manifest.json", SearchOption.AllDirectories); var result = new List(); foreach(string possible in temp) { var include = true; foreach (var excludeBlueprint in _excludeBlueprints) { if (Path.GetFileName(Path.GetDirectoryName(possible)) == excludeBlueprint) { include = false; break; } } if (include) { result.Add(possible); } } return result; } } }