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