public IEnumerable <ExtensionDescriptor> AvailableExtensions() { foreach (var e in Manifests) { string name = e.Key; yield return(ExtensionHarvester.GetDescriptorForExtension("~/", name, _extensionType, Manifests[name])); } }
public IEnumerable <ExtensionDescriptor> AvailableExtensions() { if (_extensionTypes.Contains(DefaultExtensionTypes.Module)) { foreach (var e in Manifests) { string name = e.Key; yield return(ExtensionHarvester.GetDescriptorForExtension("~/", name, DefaultExtensionTypes.Module, Manifests[name])); } } if (_extensionTypes.Contains(DefaultExtensionTypes.Theme)) { foreach (var e in ThemeManifests) { string name = e.Key; yield return(ExtensionHarvester.GetDescriptorForExtension("~/", name, DefaultExtensionTypes.Theme, ThemeManifests[name])); } } }
public static ExtensionDescriptor GetExtensionDescriptor(this IPackage package, string extensionType) { IPackageFile packageFile = package.GetFiles().FirstOrDefault(file => { var fileName = Path.GetFileName(file.Path); return(fileName != null && fileName.Equals( DefaultExtensionTypes.IsModule(extensionType) ? "module.txt" : "theme.txt", StringComparison.OrdinalIgnoreCase)); }); if (packageFile != null) { var directoryName = Path.GetDirectoryName(packageFile.Path); if (directoryName != null) { string extensionId = Path.GetFileName(directoryName.TrimEnd('/', '\\')); using (var streamReader = new StreamReader(packageFile.GetStream())) { return(ExtensionHarvester.GetDescriptorForExtension("", extensionId, extensionType, streamReader.ReadToEnd())); } } } return(null); }