private IEnumerable<Package> getPackages(bool all) { var profiles = new ProfileLocator(_token); var packages = new List<Package>(); profiles.GetFilesCurrentProfiles("package.json").ToList() .ForEach(x => { try { Logger.Write("Reading package " + x); var package = Package.Read(x); if (package != null) packages.Add(package); } catch { } }); return packages; }
private Package getPackage(string name) { Logger.Write("Looking for package " + name); var profiles = new ProfileLocator(_token); var packages = new List<Package>(); profiles.GetFilesCurrentProfiles("package.json").ToList() .ForEach(x => { try { Logger.Write("Reading package " + x); var package = Package.Read(x); if (package != null) { Logger.Write("adding package {0} ({1})", package.ID, package.Version); packages.Add(package); } } catch (Exception ex) { Logger.Write(ex); } }); return packages.FirstOrDefault(x => x.ID == name); }