Reducing image count
This commit is contained in:
@@ -66,25 +66,6 @@ foreach (var file in mdFiles)
|
||||
cards.Add(card);
|
||||
}
|
||||
|
||||
// Copy PNGs to wwwroot/cards
|
||||
var cardsDir = Path.Combine(webWwwRoot, "cards");
|
||||
Directory.CreateDirectory(cardsDir);
|
||||
|
||||
var pngFiles = Directory.GetFiles(docsDir, "*.png", SearchOption.AllDirectories);
|
||||
var pngMap = pngFiles
|
||||
.GroupBy(Path.GetFileName)
|
||||
.ToDictionary(g => g.Key!, g => g.First(), StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
foreach (var card in cards)
|
||||
{
|
||||
if (card.ImageFile == null) continue;
|
||||
if (pngMap.TryGetValue(card.ImageFile, out var src))
|
||||
{
|
||||
var dst = Path.Combine(cardsDir, card.ImageFile);
|
||||
File.Copy(src, dst, true);
|
||||
}
|
||||
}
|
||||
|
||||
// Generate C# source file
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(generatedFile)!);
|
||||
using var writer = new StreamWriter(generatedFile, false, Encoding.UTF8);
|
||||
|
||||
Reference in New Issue
Block a user