public bool MergeImages(IHasImages item, List <LocalImageInfo> images) { var changed = false; foreach (var type in _singularImages) { var image = images.FirstOrDefault(i => i.Type == type); if (image != null) { var currentImage = item.GetImageInfo(type, 0); if (currentImage == null || !string.Equals(currentImage.Path, image.FileInfo.FullName, StringComparison.OrdinalIgnoreCase)) { item.SetImagePath(type, image.FileInfo); changed = true; } } } var backdrops = images.Where(i => i.Type == ImageType.Backdrop).ToList(); if (backdrops.Count > 0) { var foundImages = images.Where(i => i.Type == ImageType.Backdrop) .Select(i => i.FileInfo) .ToList(); if (foundImages.Count > 0) { if (item.AddImages(ImageType.Backdrop, foundImages)) { changed = true; } } } var hasScreenshots = item as IHasScreenshots; if (hasScreenshots != null) { var foundImages = images.Where(i => i.Type == ImageType.Screenshot) .Select(i => i.FileInfo) .ToList(); if (foundImages.Count > 0) { if (item.AddImages(ImageType.Screenshot, foundImages)) { changed = true; } } } return(changed); }
private bool UpdateMultiImages(IHasImages item, List <LocalImageInfo> images, ImageType type) { var changed = false; var newImages = images.Where(i => i.Type == type).ToList(); var newImageFileInfos = newImages .Select(i => i.FileInfo) .ToList(); if (item.AddImages(type, newImageFileInfos)) { changed = true; } return(changed); }
private bool UpdateMultiImages(IHasImages item, List <LocalImageInfo> images, ImageType type) { var changed = false; var backdrops = images.Where(i => i.Type == type).ToList(); if (backdrops.Count > 0) { var foundImages = images.Where(i => i.Type == type) .Select(i => i.FileInfo) .ToList(); if (foundImages.Count > 0) { if (item.AddImages(type, foundImages)) { changed = true; } } } return(changed); }
private bool UpdateMultiImages(IHasImages item, List<LocalImageInfo> images, ImageType type) { var changed = false; var backdrops = images.Where(i => i.Type == type).ToList(); if (backdrops.Count > 0) { var foundImages = images.Where(i => i.Type == type) .Select(i => i.FileInfo) .ToList(); if (foundImages.Count > 0) { if (item.AddImages(type, foundImages)) { changed = true; } } } return changed; }
private bool UpdateMultiImages(IHasImages item, List<LocalImageInfo> images, ImageType type) { var changed = false; var newImages = images.Where(i => i.Type == type).ToList(); var newImageFileInfos = newImages .Select(i => i.FileInfo) .ToList(); if (item.AddImages(type, newImageFileInfos)) { changed = true; } return changed; }
public bool MergeImages(IHasImages item, List<LocalImageInfo> images) { var changed = false; foreach (var type in _singularImages) { var image = images.FirstOrDefault(i => i.Type == type); if (image != null) { var currentImage = item.GetImageInfo(type, 0); if (currentImage == null || !string.Equals(currentImage.Path, image.FileInfo.FullName, StringComparison.OrdinalIgnoreCase)) { item.SetImagePath(type, image.FileInfo); changed = true; } } } var backdrops = images.Where(i => i.Type == ImageType.Backdrop).ToList(); if (backdrops.Count > 0) { var foundImages = images.Where(i => i.Type == ImageType.Backdrop) .Select(i => i.FileInfo) .ToList(); if (foundImages.Count > 0) { if (item.AddImages(ImageType.Backdrop, foundImages)) { changed = true; } } } var hasScreenshots = item as IHasScreenshots; if (hasScreenshots != null) { var foundImages = images.Where(i => i.Type == ImageType.Screenshot) .Select(i => i.FileInfo) .ToList(); if (foundImages.Count > 0) { if (item.AddImages(ImageType.Screenshot, foundImages)) { changed = true; } } } return changed; }