Commit 65effcfa authored by keyongyu's avatar keyongyu

1.5.2

parent 86537d06
......@@ -25,6 +25,7 @@ public enum MyTask{
CopyDataBase,
SaveAsMSE,
CutImages,
ConvertImages,
}
/// <summary>
/// Description of TaskHelper.
......@@ -75,31 +76,34 @@ public class TaskHelper
else
MyMsg.Show(LMSG.DownloadFail);
}
public static void CutImages(string imgpath,string savepath)
{
CutImages(imgpath,savepath,true);
}
public static void CutImages(string imgpath,string savepath,bool isreplace)
{
imgSet.Init();
foreach(Card c in cardlist)
{
string jpg=Path.Combine(imgpath, 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 bmp=null;
if(c.IsType(CardType.TYPE_XYZ)){
bmp = MyBitmap.Cut(bp,
imgSet.xyz_x,imgSet.xyz_y,
imgSet.xyz_w,imgSet.xyz_h);
imgSet.xyz_x,imgSet.xyz_y,
imgSet.xyz_w,imgSet.xyz_h);
}
else if(c.IsType(CardType.TYPE_PENDULUM)){
bmp = MyBitmap.Cut(bp,
imgSet.pendulum_x,imgSet.pendulum_y,
imgSet.pendulum_w,imgSet.pendulum_h);
imgSet.pendulum_x,imgSet.pendulum_y,
imgSet.pendulum_w,imgSet.pendulum_h);
}
else{
bmp = MyBitmap.Cut(bp,
imgSet.other_x,imgSet.other_y,
imgSet.other_w,imgSet.other_h);
imgSet.other_x,imgSet.other_y,
imgSet.other_w,imgSet.other_h);
}
MyBitmap.SaveAsJPEG(bmp, savejpg, imgSet.quilty);
}
......@@ -115,11 +119,46 @@ public static void CutImages(string imgpath,string savepath)
MyBitmap.SaveAsJPEG(MyBitmap.Zoom(bmp, imgSet.w, imgSet.h),
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(){
bool replace;
bool showNew;
switch(nowTask){
case MyTask.CheckUpdate:
bool showNew=false;
showNew=false;
if(mArgs!=null && mArgs.Length>=1){
showNew=(mArgs[0]==Boolean.TrueString)?true:false;
}
......@@ -127,16 +166,21 @@ public static void CutImages(string imgpath,string savepath)
break;
case MyTask.CopyDataBase:
if(mArgs!=null && mArgs.Length>=2){
string filename=mArgs[0];
bool replace=(mArgs[1]==Boolean.TrueString)?true:false;
DataBase.CopyDB(filename, replace,cardlist);
string filename=mArgs[0];
replace=(mArgs[1]==Boolean.TrueString)?true:false;
DataBase.CopyDB(filename, !replace,cardlist);
//
MyMsg.Show(LMSG.copyDBIsOK);
}
break;
case MyTask.CutImages:
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);
}
break;
......@@ -146,6 +190,17 @@ public static void CutImages(string imgpath,string savepath)
MyMsg.Show(LMSG.SaveMseOK);
}
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;
......
......@@ -107,6 +107,7 @@ private void InitializeComponent()
this.lb_setcode = new System.Windows.Forms.Label();
this.btn_img = new System.Windows.Forms.Button();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.menuitem_convertimage = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
......@@ -132,6 +133,7 @@ private void InitializeComponent()
this.menuitem_saveasmse,
this.tsep4,
this.menuitem_cutimages,
this.menuitem_convertimage,
this.tsep1,
this.menuitem_readydk,
this.menuitem_readimages,
......@@ -773,6 +775,13 @@ private void InitializeComponent()
this.btn_img.UseVisualStyleBackColor = true;
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
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
......@@ -838,6 +847,7 @@ private void InitializeComponent()
this.ResumeLayout(false);
this.PerformLayout();
}
private System.Windows.Forms.ToolStripMenuItem menuitem_convertimage;
private System.Windows.Forms.ToolTip toolTip1;
private System.Windows.Forms.ToolStripSeparator tsep2;
private System.Windows.Forms.ToolStripMenuItem menuitem_openLastDataBase;
......
......@@ -80,11 +80,11 @@ void DataEditFormLoad(object sender, EventArgs e)
LANG.SetLanguage(this);
this.Text=this.Text+" Ver:"+Application.ProductVersion;
title=this.Text;
#if DEBUG
this.Text=this.Text+"(DEBUG)";
#endif
title=this.Text;
InitGameData();
......@@ -1068,7 +1068,7 @@ void BackgroundWorker1RunWorkerCompleted(object sender, System.ComponentModel.Ru
int j=len-str.Length;
for(int i=0;i<j;i++){
str="0"+str;
}
}
return str;
}
void setSetcode(long setcode){
......@@ -1179,6 +1179,9 @@ void Tb_setcodeTextChanged(object sender, EventArgs e)
List<Card> cards=new List<Card>();
if(onlyselect)
{
#if DEBUG
MessageBox.Show("select");
#endif
foreach(ListViewItem lvitem in lv_cardlist.SelectedItems)
{
int index=lvitem.Index+(page-1)*MaxRow;
......@@ -1241,8 +1244,9 @@ void Menuitem_cutimagesClick(object sender, EventArgs e)
return;
if(isRun())
return;
bool isreplace=MyMsg.Question(LMSG.IfReplaceExistingImage);
TaskHelper.SetTask(MyTask.CutImages, cardlist.ToArray(),
PICPATH, IMAGEPATH);
PICPATH, IMAGEPATH, isreplace.ToString());
Run(LANG.GetMsg(LMSG.CutImage));
}
void Menuitem_saveasmse_selectClick(object sender, EventArgs e)
......@@ -1277,5 +1281,23 @@ void Menuitem_saveasmseClick(object sender, EventArgs e)
}
#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
CutImage,
CutImageOK,
NoSelectCard,
IfReplaceExistingImage,
ConvertImage,
ConvertImageOK,
COUNT,
}
}
......@@ -28,4 +28,4 @@
//
// You can specify all the values or you can use the default the Revision and
// 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 /
DataEditForm->lb5 /
DataEditForm->lv_cardlist0 卡片密码
DataEditForm->lv_cardlist1 卡片名称
DataEditForm->menuitem_convertimage 批量导入卡图
DataEditForm->menuitem_openLastDataBase 最后打开的数据库
DataEditForm->menuitem_cutimages 裁剪列表卡片的图片
DataEditForm->menuitem_saveasmse_select 所选卡片导出MSE存档
......
......@@ -46,4 +46,7 @@
0x2d 导出MSE存档完成
0x2e 正在裁剪图片
0x2f 裁剪图片完成
0x30 没有选中一张卡片
\ No newline at end of file
0x30 没有选中一张卡片
0x31 是否替换存在的图片?
0x32 正在转换图片
0x33 转换图片完成
\ No newline at end of file
......@@ -46,4 +46,7 @@
0x2d Export Mse-set OK
0x2e Cut Images...
0x2f Cut Images OK
0x30 No Select Cards
\ No newline at end of file
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]
★使用前,请关联lua的打开方式,例如记事本,notepad++,等。
......@@ -47,6 +47,9 @@ DataEditorX.exe.config
描述不详细的bug,我修复不了。(都不知道是bug是什么)
★更新历史
1.5.2.0
修复复制卡片的替换
增加批量导入卡图
1.5.1.1
改MSE更新器的默认路径
1.5.1.0
......
No preview for this file type
......@@ -10,7 +10,7 @@
<add key="language" value="chinese" />
<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="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" value="44,64,177,254" />
<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 /
DataEditForm->lb5 /
DataEditForm->lv_cardlist0 卡片密码
DataEditForm->lv_cardlist1 卡片名称
DataEditForm->menuitem_convertimage 批量导入卡图
DataEditForm->menuitem_openLastDataBase 最后打开的数据库
DataEditForm->menuitem_cutimages 裁剪列表卡片的图片
DataEditForm->menuitem_saveasmse_select 所选卡片导出MSE存档
......
......@@ -46,4 +46,7 @@
0x2d 导出MSE存档完成
0x2e 正在裁剪图片
0x2f 裁剪图片完成
0x30 没有选中一张卡片
\ No newline at end of file
0x30 没有选中一张卡片
0x31 是否替换存在的图片?
0x32 正在转换图片
0x33 转换图片完成
\ No newline at end of file
......@@ -46,4 +46,7 @@
0x2d Export Mse-set OK
0x2e Cut Images...
0x2f Cut Images OK
0x30 No Select Cards
\ No newline at end of file
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]
★使用前,请关联lua的打开方式,例如记事本,notepad++,等。
......@@ -47,6 +47,9 @@ DataEditorX.exe.config
描述不详细的bug,我修复不了。(都不知道是bug是什么)
★更新历史
1.5.2.0
修复复制卡片的替换
增加批量导入卡图
1.5.1.1
改MSE更新器的默认路径
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