public PhpInstallation(PhpVersion version) { this.Version = version; string executablePath = "./php/" + version.VersionNumber + "/php-cgi.exe"; executablePath = Path.GetFullPath(executablePath); if (File.Exists(executablePath)) { this.PhpExecutablePath = executablePath; } else { throw new ArgumentException("The PHP executable file was not found.", nameof(executablePath)); } }
/// <summary> /// Downloads a PHP version asynchronously /// </summary> /// <param name="version"></param> public static async Task DownloadVersionAsync(Version version) { var query = _VersionCache.Where(o => o.VersionNumber == version); if (!query.Any()) { throw new ArgumentException("The specified PHP version was not found", nameof(version)); } PhpVersion ver = query.Single(); if (File.Exists("php.zip")) { File.Delete("php.zip"); } var downloader = new DownloadHelper(ver.DownloadURL, "php.zip"); downloader.DownloadProgressChanged += (a, b) => DownloadProgressChanged(a, b); await downloader.DownloadAsync(); await ExtractPackage(ver.VersionNumber); }