Ejemplo n.º 1
0
        protected void WritePackages(Dictionary <VsProject, IEnumerable <JObject> > dictionary, VersionType versionType)
        {
            // Get the PowerShellPackageView
            var view = PowerShellPackageWithProject.GetPowerShellPackageView(dictionary, versionType);

            if (view.IsEmpty())
            {
                if (UseRemoteSource)
                {
                    Log(MessageLevel.Info, Resources.Cmdlet_NoPackageUpdates);
                }
                else
                {
                    Log(MessageLevel.Info, Resources.Cmdlet_NoPackagesInstalled);
                }
            }
            WriteObject(view, enumerateCollection: true);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get the view of PowerShell Package. Use for Get-Package command.
        /// </summary>
        /// <param name="metadata"></param>
        /// <param name="versionType"></param>
        /// <returns></returns>
        public static List <PowerShellPackageWithProject> GetPowerShellPackageView(Dictionary <VsProject, IEnumerable <JObject> > dictionary, VersionType versionType)
        {
            List <PowerShellPackageWithProject> views = new List <PowerShellPackageWithProject>();

            foreach (KeyValuePair <VsProject, IEnumerable <JObject> > entry in dictionary)
            {
                List <PowerShellPackage> packages = PowerShellPackage.GetPowerShellPackageView(entry.Value, versionType);
                foreach (PowerShellPackage package in packages)
                {
                    PowerShellPackageWithProject view = new PowerShellPackageWithProject();
                    view.Id          = package.Id;
                    view.Version     = package.Version;
                    view.Description = package.Description;
                    view.ProjectName = entry.Key.Name;
                    views.Add(view);
                }
            }
            return(views);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Get the view of PowerShell Package. Use for Get-Package command. 
 /// </summary>
 /// <param name="metadata"></param>
 /// <param name="versionType"></param>
 /// <returns></returns>
 public static List<PowerShellPackageWithProject> GetPowerShellPackageView(Dictionary<VsProject, IEnumerable<JObject>> dictionary, VersionType versionType)
 {
     List<PowerShellPackageWithProject> views = new List<PowerShellPackageWithProject>();
     foreach (KeyValuePair<VsProject, IEnumerable<JObject>> entry in dictionary)
     {
         List<PowerShellPackage> packages = PowerShellPackage.GetPowerShellPackageView(entry.Value, versionType);
         foreach (PowerShellPackage package in packages)
         {
             PowerShellPackageWithProject view = new PowerShellPackageWithProject();
             view.Id = package.Id;
             view.Version = package.Version;
             view.Description = package.Description;
             view.ProjectName = entry.Key.Name;
             views.Add(view);
         }
     }
     return views;
 }