Commit 9ee51e1e authored by keyongyu's avatar keyongyu

2.3.0.6

parent cb476190
...@@ -14,6 +14,14 @@ namespace DataEditorX.Common ...@@ -14,6 +14,14 @@ namespace DataEditorX.Common
/// </summary> /// </summary>
public static class MyBitmap public static class MyBitmap
{ {
public static Bitmap readImage(string file)
{
if (!File.Exists(file))
return null;
MemoryStream ms = new MemoryStream(File.ReadAllBytes(file));
return (Bitmap)Image.FromStream(ms);
}
#region 缩放 #region 缩放
/// <summary> /// <summary>
/// 缩放图像 /// 缩放图像
......
...@@ -43,6 +43,7 @@ public bool AddCard() ...@@ -43,6 +43,7 @@ public bool AddCard()
MyMsg.Show(LMSG.AddSucceed); MyMsg.Show(LMSG.AddSucceed);
undoSQL = DataBase.GetDeleteSQL(c); undoSQL = DataBase.GetDeleteSQL(c);
dataform.Search(true); dataform.Search(true);
dataform.SetCard(c);
return true; return true;
} }
MyMsg.Error(LMSG.AddFail); MyMsg.Error(LMSG.AddFail);
...@@ -87,7 +88,6 @@ public bool ModCard(bool modfiles) ...@@ -87,7 +88,6 @@ public bool ModCard(bool modfiles)
undoSQL += DataBase.GetInsertSQL(oldCard, false); undoSQL += DataBase.GetInsertSQL(oldCard, false);
} }
} }
dataform.SetImage(0);//释放当前使用的卡图
//如果删除旧卡片,则把资源修改名字,否则复制资源 //如果删除旧卡片,则把资源修改名字,否则复制资源
if (modfiles) if (modfiles)
YGOUtil.CardRename(c.id, oldCard.id, dataform.GetPath(), delold); YGOUtil.CardRename(c.id, oldCard.id, dataform.GetPath(), delold);
...@@ -130,7 +130,6 @@ public bool DelCards(bool deletefiles) ...@@ -130,7 +130,6 @@ public bool DelCards(bool deletefiles)
//删除资源 //删除资源
if (deletefiles) if (deletefiles)
{ {
dataform.SetImage(0);//释放当前使用的卡图
YGOUtil.CardDelete(c.id, dataform.GetPath(), false); YGOUtil.CardDelete(c.id, dataform.GetPath(), false);
} }
} }
......
...@@ -236,7 +236,7 @@ void InitPath(string datapath) ...@@ -236,7 +236,7 @@ void InitPath(string datapath)
this.datapath = datapath; this.datapath = datapath;
confcover = MyPath.Combine(datapath, "cover.jpg"); confcover = MyPath.Combine(datapath, "cover.jpg");
if (File.Exists(confcover)) if (File.Exists(confcover))
m_cover = Image.FromFile(confcover); m_cover = MyBitmap.readImage(confcover);
else else
m_cover = null; m_cover = null;
} }
...@@ -1233,26 +1233,18 @@ public void SetImage(string id) ...@@ -1233,26 +1233,18 @@ public void SetImage(string id)
} }
public void SetImage(long id) public void SetImage(long id)
{ {
if (pl_image.BackgroundImage != null
&& pl_image.BackgroundImage != m_cover)
{//释放资源占用
pl_image.BackgroundImage.Dispose();
}
Bitmap temp;
string pic = ygopath.GetImage(id); string pic = ygopath.GetImage(id);
if (menuitem_importmseimg.Checked)//显示MSE图片 if (menuitem_importmseimg.Checked)//显示MSE图片
{ {
string msepic = MseMaker.GetCardImagePath(tasker.MSEImagePath, oldCard); string msepic = MseMaker.GetCardImagePath(tasker.MSEImagePath, oldCard);
if(File.Exists(msepic)) if(File.Exists(msepic))
{ {
temp = new Bitmap(msepic); pl_image.BackgroundImage = MyBitmap.readImage(msepic);
pl_image.BackgroundImage = temp;
} }
} }
else if (File.Exists(pic)) else if (File.Exists(pic))
{ {
temp = new Bitmap(pic); pl_image.BackgroundImage = MyBitmap.readImage(pic);
pl_image.BackgroundImage = temp;
} }
else else
pl_image.BackgroundImage = m_cover; pl_image.BackgroundImage = m_cover;
...@@ -1530,6 +1522,7 @@ private void menuitem_openfileinthis_Click(object sender, EventArgs e) ...@@ -1530,6 +1522,7 @@ private void menuitem_openfileinthis_Click(object sender, EventArgs e)
} }
#endregion #endregion
#region 空格
private void menuitem_saveasenter_Click(object sender, EventArgs e) private void menuitem_saveasenter_Click(object sender, EventArgs e)
{ {
using (SaveFileDialog dlg = new SaveFileDialog()) using (SaveFileDialog dlg = new SaveFileDialog())
...@@ -1549,6 +1542,10 @@ private void menuitem_saveasenter_Click(object sender, EventArgs e) ...@@ -1549,6 +1542,10 @@ private void menuitem_saveasenter_Click(object sender, EventArgs e)
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
cards[i].desc = StrUtil.AutoEnter(cards[i].desc, len, ' '); cards[i].desc = StrUtil.AutoEnter(cards[i].desc, len, ' ');
for (int j = 0; j < Card.STR_MAX; j++)
{
cards[i].Str[j] = StrUtil.AutoEnter(cards[i].Str[j], len, ' ');
}
} }
DataBase.CopyDB(dlg.FileName, false, cards); DataBase.CopyDB(dlg.FileName, false, cards);
MyMsg.Show(LMSG.CopyCardsToDBIsOK); MyMsg.Show(LMSG.CopyCardsToDBIsOK);
...@@ -1556,5 +1553,6 @@ private void menuitem_saveasenter_Click(object sender, EventArgs e) ...@@ -1556,5 +1553,6 @@ private void menuitem_saveasenter_Click(object sender, EventArgs e)
} }
} }
} }
#endregion
} }
} }
...@@ -28,4 +28,4 @@ ...@@ -28,4 +28,4 @@
// //
// You can specify all the values or you can use the default the Revision and // You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below: // Build Numbers by using the '*' as shown below:
[assembly: AssemblyVersion("2.3.0.5")] [assembly: AssemblyVersion("2.3.0.6")]
★更新历史 ★更新历史
2.3.0.6
修复图片占用问题。
2.3.0.5 2.3.0.5
修复删除卡片,无法删除卡图 修复删除卡片,无法删除卡图
2.3.0.4 2.3.0.4
......
[DataEditorX]2.3.0.5[DataEditorX] [DataEditorX]2.3.0.6[DataEditorX]
[URL]https://github.com/247321453/DataEditorX/raw/master/win32/win32.zip[URL] [URL]https://github.com/247321453/DataEditorX/raw/master/win32/win32.zip[URL]
★运行环境(Environment) ★运行环境(Environment)
...@@ -41,7 +41,6 @@ open_file_in_this 用自带的脚本编辑器打开lua ...@@ -41,7 +41,6 @@ open_file_in_this 用自带的脚本编辑器打开lua
★语言设置 ★语言设置
DataEditorX.exe.config DataEditorX.exe.config
<add key="language" value="chinese" />简体 <add key="language" value="chinese" />简体
<add key="language" value="english" />英文
其他语言请自己添加,需要2个文件,xxx为语言 其他语言请自己添加,需要2个文件,xxx为语言
data/language_xxx.txt data/language_xxx.txt
data/cardinfo_xxx.txt data/cardinfo_xxx.txt
......
...@@ -25,7 +25,7 @@ data/cardinfo_xxx.txt types/series ...@@ -25,7 +25,7 @@ data/cardinfo_xxx.txt types/series
★Language setting ★Language setting
DataEditorX.exe.config DataEditorX.exe.config
<add key="language" value="chinese" />Simplified Chinese <add key="language" value="chinese" />Simplified Chinese
<add key="language" value="english" />English chinese => english
If you want to add a language,you need two file,xxx is a type of language: If you want to add a language,you need two file,xxx is a type of language:
data/language_xxx.txt data/language_xxx.txt
data/cardinfo_xxx.txt data/cardinfo_xxx.txt
......
No preview for this file type
★更新历史 ★更新历史
2.3.0.6
修复图片占用问题。
2.3.0.5 2.3.0.5
修复删除卡片,无法删除卡图 修复删除卡片,无法删除卡图
2.3.0.4 2.3.0.4
......
[DataEditorX]2.3.0.5[DataEditorX] [DataEditorX]2.3.0.6[DataEditorX]
[URL]https://github.com/247321453/DataEditorX/raw/master/win32/win32.zip[URL] [URL]https://github.com/247321453/DataEditorX/raw/master/win32/win32.zip[URL]
★运行环境(Environment) ★运行环境(Environment)
...@@ -41,7 +41,6 @@ open_file_in_this 用自带的脚本编辑器打开lua ...@@ -41,7 +41,6 @@ open_file_in_this 用自带的脚本编辑器打开lua
★语言设置 ★语言设置
DataEditorX.exe.config DataEditorX.exe.config
<add key="language" value="chinese" />简体 <add key="language" value="chinese" />简体
<add key="language" value="english" />英文
其他语言请自己添加,需要2个文件,xxx为语言 其他语言请自己添加,需要2个文件,xxx为语言
data/language_xxx.txt data/language_xxx.txt
data/cardinfo_xxx.txt data/cardinfo_xxx.txt
......
...@@ -25,7 +25,7 @@ data/cardinfo_xxx.txt types/series ...@@ -25,7 +25,7 @@ data/cardinfo_xxx.txt types/series
★Language setting ★Language setting
DataEditorX.exe.config DataEditorX.exe.config
<add key="language" value="chinese" />Simplified Chinese <add key="language" value="chinese" />Simplified Chinese
<add key="language" value="english" />English chinese => english
If you want to add a language,you need two file,xxx is a type of language: If you want to add a language,you need two file,xxx is a type of language:
data/language_xxx.txt data/language_xxx.txt
data/cardinfo_xxx.txt data/cardinfo_xxx.txt
......
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment