private static string GetReadmeFilePath(NewPackageAction action) { // Get the package manager and project manager from the target var packageManager = action.Target.TryGetFeature <IPackageManager>(); if (packageManager == null) { return(null); } // Get the package from the shared repository var package = packageManager.LocalRepository.FindPackage( action.PackageIdentity.Id, CoreConverters.SafeToSemanticVersion(action.PackageIdentity.Version)); if (package != null && package.GetFiles().Any(f => f.Path.Equals(ReadmeFileName, StringComparison.OrdinalIgnoreCase))) { var packageInstalledPath = packageManager.PathResolver.GetInstallPath(package); return(System.IO.Path.Combine( packageInstalledPath, ReadmeFileName)); } return(null); }
private void UpdateReadmeFilePath(NewPackageAction action) { if (_userAction == null || _userAction.Action != PackageActionType.Install) { // display readme file only when installing packages return; } // look for readme file if (action.PackageIdentity.Equals(_userAction.PackageIdentity) && action.ActionType == PackageActionType.Install) { _readmeFilePath = GetReadmeFilePath(action); } }
private static string GetReadmeFilePath(NewPackageAction action) { // Get the package manager and project manager from the target var packageManager = action.Target.TryGetFeature<IPackageManager>(); if (packageManager == null) { return null; } // Get the package from the shared repository var package = packageManager.LocalRepository.FindPackage( action.PackageIdentity.Id, CoreConverters.SafeToSemanticVersion(action.PackageIdentity.Version)); if (package != null && package.GetFiles().Any(f => f.Path.Equals(ReadmeFileName, StringComparison.OrdinalIgnoreCase))) { var packageInstalledPath = packageManager.PathResolver.GetInstallPath(package); return System.IO.Path.Combine( packageInstalledPath, ReadmeFileName); } return null; }