Exemplo n.º 1
0
        /// <summary>
        /// Tries to create and install package request from the <paramref name="moduleInfo" />.
        /// </summary>
        /// <param name="moduleInfo">The module info.</param>
        /// <param name="installPackageRequest">The install package request.</param>
        /// <returns><c>true</c> whether the install package request is created, otherwise <c>false</c></returns>
        public bool TryCreateInstallPackageRequest(ModuleInfo moduleInfo, out InstallPackageRequest installPackageRequest)
        {
            installPackageRequest = null;
            var packageName = moduleInfo.GetPackageName();

            ModuleAssemblyRef moduleAssemblyRef = moduleInfo.GetModuleAssemblyRef(OutputDirectoryAbsoluteUri);

            if (packageName.Version != null && moduleAssemblyRef.IsInstalled)
            {
                Log.Debug("Creating local install package request for '{0}'.", packageName.Name);

                installPackageRequest = new InstallPackageRequest(moduleAssemblyRef);
            }
            else
            {
                var repositories = GetPackageRepositories().ToList();

                int i = 0;
                while (installPackageRequest == null && i < repositories.Count)
                {
                    var repository = repositories[i++];
                    if (repository != null)
                    {
                        Log.Debug("Looking for package '{0}' with version '{1}' on the repository '{2}'", packageName.Id, packageName.Version, PackageSource);

                        try
                        {
                            var package = repository.FindPackage(packageName.Id, packageName.Version);
                            if (package != null)
                            {
                                /*
                                 * IEnumerable<FrameworkName> supportedFrameworks = package.GetSupportedFrameworks();
                                 * if (supportedFrameworks != null && supportedFrameworks.Any(name => FrameworkIdentifierConversionMap.ContainsKey(name.FullName) && FrameworkIdentifierConversionMap[name.FullName].Equals(Platforms.CurrentPlatform)))
                                 * {
                                 *  Log.Debug("Creating remote install package request for '{0}' from '{1}'", package.GetFullName(), PackageSource);
                                 * }
                                 */

                                installPackageRequest = new RemoteInstallPackageRequest(this, package, GetModuleAssemblyRef(moduleInfo, package.Version));
                            }
                        }
                        catch (Exception ex)
                        {
                            Log.Error(ex, "Failed to create install package request for package '{0}'", packageName.Id);
                        }
                    }
                }
            }

            return(installPackageRequest != null);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Tries to create and install package request from the <paramref name="moduleInfo"/>.
        /// </summary>
        /// <param name="moduleInfo">
        /// The module info.
        /// </param>
        /// <param name="installPackageRequest">
        /// The install package request.
        /// </param>
        /// <returns>
        /// <c>true</c> whether the install package request is created, otherwise <c>false</c>
        /// </returns>
        public bool TryCreateInstallPackageRequest(ModuleInfo moduleInfo, out InstallPackageRequest installPackageRequest)
        {
            installPackageRequest = null;
            PackageName packageName = moduleInfo.GetPackageName();

            if (packageName.Version != null && IsModuleAssemblyInstalled(moduleInfo))
            {
                Log.Debug("Creating local install package request for '{0}'.", packageName.Name);

                installPackageRequest = new InstallPackageRequest(GetModuleAssemblyRef(moduleInfo));
            }
            else
            {
                IPackageRepository repository = GetPackageRepository();
                if (repository != null)
                {
                    Log.Debug("Looking for package '{0}' with version '{1}' on the repository '{2}'", packageName.Id, packageName.Version, PackageSource);

                    IPackage package;
                    if (repository.TryFindPackage(packageName.Id, packageName.Version, out package))
                    {
                        /*
                         * IEnumerable<FrameworkName> supportedFrameworks = package.GetSupportedFrameworks();
                         * if (supportedFrameworks != null && supportedFrameworks.Any(name => FrameworkIdentifierConversionMap.ContainsKey(name.FullName) && FrameworkIdentifierConversionMap[name.FullName].Equals(_frameworkNameIdentifier)))
                         * {
                         *  Log.Debug("Creating remote install package request for '{0}' from '{1}'", package.GetFullName(), PackageSource);
                         * }
                         */

                        installPackageRequest = new RemoteInstallPackageRequest(this, package, GetModuleAssemblyRef(moduleInfo, package.Version));
                    }
                }
            }

            return(installPackageRequest != null);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Tries to create and install package request from the <paramref name="moduleInfo"/>.
        /// </summary>
        /// <param name="moduleInfo">
        /// The module info.
        /// </param>
        /// <param name="installPackageRequest">
        /// The install package request.
        /// </param>
        /// <returns>
        /// <c>true</c> whether the install package request is created, otherwise <c>false</c>
        /// </returns>
        public bool TryCreateInstallPackageRequest(ModuleInfo moduleInfo, out InstallPackageRequest installPackageRequest)
        {
            installPackageRequest = null;
            PackageName packageName = moduleInfo.GetPackageName();
            if (packageName.Version != null && IsModuleAssemblyInstalled(moduleInfo))
            {
                Log.Debug("Creating local install package request for '{0}'.", packageName.Name);

                installPackageRequest = new InstallPackageRequest(GetModuleAssemblyRef(moduleInfo));
            }
            else
            {
                IPackageRepository repository = GetPackageRepository();
                if (repository != null)
                {
                    Log.Debug("Looking for package '{0}' with version '{1}' on the repository '{2}'", packageName.Id, packageName.Version, PackageSource);

                    IPackage package;
                    if (repository.TryFindPackage(packageName.Id, packageName.Version, out package))
                    {
                        /*
                        IEnumerable<FrameworkName> supportedFrameworks = package.GetSupportedFrameworks();
                        if (supportedFrameworks != null && supportedFrameworks.Any(name => FrameworkIdentifierConversionMap.ContainsKey(name.FullName) && FrameworkIdentifierConversionMap[name.FullName].Equals(_frameworkNameIdentifier)))
                        {
                            Log.Debug("Creating remote install package request for '{0}' from '{1}'", package.GetFullName(), PackageSource);
                        }
                        */

                        installPackageRequest = new RemoteInstallPackageRequest(this, package, GetModuleAssemblyRef(moduleInfo, package.Version));
                    }
                }
            }

            return installPackageRequest != null;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Tries to create and install package request from the <paramref name="moduleInfo" />.
        /// </summary>
        /// <param name="moduleInfo">The module info.</param>
        /// <param name="installPackageRequest">The install package request.</param>
        /// <returns><c>true</c> whether the install package request is created, otherwise <c>false</c></returns>
        public bool TryCreateInstallPackageRequest(ModuleInfo moduleInfo, out InstallPackageRequest installPackageRequest)
        {
            installPackageRequest = null;
            var packageName = moduleInfo.GetPackageName();

            ModuleAssemblyRef moduleAssemblyRef = moduleInfo.GetModuleAssemblyRef(OutputDirectoryAbsoluteUri);
            if (packageName.Version != null && moduleAssemblyRef.IsInstalled)
            {
                Log.Debug("Creating local install package request for '{0}'.", packageName.Name);

                installPackageRequest = new InstallPackageRequest(moduleAssemblyRef);
            }
            else
            {
                var repositories = GetPackageRepositories().ToList();

                int i = 0;
                while (installPackageRequest == null && i < repositories.Count)
                {
                    var repository = repositories[i++];
                    if (repository != null)
                    {
                        Log.Debug("Looking for package '{0}' with version '{1}' on the repository '{2}'", packageName.Id, packageName.Version, PackageSource);

                        try
                        {
                            var package = repository.FindPackage(packageName.Id, packageName.Version);
                            if (package != null)
                            {
                                /*
                                IEnumerable<FrameworkName> supportedFrameworks = package.GetSupportedFrameworks();
                                if (supportedFrameworks != null && supportedFrameworks.Any(name => FrameworkIdentifierConversionMap.ContainsKey(name.FullName) && FrameworkIdentifierConversionMap[name.FullName].Equals(Platforms.CurrentPlatform)))
                                {
                                    Log.Debug("Creating remote install package request for '{0}' from '{1}'", package.GetFullName(), PackageSource);
                                }
                                */

                                installPackageRequest = new RemoteInstallPackageRequest(this, package, GetModuleAssemblyRef(moduleInfo, package.Version));
                            }
                        }
                        catch (Exception ex)
                        {
                            Log.Error(ex, "Failed to create install package request for package '{0}'", packageName.Id);
                        }
                    }
                }
            }

            return installPackageRequest != null;
        }