public ImageDownloadProgress(
            ImageSourcesConfig imageSource,
            QualityGroupConfig qualityGroup,
            ImageDirConfig dir,
            FileSignature[] imagesOnline)
        {
            ImageSource  = imageSource;
            QualityGroup = qualityGroup;
            Dir          = dir;

            TargetDirectory    = QualityGroup.TargetDirectory.ToAppRootedPath();
            TargetSubdirectory = TargetDirectory.AddPath(Dir.Subdirectory);

            MegaUrl   = string.IsNullOrEmpty(Dir.MegaId) ? null : ImageSource.MegaPrefix + Dir.MegaId;
            GdriveUrl = string.IsNullOrEmpty(Dir.GdriveId) ? null: ImageSource.GdrivePrefix + Dir.GdriveId;

            var existingSignatures = readExistingSignatures()
                                     ?.ToDictionary(_ => _.Path, Str.Comparer);

            if (imagesOnline == null)
            {
                FilesDownloaded = existingSignatures;
                return;
            }

            FilesOnline = imagesOnline
                          .Where(_ => _.IsRelativeTo(Dir.Subdirectory))
                          .Select(_ => _.AsRelativeTo(Dir.Subdirectory))
                          .ToDictionary(_ => _.Path, Str.Comparer);

            FilesDownloaded = new Dictionary <string, FileSignature>(Str.Comparer);
            FilesCorrupted  = new Dictionary <string, FileSignature>(Str.Comparer);

            foreach (var onlineImage in FilesOnline.Values)
            {
                var existingSignature = existingSignatures?.TryGet(onlineImage.Path);

                if (existingSignature == null)
                {
                    continue;
                }

                if (existingSignature.Md5Hash == onlineImage.Md5Hash)
                {
                    FilesDownloaded.Add(existingSignature.Path, existingSignature);
                }
                else
                {
                    FilesCorrupted.Add(existingSignature.Path, existingSignature);
                }
            }
        }