Commit 65effcfa authored by keyongyu's avatar keyongyu

1.5.2

parent 86537d06
...@@ -25,6 +25,7 @@ public enum MyTask{ ...@@ -25,6 +25,7 @@ public enum MyTask{
CopyDataBase, CopyDataBase,
SaveAsMSE, SaveAsMSE,
CutImages, CutImages,
ConvertImages,
} }
/// <summary> /// <summary>
/// Description of TaskHelper. /// Description of TaskHelper.
...@@ -75,15 +76,18 @@ public class TaskHelper ...@@ -75,15 +76,18 @@ public class TaskHelper
else else
MyMsg.Show(LMSG.DownloadFail); MyMsg.Show(LMSG.DownloadFail);
} }
public static void CutImages(string imgpath,string savepath) public static void CutImages(string imgpath,string savepath)
{
CutImages(imgpath,savepath,true);
}
public static void CutImages(string imgpath,string savepath,bool isreplace)
{ {
imgSet.Init(); imgSet.Init();
foreach(Card c in cardlist) foreach(Card c in cardlist)
{ {
string jpg=Path.Combine(imgpath, c.id+".jpg"); string jpg=Path.Combine(imgpath, c.id+".jpg");
string savejpg=Path.Combine(savepath, c.id+".jpg"); string savejpg=Path.Combine(savepath, c.id+".jpg");
if(File.Exists(jpg)){ if(File.Exists(jpg) && (isreplace || !File.Exists(savejpg))){
Bitmap bp=new Bitmap(jpg); Bitmap bp=new Bitmap(jpg);
Bitmap bmp=null; Bitmap bmp=null;
if(c.IsType(CardType.TYPE_XYZ)){ if(c.IsType(CardType.TYPE_XYZ)){
...@@ -115,11 +119,46 @@ public static void CutImages(string imgpath,string savepath) ...@@ -115,11 +119,46 @@ public static void CutImages(string imgpath,string savepath)
MyBitmap.SaveAsJPEG(MyBitmap.Zoom(bmp, imgSet.w, imgSet.h), MyBitmap.SaveAsJPEG(MyBitmap.Zoom(bmp, imgSet.w, imgSet.h),
saveimg2, imgSet.quilty); saveimg2, imgSet.quilty);
} }
public static void ConvertImages(string imgpath)
{
ConvertImages(imgpath,true);
}
public static void ConvertImages(string imgpath,bool isreplace)
{
imgSet.Init();
string picspath=Path.Combine(imgpath,"pics");
string thubpath=Path.Combine(picspath,"thumbnail");
string[] files=Directory.GetFiles(imgpath);
foreach(string f in files){
string ex=Path.GetExtension(f).ToLower();
string name=Path.GetFileNameWithoutExtension(f);
string jpg_b=Path.Combine(picspath,name+".jpg");
string jpg_s=Path.Combine(thubpath,name+".jpg");
if(ex==".jpg"||ex==".png"||ex==".bmp"){
if(File.Exists(f)){
//存在大图
Bitmap bmp=new Bitmap(f);
if(isreplace || !File.Exists(jpg_b)){
MyBitmap.SaveAsJPEG(MyBitmap.Zoom(bmp, imgSet.W, imgSet.H),
jpg_b, imgSet.quilty);
}
if(isreplace || !File.Exists(jpg_s)){
MyBitmap.SaveAsJPEG(MyBitmap.Zoom(bmp, imgSet.w, imgSet.h),
jpg_s, imgSet.quilty);
}
}
}
}
}
public static void Run(){ public static void Run(){
bool replace;
bool showNew;
switch(nowTask){ switch(nowTask){
case MyTask.CheckUpdate: case MyTask.CheckUpdate:
bool showNew=false; showNew=false;
if(mArgs!=null && mArgs.Length>=1){ if(mArgs!=null && mArgs.Length>=1){
showNew=(mArgs[0]==Boolean.TrueString)?true:false; showNew=(mArgs[0]==Boolean.TrueString)?true:false;
} }
...@@ -128,15 +167,20 @@ public static void CutImages(string imgpath,string savepath) ...@@ -128,15 +167,20 @@ public static void CutImages(string imgpath,string savepath)
case MyTask.CopyDataBase: case MyTask.CopyDataBase:
if(mArgs!=null && mArgs.Length>=2){ if(mArgs!=null && mArgs.Length>=2){
string filename=mArgs[0]; string filename=mArgs[0];
bool replace=(mArgs[1]==Boolean.TrueString)?true:false; replace=(mArgs[1]==Boolean.TrueString)?true:false;
DataBase.CopyDB(filename, replace,cardlist); DataBase.CopyDB(filename, !replace,cardlist);
// //
MyMsg.Show(LMSG.copyDBIsOK); MyMsg.Show(LMSG.copyDBIsOK);
} }
break; break;
case MyTask.CutImages: case MyTask.CutImages:
if(mArgs!=null && mArgs.Length>=2){ if(mArgs!=null && mArgs.Length>=2){
CutImages(mArgs[0],mArgs[1]); replace=true;
if(mArgs.Length>=3){
if(mArgs[2]==Boolean.FalseString)
replace=false;
}
CutImages(mArgs[0],mArgs[1],replace);
MyMsg.Show(LMSG.CutImageOK); MyMsg.Show(LMSG.CutImageOK);
} }
break; break;
...@@ -146,6 +190,17 @@ public static void CutImages(string imgpath,string savepath) ...@@ -146,6 +190,17 @@ public static void CutImages(string imgpath,string savepath)
MyMsg.Show(LMSG.SaveMseOK); MyMsg.Show(LMSG.SaveMseOK);
} }
break; break;
case MyTask.ConvertImages:
if(mArgs!=null && mArgs.Length>=1){
replace=true;
if(mArgs.Length>=2){
if(mArgs[1]==Boolean.FalseString)
replace=false;
}
ConvertImages(mArgs[0],replace);
MyMsg.Show(LMSG.ConvertImageOK);
}
break;
} }
nowTask=MyTask.NONE; nowTask=MyTask.NONE;
......
...@@ -107,6 +107,7 @@ private void InitializeComponent() ...@@ -107,6 +107,7 @@ private void InitializeComponent()
this.lb_setcode = new System.Windows.Forms.Label(); this.lb_setcode = new System.Windows.Forms.Label();
this.btn_img = new System.Windows.Forms.Button(); this.btn_img = new System.Windows.Forms.Button();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.menuitem_convertimage = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
...@@ -132,6 +133,7 @@ private void InitializeComponent() ...@@ -132,6 +133,7 @@ private void InitializeComponent()
this.menuitem_saveasmse, this.menuitem_saveasmse,
this.tsep4, this.tsep4,
this.menuitem_cutimages, this.menuitem_cutimages,
this.menuitem_convertimage,
this.tsep1, this.tsep1,
this.menuitem_readydk, this.menuitem_readydk,
this.menuitem_readimages, this.menuitem_readimages,
...@@ -773,6 +775,13 @@ private void InitializeComponent() ...@@ -773,6 +775,13 @@ private void InitializeComponent()
this.btn_img.UseVisualStyleBackColor = true; this.btn_img.UseVisualStyleBackColor = true;
this.btn_img.Click += new System.EventHandler(this.Btn_imgClick); this.btn_img.Click += new System.EventHandler(this.Btn_imgClick);
// //
// menuitem_convertimage
//
this.menuitem_convertimage.Name = "menuitem_convertimage";
this.menuitem_convertimage.Size = new System.Drawing.Size(232, 22);
this.menuitem_convertimage.Text = "Convert Images";
this.menuitem_convertimage.Click += new System.EventHandler(this.Menuitem_convertimageClick);
//
// DataEditForm // DataEditForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
...@@ -838,6 +847,7 @@ private void InitializeComponent() ...@@ -838,6 +847,7 @@ private void InitializeComponent()
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
} }
private System.Windows.Forms.ToolStripMenuItem menuitem_convertimage;
private System.Windows.Forms.ToolTip toolTip1; private System.Windows.Forms.ToolTip toolTip1;
private System.Windows.Forms.ToolStripSeparator tsep2; private System.Windows.Forms.ToolStripSeparator tsep2;
private System.Windows.Forms.ToolStripMenuItem menuitem_openLastDataBase; private System.Windows.Forms.ToolStripMenuItem menuitem_openLastDataBase;
......
...@@ -80,11 +80,11 @@ void DataEditFormLoad(object sender, EventArgs e) ...@@ -80,11 +80,11 @@ void DataEditFormLoad(object sender, EventArgs e)
LANG.SetLanguage(this); LANG.SetLanguage(this);
this.Text=this.Text+" Ver:"+Application.ProductVersion; this.Text=this.Text+" Ver:"+Application.ProductVersion;
title=this.Text;
#if DEBUG #if DEBUG
this.Text=this.Text+"(DEBUG)"; this.Text=this.Text+"(DEBUG)";
#endif #endif
title=this.Text;
InitGameData(); InitGameData();
...@@ -1179,6 +1179,9 @@ void Tb_setcodeTextChanged(object sender, EventArgs e) ...@@ -1179,6 +1179,9 @@ void Tb_setcodeTextChanged(object sender, EventArgs e)
List<Card> cards=new List<Card>(); List<Card> cards=new List<Card>();
if(onlyselect) if(onlyselect)
{ {
#if DEBUG
MessageBox.Show("select");
#endif
foreach(ListViewItem lvitem in lv_cardlist.SelectedItems) foreach(ListViewItem lvitem in lv_cardlist.SelectedItems)
{ {
int index=lvitem.Index+(page-1)*MaxRow; int index=lvitem.Index+(page-1)*MaxRow;
...@@ -1241,8 +1244,9 @@ void Menuitem_cutimagesClick(object sender, EventArgs e) ...@@ -1241,8 +1244,9 @@ void Menuitem_cutimagesClick(object sender, EventArgs e)
return; return;
if(isRun()) if(isRun())
return; return;
bool isreplace=MyMsg.Question(LMSG.IfReplaceExistingImage);
TaskHelper.SetTask(MyTask.CutImages, cardlist.ToArray(), TaskHelper.SetTask(MyTask.CutImages, cardlist.ToArray(),
PICPATH, IMAGEPATH); PICPATH, IMAGEPATH, isreplace.ToString());
Run(LANG.GetMsg(LMSG.CutImage)); Run(LANG.GetMsg(LMSG.CutImage));
} }
void Menuitem_saveasmse_selectClick(object sender, EventArgs e) void Menuitem_saveasmse_selectClick(object sender, EventArgs e)
...@@ -1277,5 +1281,23 @@ void Menuitem_saveasmseClick(object sender, EventArgs e) ...@@ -1277,5 +1281,23 @@ void Menuitem_saveasmseClick(object sender, EventArgs e)
} }
#endregion #endregion
#region Convert images
void Menuitem_convertimageClick(object sender, EventArgs e)
{
if(isRun())
return;
using(FolderBrowserDialog fdlg=new FolderBrowserDialog())
{
fdlg.Description= LANG.GetMsg(LMSG.SelectImagePath);
if(fdlg.ShowDialog()==DialogResult.OK)
{
bool isreplace=MyMsg.Question(LMSG.IfReplaceExistingImage);
TaskHelper.SetTask(MyTask.ConvertImages, null,
fdlg.SelectedPath, isreplace.ToString());
Run(LANG.GetMsg(LMSG.ConvertImage));
}
}
}
#endregion
} }
} }
...@@ -63,6 +63,9 @@ public enum LMSG : uint ...@@ -63,6 +63,9 @@ public enum LMSG : uint
CutImage, CutImage,
CutImageOK, CutImageOK,
NoSelectCard, NoSelectCard,
IfReplaceExistingImage,
ConvertImage,
ConvertImageOK,
COUNT, COUNT,
} }
} }
...@@ -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("1.5.1.1")] [assembly: AssemblyVersion("1.5.2.0")]
...@@ -23,6 +23,7 @@ DataEditForm->lb4 / ...@@ -23,6 +23,7 @@ DataEditForm->lb4 /
DataEditForm->lb5 / DataEditForm->lb5 /
DataEditForm->lv_cardlist0 卡片密码 DataEditForm->lv_cardlist0 卡片密码
DataEditForm->lv_cardlist1 卡片名称 DataEditForm->lv_cardlist1 卡片名称
DataEditForm->menuitem_convertimage 批量导入卡图
DataEditForm->menuitem_openLastDataBase 最后打开的数据库 DataEditForm->menuitem_openLastDataBase 最后打开的数据库
DataEditForm->menuitem_cutimages 裁剪列表卡片的图片 DataEditForm->menuitem_cutimages 裁剪列表卡片的图片
DataEditForm->menuitem_saveasmse_select 所选卡片导出MSE存档 DataEditForm->menuitem_saveasmse_select 所选卡片导出MSE存档
......
...@@ -47,3 +47,6 @@ ...@@ -47,3 +47,6 @@
0x2e 正在裁剪图片 0x2e 正在裁剪图片
0x2f 裁剪图片完成 0x2f 裁剪图片完成
0x30 没有选中一张卡片 0x30 没有选中一张卡片
0x31 是否替换存在的图片?
0x32 正在转换图片
0x33 转换图片完成
\ No newline at end of file
...@@ -47,3 +47,6 @@ ...@@ -47,3 +47,6 @@
0x2e Cut Images... 0x2e Cut Images...
0x2f Cut Images OK 0x2f Cut Images OK
0x30 No Select Cards 0x30 No Select Cards
0x31 If Replace Iamge When it's exisit?
0x32 Converting Images
0x33 Convert Images OK
\ No newline at end of file
[DataEditorX]1.5.1.1[DataEditorX] [DataEditorX]1.5.2.0[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]
★使用前,请关联lua的打开方式,例如记事本,notepad++,等。 ★使用前,请关联lua的打开方式,例如记事本,notepad++,等。
...@@ -47,6 +47,9 @@ DataEditorX.exe.config ...@@ -47,6 +47,9 @@ DataEditorX.exe.config
描述不详细的bug,我修复不了。(都不知道是bug是什么) 描述不详细的bug,我修复不了。(都不知道是bug是什么)
★更新历史 ★更新历史
1.5.2.0
修复复制卡片的替换
增加批量导入卡图
1.5.1.1 1.5.1.1
改MSE更新器的默认路径 改MSE更新器的默认路径
1.5.1.0 1.5.1.0
......
No preview for this file type
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<add key="language" value="chinese" /> <add key="language" value="chinese" />
<add key="sourceURL" value="https://github.com/247321453/DataEditorX" /> <add key="sourceURL" value="https://github.com/247321453/DataEditorX" />
<add key="updateURL" value="https://github.com/247321453/DataEditorX/tree/master/win32/readme.txt" /> <add key="updateURL" value="https://github.com/247321453/DataEditorX/tree/master/win32/readme.txt" />
<add key="cdb" value="F:\games\ygocore\cards (2).cdb" /> <add key="cdb" value="F:\10月13日数据更新(中文音效版)\cards.cdb" />
<add key="image_quilty" value="96" /> <add key="image_quilty" value="96" />
<add key="image" value="44,64,177,254" /> <add key="image" value="44,64,177,254" />
<add key="image_other" value="25,54,128,128" /> <add key="image_other" value="25,54,128,128" />
......
# 重命名列表 (编码为UTF-8,用tab键隔开,采用相对路径)
# 例如:前面改名为后面。
# pics/123456.jpg pics/456789.jpg
\ No newline at end of file
...@@ -23,6 +23,7 @@ DataEditForm->lb4 / ...@@ -23,6 +23,7 @@ DataEditForm->lb4 /
DataEditForm->lb5 / DataEditForm->lb5 /
DataEditForm->lv_cardlist0 卡片密码 DataEditForm->lv_cardlist0 卡片密码
DataEditForm->lv_cardlist1 卡片名称 DataEditForm->lv_cardlist1 卡片名称
DataEditForm->menuitem_convertimage 批量导入卡图
DataEditForm->menuitem_openLastDataBase 最后打开的数据库 DataEditForm->menuitem_openLastDataBase 最后打开的数据库
DataEditForm->menuitem_cutimages 裁剪列表卡片的图片 DataEditForm->menuitem_cutimages 裁剪列表卡片的图片
DataEditForm->menuitem_saveasmse_select 所选卡片导出MSE存档 DataEditForm->menuitem_saveasmse_select 所选卡片导出MSE存档
......
...@@ -47,3 +47,6 @@ ...@@ -47,3 +47,6 @@
0x2e 正在裁剪图片 0x2e 正在裁剪图片
0x2f 裁剪图片完成 0x2f 裁剪图片完成
0x30 没有选中一张卡片 0x30 没有选中一张卡片
0x31 是否替换存在的图片?
0x32 正在转换图片
0x33 转换图片完成
\ No newline at end of file
...@@ -47,3 +47,6 @@ ...@@ -47,3 +47,6 @@
0x2e Cut Images... 0x2e Cut Images...
0x2f Cut Images OK 0x2f Cut Images OK
0x30 No Select Cards 0x30 No Select Cards
0x31 If Replace Iamge When it's exisit?
0x32 Converting Images
0x33 Convert Images OK
\ No newline at end of file
[DataEditorX]1.5.1.1[DataEditorX] [DataEditorX]1.5.2.0[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]
★使用前,请关联lua的打开方式,例如记事本,notepad++,等。 ★使用前,请关联lua的打开方式,例如记事本,notepad++,等。
...@@ -47,6 +47,9 @@ DataEditorX.exe.config ...@@ -47,6 +47,9 @@ DataEditorX.exe.config
描述不详细的bug,我修复不了。(都不知道是bug是什么) 描述不详细的bug,我修复不了。(都不知道是bug是什么)
★更新历史 ★更新历史
1.5.2.0
修复复制卡片的替换
增加批量导入卡图
1.5.1.1 1.5.1.1
改MSE更新器的默认路径 改MSE更新器的默认路径
1.5.1.0 1.5.1.0
......
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