ZeroInstall.Publish.ImplementationUtils.AddMissing C# (CSharp) Method

AddMissing() public static method

Adds missing data (by downloading and infering) to an Implementation.
The user canceled the task. A file could not be downloaded from the internet. There is a problem access a temporary file. Read or write access to a temporary file is not permitted. An existing digest does not match the newly calculated one.
public static AddMissing ( [ implementation, [ handler, [ executor = null, [ keepDownloads = null ) : void
implementation [ The to add data to.
handler [ A callback object used when the the user is to be informed about progress.
executor [ Used to apply properties in an undoable fashion.
keepDownloads [ Used to retain downloaded implementations; can be null.
return void
        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;
        }