Ejemplo n.º 1
0
        public NugetLocalPackage FindLocalPackage(string packageName, PackageVersionRange versionRange = null, ConstraintProvider constraintProvider = null, bool allowPreleaseVersion = true, bool allowUnlisted = false)
        {
            if (packageName == null)
            {
                throw new ArgumentNullException(nameof(packageName));
            }

            return(store.FindLocalPackage(packageName, versionRange, constraintProvider, allowPreleaseVersion, allowUnlisted));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the filename to the specific package <paramref name="packageName"/> using the version <paramref name="versionRange"/> if not null, otherwise the <paramref name="constraintProvider"/> if specified.
        /// If no constraints are specified, the first entry if any are founds is used to get the filename.
        /// </summary>
        /// <param name="packageName">Name of the package.</param>
        /// <param name="versionRange">The version range.</param>
        /// <param name="constraintProvider">The package constraint provider.</param>
        /// <param name="allowPreleaseVersion">if set to <c>true</c> [allow prelease version].</param>
        /// <param name="allowUnlisted">if set to <c>true</c> [allow unlisted].</param>
        /// <returns>A location on the disk to the specified package or null if not found.</returns>
        /// <exception cref="System.ArgumentNullException">packageName</exception>
        public UFile GetPackageFileName(string packageName, PackageVersionRange versionRange = null, ConstraintProvider constraintProvider = null, bool allowPreleaseVersion = true, bool allowUnlisted = false)
        {
            if (packageName == null)
            {
                throw new ArgumentNullException(nameof(packageName));
            }

            var package = store.FindLocalPackage(packageName, versionRange, constraintProvider, allowPreleaseVersion, allowUnlisted);

            // If package was not found,
            if (package != null)
            {
                return(UPath.Combine(store.GetRealPath(package), new UFile(packageName + Package.PackageFileExtension)));
            }

            // TODO: Check version for default package
            if (packageName == DefaultPackageName)
            {
                if (versionRange == null || versionRange.Contains(DefaultPackageVersion))
                {
                    //return UPath.Combine(UPath.Combine(UPath.Combine(InstallationPath, (UDirectory)store.RepositoryPath), defaultPackageDirectory), new UFile(packageName + Package.PackageFileExtension));
                }
            }

            return(null);
        }
Ejemplo n.º 3
0
        private static async Task UninstallDependencies(NugetStore store, NugetPackage package)
        {
            foreach (var dependency in package.Dependencies)
            {
                string dependencyId       = dependency.Item1;
                string dependencyIdPrefix = dependencyId.Split('.').First();
                PackageVersionRange dependencyVersionRange = dependency.Item2;

                // Dependency must be from Stride/Xenko and package version must match exactly
                if (((dependencyIdPrefix == "Stride") || (dependencyIdPrefix == "Xenko")) && (dependencyVersionRange.Contains(package.Version)))
                {
                    NugetPackage dependencyPackage = store.FindLocalPackage(dependencyId, package.Version);
                    if (dependencyPackage != null)
                    {
                        await store.UninstallPackage(dependencyPackage, null);
                        await UninstallDependencies(store, dependencyPackage);
                    }
                }
            }
        }