public override IQueryable <IPackage> GetPackages()
        {
            IEnumerable <IPackage> repositoryPackages = SourceRepository.GetPackages().ToList();
            IEnumerable <IPackage> packages           = from theme in _themeManifests
                                                        let id = PackagingUtils.BuildPackageId(theme.ThemeName, "Theme")
                                                                 let version = theme.Version != null ? new SemanticVersion(theme.Version) : null
                                                                               let package = repositoryPackages.FirstOrDefault(p => p.Id == id && (version == null || p.Version == version))
                                                                                             where package != null
                                                                                             select package;

            return(packages.AsQueryable());
        }
        public override IQueryable <IPackage> GetPackages()
        {
            IEnumerable <IPackage> repositoryPackages = SourceRepository.GetPackages().ToList();
            IEnumerable <IPackage> packages           = from plugin in _descriptors
                                                        let id = PackagingUtils.BuildPackageId(plugin.SystemName, "Plugin")
                                                                 let version = plugin.Version != null ? new SemanticVersion(plugin.Version) : null
                                                                               let package = repositoryPackages.FirstOrDefault(p => p.Id == id && (version == null || p.Version == version))
                                                                                             where package != null
                                                                                             select package;

            return(packages.AsQueryable());
        }
        private static void SetCoreProperties(BuildContext context, ExtensionDescriptor extensionDescriptor)
        {
            context.Builder.Id          = PackagingUtils.BuildPackageId(extensionDescriptor.Id, extensionDescriptor.ExtensionType);
            context.Builder.Version     = new SemanticVersion(extensionDescriptor.Version);
            context.Builder.Title       = extensionDescriptor.Name ?? extensionDescriptor.Id;
            context.Builder.Description = extensionDescriptor.Description.NullEmpty() ?? "No Description";
            context.Builder.Authors.Add(extensionDescriptor.Author ?? "Unknown");

            if (Uri.IsWellFormedUriString(extensionDescriptor.WebSite, UriKind.Absolute))
            {
                context.Builder.ProjectUrl = new Uri(extensionDescriptor.WebSite);
            }
        }
        public void Uninstall(string packageId, string applicationFolder)
        {
            string extensionFullPath = string.Empty;

            if (packageId.StartsWith(PackagingUtils.GetExtensionPrefix("Theme")))
            {
                extensionFullPath = _virtualPathProvider.MapPath("~/Themes/" + packageId.Substring(PackagingUtils.GetExtensionPrefix("Theme").Length));
            }
            else if (packageId.StartsWith(PackagingUtils.GetExtensionPrefix("Plugin")))
            {
                extensionFullPath = _virtualPathProvider.MapPath("~/Plugins/" + packageId.Substring(PackagingUtils.GetExtensionPrefix("Plugin").Length));
            }

            if (string.IsNullOrEmpty(extensionFullPath) || !System.IO.Directory.Exists(extensionFullPath))
            {
                throw new SmartException(T("Admin.Packaging.NotFound", packageId));
            }

            // If the package was not installed through nuget we still need to try to uninstall it by removing its directory
            if (Directory.Exists(extensionFullPath))
            {
                Directory.Delete(extensionFullPath, true);
            }
        }