/// <summary> /// Installs a package given a version /// </summary> /// <param name="id">The id of the package</param> /// <param name="version">The version of the asset</param> /// <param name="package">The package that was installed</param> /// <returns>Final package state of installation</returns> public static PackageState Install(string id, Version version, out Package package) { package = null; checkInitialization(); // check if is already installed if (!LocalPackageManager.IsPackageInstalled(id, out Package localPackage, out string packageDirectory)) { Package remotePackage = RemotePackageManager.GetPackageInfo(id); if (remotePackage == null) { return(PackageState.NotExisting); } Asset asset = remotePackage.GetAssetVersion(version); if (asset == null) { return(PackageState.VersionNotFound); } package = remotePackage; return(InstallPackage(remotePackage, asset)); }
/// <summary> /// Installs a package given a version /// </summary> /// <param name="id">The id of the package</param> /// <param name="version">The version of the asset</param> /// <returns>State of the package</returns> public static PackageState InstallPackage(Package package, Asset asset) { checkInitialization(); string zipFile = RemotePackageManager.DownloadAsset(package.ID, asset); return(LocalPackageManager.InstallPackage(package, asset, zipFile)); }