Put in image cache creating for GitHub repositories

This commit is contained in:
LarsBrubaker 2021-04-25 12:05:51 -07:00
parent 31426c48ac
commit ebf60b1f1b
2 changed files with 22 additions and 6 deletions

View file

@ -156,6 +156,28 @@ namespace MatterHackers.MatterControl.Library
}
}
Task.Run(async () =>
{
foreach (var item in this.Items)
{
// check if we have any of the images cached
var thumbnail = await Task.Run(() => ApplicationController.Instance.Thumbnails.LoadCachedImage(item, 256, 256));
if (thumbnail != null
&& thumbnail.Width == 256)
{
// save so it is easy to create the upload data for GitHub folders
var filename = ApplicationController.CacheablePath(
Path.Combine("GitHubImages", this.Repository, this.RepoDirectory.Replace("/", "\\"), ".images"),
$"{Path.GetFileNameWithoutExtension(item.Name)}.png");
if (!File.Exists(filename))
{
ImageIO.SaveImageData(filename, thumbnail);
}
}
}
});
this.ChildContainers = childContainers;
OnContentChanged();