mirror of
https://github.com/LorisYounger/VPet.ModMaker.git
synced 2024-08-30 18:22:21 +00:00
修复 保存图片时图片不存在报错的问题
This commit is contained in:
parent
e5e572fde8
commit
171c49012c
@ -80,6 +80,8 @@ public static class Extensions
|
||||
/// <param name="path">路径</param>
|
||||
public static void SaveToPng(this BitmapSource image, string path)
|
||||
{
|
||||
if (image is null)
|
||||
return;
|
||||
if (path.EndsWith(".png") is false)
|
||||
path += ".png";
|
||||
var encoder = new PngBitmapEncoder();
|
||||
|
@ -249,8 +249,8 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
|
||||
if (I18nHelper.Current.CultureNames.Contains(lang) is false)
|
||||
I18nHelper.Current.CultureNames.Add(lang);
|
||||
}
|
||||
if (I18nHelper.Current.CultureNames.Count > 0)
|
||||
{
|
||||
if (I18nHelper.Current.CultureNames.Count == 0)
|
||||
return;
|
||||
I18nHelper.Current.CultureName.Value = I18nHelper.Current.CultureNames.First();
|
||||
foreach (var i18nData in OtherI18nDatas)
|
||||
{
|
||||
@ -298,7 +298,6 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Save
|
||||
/// <summary>
|
||||
|
@ -200,21 +200,21 @@ public class ModEditWindowVM
|
||||
if (saveFileDialog.ShowDialog() is true)
|
||||
{
|
||||
var pending = PendingBox.Show("保存中".Translate());
|
||||
try
|
||||
{
|
||||
//try
|
||||
//{
|
||||
var path = Path.GetDirectoryName(saveFileDialog.FileName);
|
||||
ModInfo.Value.SaveTo(path);
|
||||
if (string.IsNullOrWhiteSpace(ModInfo.Value.SourcePath.Value))
|
||||
ModInfo.Value.SourcePath.Value = path;
|
||||
pending.Close();
|
||||
MessageBox.Show(ModEditWindow, "保存成功".Translate());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
pending.Close();
|
||||
MessageBox.Show($"保存失败 错误信息:\n{0}".Translate(ex));
|
||||
return;
|
||||
}
|
||||
//}
|
||||
//catch (Exception ex)
|
||||
//{
|
||||
// pending.Close();
|
||||
// MessageBox.Show("保存失败 错误信息:\n{0}".Translate(ex));
|
||||
// return;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
<Button
|
||||
Grid.Column="1"
|
||||
Command="{Binding ClearHistoriesCommand}"
|
||||
Content="清空历史" />
|
||||
Content="{ll:Str 清空历史}" />
|
||||
</Grid>
|
||||
<ListBox
|
||||
Grid.Row="2"
|
||||
|
Loading…
Reference in New Issue
Block a user