public static void AddMissing([NotNull] this Implementation implementation, [NotNull] ITaskHandler handler, [CanBeNull] ICommandExecutor executor = null, [CanBeNull] IStore keepDownloads = null)
{
#region Sanity checks
if (implementation == null) throw new ArgumentNullException(nameof(implementation));
if (handler == null) throw new ArgumentNullException(nameof(handler));
#endregion
if (executor == null) executor = new SimpleCommandExecutor();
ConvertSha256ToSha256New(implementation, executor);
GenerateMissingArchive(implementation, handler, executor);
foreach (var retrievalMethod in implementation.RetrievalMethods)
{
if (implementation.IsManifestDigestMissing() || retrievalMethod.IsDownloadSizeMissing())
{
using (var tempDir = retrievalMethod.DownloadAndApply(handler, executor))
implementation.UpdateDigest(tempDir, handler, executor, keepDownloads);
}
}
if (string.IsNullOrEmpty(implementation.ID)) implementation.ID = @"sha1new=" + implementation.ManifestDigest.Sha1New;
}