diff --git a/VPet-Simulator.Windows.Interface/Source.cs b/VPet-Simulator.Windows.Interface/Source.cs
index 9560a1a..c726a3b 100644
--- a/VPet-Simulator.Windows.Interface/Source.cs
+++ b/VPet-Simulator.Windows.Interface/Source.cs
@@ -133,7 +133,7 @@ namespace VPet_Simulator.Windows.Interface
///
/// 图片名称
/// 图片资源,如果未找到则退回错误提示图片
- public BitmapImage FindImage(string imagename) => new BitmapImage(FindImageUri(imagename));
+ public BitmapImage FindImage(string imagename) => NewSafeBitmapImage(FindImageUri(imagename));
public Uri FindImageUri(string imagename)
{
@@ -158,13 +158,33 @@ namespace VPet_Simulator.Windows.Interface
string source = FindSource(imagename);
if (source == null)
{
- return new BitmapImage(FindImageUri(superior));
+ return NewSafeBitmapImage(source);
}
- return new BitmapImage(new Uri(source));
+ return NewSafeBitmapImage(source);
}
///
/// 图片设置 (eg:定位锚点等)
///
public LpsDocument ImageSetting = new LpsDocument();
+ ///
+ /// 更加安全的图片URI加载
+ ///
+ /// 图片源
+ /// BitmapImage
+ public static BitmapImage NewSafeBitmapImage(string source) => NewSafeBitmapImage(new Uri(source));
+ ///
+ /// 更加安全的图片URI加载
+ ///
+ /// 图片源
+ /// BitmapImage
+ public static BitmapImage NewSafeBitmapImage(Uri source)
+ {
+ BitmapImage bi = new BitmapImage();
+ bi.BeginInit();
+ bi.CreateOptions = BitmapCreateOptions.IgnoreColorProfile;
+ bi.UriSource = source;
+ bi.EndInit();
+ return bi;
+ }
}
}
diff --git a/VPet-Simulator.Windows/MainWindow.cs b/VPet-Simulator.Windows/MainWindow.cs
index 7e7bf2f..3df9052 100644
--- a/VPet-Simulator.Windows/MainWindow.cs
+++ b/VPet-Simulator.Windows/MainWindow.cs
@@ -61,7 +61,7 @@ namespace VPet_Simulator.Windows
///
/// 版本号
///
- public int version { get; } = 108;
+ public int version { get; } = 109;
///
/// 版本号
///
@@ -144,7 +144,7 @@ namespace VPet_Simulator.Windows
if (hashcheckimg == null)
{
hashcheckimg = new Image();
- hashcheckimg.Source = new BitmapImage(new Uri("pack://application:,,,/Res/hash.png"));
+ hashcheckimg.Source = ImageResources.NewSafeBitmapImage("pack://application:,,,/Res/hash.png");
hashcheckimg.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
hashcheckimg.ToolTip = "是没有修改过存档/使用超模MOD的玩家专属标志".Translate();
Grid.SetColumn(hashcheckimg, 4);
diff --git a/VPet-Simulator.Windows/MainWindow.xaml.cs b/VPet-Simulator.Windows/MainWindow.xaml.cs
index e665649..8290a13 100644
--- a/VPet-Simulator.Windows/MainWindow.xaml.cs
+++ b/VPet-Simulator.Windows/MainWindow.xaml.cs
@@ -27,6 +27,7 @@ using static VPet_Simulator.Core.GraphInfo;
using System.Globalization;
using static VPet_Simulator.Windows.Interface.ExtensionFunction;
using LinePutScript.Dictionary;
+using System.Windows.Media.Imaging;
namespace VPet_Simulator.Windows
{
@@ -65,7 +66,6 @@ namespace VPet_Simulator.Windows
CultureInfo.CurrentCulture = new CultureInfo(CultureInfo.CurrentCulture.Name);
CultureInfo.CurrentCulture.NumberFormat = new CultureInfo("en-US").NumberFormat;
-
//判断是不是Steam用户,因为本软件会发布到Steam
//在 https://store.steampowered.com/app/1920960/VPet
try
@@ -205,7 +205,7 @@ namespace VPet_Simulator.Windows
}
}
-
+
public new void Close()
{
if (Main == null)
diff --git a/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs b/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs
index f19fa3b..d01fd9e 100644
--- a/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs
+++ b/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs
@@ -331,7 +331,7 @@ namespace VPet_Simulator.Windows
runMODAuthor.Text = mod.Author;
runMODGameVer.Text = CoreMOD.INTtoVER(mod.GameVer);
runMODGameVer.Foreground = Function.ResourcesBrush(Function.BrushType.PrimaryText);
- ImageMOD.Source = new BitmapImage(new Uri(mod.Path.FullName + @"\icon.png"));
+ ImageMOD.Source = ImageResources.NewSafeBitmapImage(mod.Path.FullName + @"\icon.png");
if (mod.GameVer < mw.version)
{
if (mod.GameVer / 10 == mw.version / 10)