/// <summary> /// Processes the record. /// </summary> /// <exception cref="System.IO.FileNotFoundException">Installer does not exist</exception> protected override void ProcessRecord() { if (!string.IsNullOrWhiteSpace(OfflineRabbitMqInstallerPath)) { if (PrepareForOfflineInstall) { WriteDebug($"Preparing offline installer path {OfflineRabbitMqInstallerPath}"); if (Force) WriteVerbose("Forcing download"); WriteVerbose("Downloading Erlang"); var downloader = new PrerequisiteDownloader(); var downloadUrl = UseThycoticMirror ? InstallationConstants.RabbitMq.ThycoticMirrorDownloadUrl : InstallationConstants.RabbitMq.DownloadUrl; downloader.Download(CancellationToken.None, new Uri(downloadUrl, UriKind.Absolute), OfflineRabbitMqInstallerPath, InstallationConstants.RabbitMq.InstallerChecksum, Force, 5, WriteDebug, WriteVerbose, (s, exception) => throw exception, progress => { WriteProgress(new ProgressRecord(1, "RabbitMq download in progress", "Downloading") { PercentComplete = progress.ProgressPercentage }); }); } else { WriteVerbose(string.Format("Using offline installer path {0}", OfflineRabbitMqInstallerPath)); if (!File.Exists(OfflineRabbitMqInstallerPath)) { throw new FileNotFoundException("Installer does not exist"); } if (PrerequisiteDownloader.CalculateMD5(OfflineRabbitMqInstallerPath) != InstallationConstants.RabbitMq.InstallerChecksum) { throw new FileNotFoundException("Installer checksum does not match"); } if (File.Exists(RabbitMqInstallerPath)) File.Delete(RabbitMqInstallerPath); File.Copy(OfflineRabbitMqInstallerPath, RabbitMqInstallerPath); } } else { if (Force) WriteVerbose("Forcing download"); WriteVerbose("Downloading RabbitMq"); var downloader = new PrerequisiteDownloader(); var downloadUrl = UseThycoticMirror ? InstallationConstants.RabbitMq.ThycoticMirrorDownloadUrl : InstallationConstants.RabbitMq.DownloadUrl; downloader.Download(CancellationToken.None, new Uri(downloadUrl, UriKind.Absolute), RabbitMqInstallerPath, InstallationConstants.RabbitMq.InstallerChecksum, Force, 5, WriteDebug, WriteVerbose, (s, exception) => throw exception, progress => { WriteProgress(new ProgressRecord(1, "RabbitMq download in progress", "Downloading") { PercentComplete = progress.ProgressPercentage }); }); } }
/// <summary> /// Processes the record. /// </summary> /// <exception cref="System.IO.FileNotFoundException">Installer does not exist</exception> protected override void ProcessRecord() { var activityId = ActivityIdProvider.GetNextActivityId(); if (!string.IsNullOrWhiteSpace(OfflineErlangInstallerPath)) { if (PrepareForOfflineInstall) { WriteDebug($"Preparing offline installer path {OfflineErlangInstallerPath}"); if (Force) { WriteVerbose("Forcing download"); } WriteVerbose("Downloading Erlang"); var downloader = new PrerequisiteDownloader(); var downloadUrl = UseThycoticMirror ? InstallationConstants.Erlang.ThycoticMirrorDownloadUrl : InstallationConstants.Erlang.DownloadUrl; downloader.Download(CancellationToken.None, new Uri(downloadUrl, UriKind.Absolute), OfflineErlangInstallerPath, InstallationConstants.Erlang.InstallerChecksum, Force, 5, WriteDebug, WriteVerbose, (s, exception) => throw exception, progress => { WriteProgress(new ProgressRecord(activityId, "Erlang download in progress", "Downloading") { PercentComplete = progress.ProgressPercentage, RecordType = progress.ProgressPercentage == 100 ? ProgressRecordType.Completed : ProgressRecordType.Processing }); }); } else { WriteDebug($"Using offline installer path {OfflineErlangInstallerPath}"); if (!File.Exists(OfflineErlangInstallerPath)) { throw new FileNotFoundException("Installer does not exist"); } if (PrerequisiteDownloader.CalculateSha512(OfflineErlangInstallerPath) != InstallationConstants.Erlang.InstallerChecksum) { throw new FileNotFoundException("Installer checksum does not match"); } if (File.Exists(ErlangInstallerPath)) { File.Delete(ErlangInstallerPath); } File.Copy(OfflineErlangInstallerPath, ErlangInstallerPath); } } else { if (Force) { WriteVerbose("Forcing download"); } WriteVerbose("Downloading Erlang"); var downloader = new PrerequisiteDownloader(); var downloadUrl = UseThycoticMirror ? InstallationConstants.Erlang.ThycoticMirrorDownloadUrl : InstallationConstants.Erlang.DownloadUrl; downloader.Download(CancellationToken.None, new Uri(downloadUrl, UriKind.Absolute), ErlangInstallerPath, InstallationConstants.Erlang.InstallerChecksum, Force, 5, WriteDebug, WriteVerbose, (s, exception) => throw exception, progress => { WriteProgress(new ProgressRecord(activityId, "Erlang download in progress", "Downloading") { PercentComplete = progress.ProgressPercentage, RecordType = progress.ProgressPercentage == 100 ? ProgressRecordType.Completed : ProgressRecordType.Processing }); }); } }