public static ImageMatch AddGuidToMatchIfMissing(ImageMatch original) => new ImageMatch( original.Filename1, original.Filename2, original.Difference, original.Decision, original.Guid ?? System.Guid.NewGuid().ToString() );
public ImageTranscodingTarget GetMatchingImageTranscoding(MetadataContainer info, int edition, out ImageMatch matchedSource) { matchedSource = null; if (info == null) { throw new ArgumentException("Parameter cannot be empty", nameof(info)); } if (!info.HasEdition(edition)) { throw new ArgumentException("Parameter is invalid", nameof(edition)); } foreach (ImageTranscodingTarget tDef in ImageTargets) { foreach (ImageInfo src in tDef.Sources) { if (src.Matches(info, edition)) { matchedSource = new ImageMatch(); matchedSource.MatchedImageSource = src; return(tDef); } } } if (info.Image[edition].Height > ImageSettings.MaxHeight || info.Image[edition].Width > ImageSettings.MaxWidth || (info.Image[edition].Orientation > 1 && ImageSettings.AutoRotate == true)) { matchedSource = new ImageMatch(); matchedSource.MatchedImageSource = new ImageInfo(); ImageTranscodingTarget tDef = new ImageTranscodingTarget(); tDef.Target = new ImageInfo(); tDef.Target.ImageContainerType = info.Metadata[edition].ImageContainerType; tDef.Target.PixelFormatType = info.Image[edition].PixelFormatType; tDef.Target.QualityType = ImageSettings.Quality; return(tDef); } return(null); }