Exemplo n.º 1
0
        /// <summary>
        /// Installs the specified resource at the given location.
        /// </summary>
        /// <param name="package">The package reference.</param>
        /// <param name="type">The package type.</param>
        /// <param name="path">The location where to install the package.</param>
        /// <returns>The installed files.</returns>
        public IReadOnlyCollection <IFile> Install(PackageReference package, PackageType type, DirectoryPath path)
        {
            if (package == null)
            {
                throw new ArgumentNullException(nameof(package));
            }

            if (path == null)
            {
                throw new ArgumentNullException(nameof(path));
            }

            var packagePath = GetPackagePath(path, package);
            var result      = ContentResolver.GetFiles(packagePath, package, type);

            if (result.Count != 0)
            {
                return(result);
            }

            if (type == PackageType.Addin)
            {
                var framework = Environment.Runtime.BuiltFramework;
                Log.Warning($"Could not find any assemblies compatible with {framework.FullName}. Perhaps you need an include parameter?");
            }
            else if (type == PackageType.Tool)
            {
                Log.Warning($"Could not find any relevant files for tool '{package.Package}'. Perhaps you need an include parameter?");
            }

            return(result);
        }