示例#1
0
        public Model.PackageSet ToEmptyPackageSet()
        {
            var packageSet = new Model.PackageSet();

            packageSet.PackageId = new Model.PackageId(Name, VersionRange.MinVersion.ToNormalizedString());
            return(packageSet);
        }
        public DependencyResult Process()
        {
            var result = new DependencyResult();

            NuGet.ProjectModel.PackageSpec model = NuGet.ProjectModel.JsonPackageSpecReader.GetPackageSpec(ProjectName, ProjectJsonPath);
            IList <NuGet.LibraryModel.LibraryDependency> packages = model.Dependencies;

            foreach (NuGet.LibraryModel.LibraryDependency package in packages)
            {
                var set = new Model.PackageSet();
                set.PackageId = new Model.PackageId(package.Name, package.LibraryRange.VersionRange.OriginalString);
                result.Packages.Add(set);
                result.Dependencies.Add(set.PackageId);
            }
            return(result);
        }
        public PackageSet GetOrCreatePackageSet(PackageId package)
        {
            PackageSet set;

            if (packageSets.TryGetValue(package, out set))
            {
                return(set);
            }
            else
            {
                set                  = new PackageSet();
                set.PackageId        = package;
                set.Dependencies     = new HashSet <PackageId>();
                packageSets[package] = set;

                NuGet.Versioning.NuGetVersion version = null;
                NuGet.Versioning.NuGetVersion.TryParse(package.Version, out version);
                versions[package] = new VersionPair()
                {
                    rawVersion = package.Version, version = version
                };
                return(set);
            }
        }