mirror of
https://github.com/LorisYounger/VPet.ModMaker.git
synced 2024-08-30 18:22:21 +00:00
修复 foodImage 读取问题
This commit is contained in:
parent
250da82648
commit
1be307cc93
@ -58,6 +58,8 @@ public static class Extensions
|
|||||||
/// <returns>复制的图像</returns>
|
/// <returns>复制的图像</returns>
|
||||||
public static BitmapImage Copy(this BitmapImage image)
|
public static BitmapImage Copy(this BitmapImage image)
|
||||||
{
|
{
|
||||||
|
if (image is null)
|
||||||
|
return null;
|
||||||
BitmapImage newImage = new();
|
BitmapImage newImage = new();
|
||||||
newImage.BeginInit();
|
newImage.BeginInit();
|
||||||
newImage.DecodePixelWidth = image.DecodePixelWidth;
|
newImage.DecodePixelWidth = image.DecodePixelWidth;
|
||||||
|
@ -166,7 +166,8 @@ public class ModLoader
|
|||||||
foreach (ILine li in tmp)
|
foreach (ILine li in tmp)
|
||||||
{
|
{
|
||||||
var food = LPSConvert.DeserializeObject<Food>(li);
|
var food = LPSConvert.DeserializeObject<Food>(li);
|
||||||
var imagePath = $"{path.FullName}\\image\\food\\{food.Name}.png";
|
var imagePath =
|
||||||
|
$"{path.FullName}\\image\\food\\{(string.IsNullOrWhiteSpace(food.Image) ? food.Name : food.Image)}.png";
|
||||||
if (File.Exists(imagePath))
|
if (File.Exists(imagePath))
|
||||||
food.Image = imagePath;
|
food.Image = imagePath;
|
||||||
Foods.Add(food);
|
Foods.Add(food);
|
||||||
|
Loading…
Reference in New Issue
Block a user