Commit e334cd54 authored by 247321453's avatar 247321453

add

parent a0d4736a
...@@ -99,6 +99,7 @@ private void InitializeComponent() ...@@ -99,6 +99,7 @@ private void InitializeComponent()
this.label9 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label();
this.pl_cardtype = new System.Windows.Forms.DFlowLayoutPanel(); this.pl_cardtype = new System.Windows.Forms.DFlowLayoutPanel();
this.pl_category = new System.Windows.Forms.DFlowLayoutPanel(); this.pl_category = new System.Windows.Forms.DFlowLayoutPanel();
this.menuitem_copyselectto = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
...@@ -119,6 +120,7 @@ private void InitializeComponent() ...@@ -119,6 +120,7 @@ private void InitializeComponent()
this.menuitem_file.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.menuitem_file.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.menuitem_open, this.menuitem_open,
this.menuitem_new, this.menuitem_new,
this.menuitem_copyselectto,
this.menuitem_copyto, this.menuitem_copyto,
this.tsep1, this.tsep1,
this.menuitem_readydk, this.menuitem_readydk,
...@@ -133,7 +135,7 @@ private void InitializeComponent() ...@@ -133,7 +135,7 @@ private void InitializeComponent()
// //
this.menuitem_open.Name = "menuitem_open"; this.menuitem_open.Name = "menuitem_open";
this.menuitem_open.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); this.menuitem_open.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O)));
this.menuitem_open.Size = new System.Drawing.Size(165, 22); this.menuitem_open.Size = new System.Drawing.Size(169, 22);
this.menuitem_open.Text = "打开(&O)"; this.menuitem_open.Text = "打开(&O)";
this.menuitem_open.Click += new System.EventHandler(this.Menuitem_openClick); this.menuitem_open.Click += new System.EventHandler(this.Menuitem_openClick);
// //
...@@ -141,45 +143,45 @@ private void InitializeComponent() ...@@ -141,45 +143,45 @@ private void InitializeComponent()
// //
this.menuitem_new.Name = "menuitem_new"; this.menuitem_new.Name = "menuitem_new";
this.menuitem_new.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N))); this.menuitem_new.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N)));
this.menuitem_new.Size = new System.Drawing.Size(165, 22); this.menuitem_new.Size = new System.Drawing.Size(169, 22);
this.menuitem_new.Text = "新建(&N)"; this.menuitem_new.Text = "新建(&N)";
this.menuitem_new.Click += new System.EventHandler(this.Menuitem_newClick); this.menuitem_new.Click += new System.EventHandler(this.Menuitem_newClick);
// //
// menuitem_copyto // menuitem_copyto
// //
this.menuitem_copyto.Name = "menuitem_copyto"; this.menuitem_copyto.Name = "menuitem_copyto";
this.menuitem_copyto.Size = new System.Drawing.Size(165, 22); this.menuitem_copyto.Size = new System.Drawing.Size(169, 22);
this.menuitem_copyto.Text = "复制到(&C)"; this.menuitem_copyto.Text = "复制全部卡片到...";
this.menuitem_copyto.Click += new System.EventHandler(this.Menuitem_copytoClick); this.menuitem_copyto.Click += new System.EventHandler(this.Menuitem_copytoClick);
// //
// tsep1 // tsep1
// //
this.tsep1.Name = "tsep1"; this.tsep1.Name = "tsep1";
this.tsep1.Size = new System.Drawing.Size(162, 6); this.tsep1.Size = new System.Drawing.Size(166, 6);
// //
// menuitem_readydk // menuitem_readydk
// //
this.menuitem_readydk.Name = "menuitem_readydk"; this.menuitem_readydk.Name = "menuitem_readydk";
this.menuitem_readydk.Size = new System.Drawing.Size(165, 22); this.menuitem_readydk.Size = new System.Drawing.Size(169, 22);
this.menuitem_readydk.Text = "读取ydk(&Y)"; this.menuitem_readydk.Text = "读取ydk(&Y)";
this.menuitem_readydk.Click += new System.EventHandler(this.Menuitem_readydkClick); this.menuitem_readydk.Click += new System.EventHandler(this.Menuitem_readydkClick);
// //
// menuitem_readimages // menuitem_readimages
// //
this.menuitem_readimages.Name = "menuitem_readimages"; this.menuitem_readimages.Name = "menuitem_readimages";
this.menuitem_readimages.Size = new System.Drawing.Size(165, 22); this.menuitem_readimages.Size = new System.Drawing.Size(169, 22);
this.menuitem_readimages.Text = "读取图片(&I)"; this.menuitem_readimages.Text = "读取图片(&I)";
this.menuitem_readimages.Click += new System.EventHandler(this.Menuitem_readimagesClick); this.menuitem_readimages.Click += new System.EventHandler(this.Menuitem_readimagesClick);
// //
// tsep3 // tsep3
// //
this.tsep3.Name = "tsep3"; this.tsep3.Name = "tsep3";
this.tsep3.Size = new System.Drawing.Size(162, 6); this.tsep3.Size = new System.Drawing.Size(166, 6);
// //
// menuitem_quit // menuitem_quit
// //
this.menuitem_quit.Name = "menuitem_quit"; this.menuitem_quit.Name = "menuitem_quit";
this.menuitem_quit.Size = new System.Drawing.Size(165, 22); this.menuitem_quit.Size = new System.Drawing.Size(169, 22);
this.menuitem_quit.Text = "退出(&Q)"; this.menuitem_quit.Text = "退出(&Q)";
this.menuitem_quit.Click += new System.EventHandler(this.Menuitem_quitClick); this.menuitem_quit.Click += new System.EventHandler(this.Menuitem_quitClick);
// //
...@@ -715,6 +717,13 @@ private void InitializeComponent() ...@@ -715,6 +717,13 @@ private void InitializeComponent()
this.pl_category.Size = new System.Drawing.Size(303, 166); this.pl_category.Size = new System.Drawing.Size(303, 166);
this.pl_category.TabIndex = 13; this.pl_category.TabIndex = 13;
// //
// menuitem_copyselectto
//
this.menuitem_copyselectto.Name = "menuitem_copyselectto";
this.menuitem_copyselectto.Size = new System.Drawing.Size(169, 22);
this.menuitem_copyselectto.Text = "复制选中卡片到...";
this.menuitem_copyselectto.Click += new System.EventHandler(this.Menuitem_copyselecttoClick);
//
// DataEditForm // DataEditForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
...@@ -780,6 +789,7 @@ private void InitializeComponent() ...@@ -780,6 +789,7 @@ private void InitializeComponent()
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
} }
private System.Windows.Forms.ToolStripMenuItem menuitem_copyselectto;
private System.Windows.Forms.ToolStripMenuItem menuitem_github; private System.Windows.Forms.ToolStripMenuItem menuitem_github;
private System.Windows.Forms.ToolStripMenuItem menuitem_new; private System.Windows.Forms.ToolStripMenuItem menuitem_new;
private System.Windows.Forms.ToolStripMenuItem menuitem_showimage; private System.Windows.Forms.ToolStripMenuItem menuitem_showimage;
......
...@@ -460,7 +460,7 @@ public bool Check() ...@@ -460,7 +460,7 @@ public bool Check()
return true; return true;
else else
{ {
MyMsg.Warning(MyMsg.WARN_NoSelectCDB); MyMsg.Warning(MyMsg.ERROR_NoSelectCDB);
return false; return false;
} }
} }
...@@ -469,7 +469,7 @@ public bool Open(string cdbFile) ...@@ -469,7 +469,7 @@ public bool Open(string cdbFile)
{ {
if(!File.Exists(cdbFile)) if(!File.Exists(cdbFile))
{ {
MyMsg.Error(string.Format(MyMsg.ERROR_FileNotExisit,cdbFile)); MyMsg.Error(string.Format(MyMsg.ERROR_File_NotExisit,cdbFile));
return false; return false;
} }
nowCdbFile=cdbFile; nowCdbFile=cdbFile;
...@@ -541,9 +541,17 @@ public bool AddCard() ...@@ -541,9 +541,17 @@ public bool AddCard()
MyMsg.Error(MyMsg.ERROR_CardCodeIsZero); MyMsg.Error(MyMsg.ERROR_CardCodeIsZero);
return false; return false;
} }
foreach(Card ckey in cardlist)
{
if(c.id==ckey.id)
{
MyMsg.Warning(string.Format(MyMsg.ERROR_Card_IsExisit,ckey.ToString()));
return false;
}
}
if(DataBase.Command(nowCdbFile, DataBase.GetInsertSQL(c,true))>=2) if(DataBase.Command(nowCdbFile, DataBase.GetInsertSQL(c,true))>=2)
{ {
MyMsg.Show(string.Format(MyMsg.INFO_Addition,c.ToString())); MyMsg.Show(string.Format(MyMsg.INFO_Addition_Card,c.ToString()));
Search(srcCard, true); Search(srcCard, true);
return true; return true;
} }
...@@ -567,10 +575,24 @@ public bool ModCard() ...@@ -567,10 +575,24 @@ public bool ModCard()
MyMsg.Error(MyMsg.ERROR_CardCodeIsZero); MyMsg.Error(MyMsg.ERROR_CardCodeIsZero);
return false; return false;
} }
string sql;
if(DataBase.Command(nowCdbFile, DataBase.GetUpdateSQL(c))>0) if(c.id!=oldCard.id)
{ {
MyMsg.Show(string.Format(MyMsg.INFO_Modifty,c.ToString())); if(MyMsg.Question(string.Format(MyMsg.QUES_Delete_Card,oldCard.ToString())))
{
if(DataBase.Command(nowCdbFile, DataBase.GetDeleteSQL(oldCard))<2)
{
MyMsg.Error(MyMsg.ERROR_DeleteFail);
return false;
}
}
sql=DataBase.GetInsertSQL(c,false);
}
else
sql=DataBase.GetUpdateSQL(c);
if(DataBase.Command(nowCdbFile, sql)>0)
{
MyMsg.Show(string.Format(MyMsg.INFO_Modifty_Card,c.ToString()));
Search(srcCard, true); Search(srcCard, true);
} }
else else
...@@ -585,7 +607,7 @@ public bool DelCards() ...@@ -585,7 +607,7 @@ public bool DelCards()
int ic=lv_cardlist.SelectedItems.Count; int ic=lv_cardlist.SelectedItems.Count;
if(ic>=0) if(ic>=0)
return false; return false;
if(!MyMsg.Question(string.Format(MyMsg.QUES_DeleteCard,ic))) if(!MyMsg.Question(string.Format(MyMsg.QUES_Delete_Cards,ic)))
return false; return false;
List<string> sql=new List<string>(); List<string> sql=new List<string>();
foreach(ListViewItem lvitem in lv_cardlist.SelectedItems) foreach(ListViewItem lvitem in lv_cardlist.SelectedItems)
...@@ -619,7 +641,7 @@ public bool OpenScript() ...@@ -619,7 +641,7 @@ public bool OpenScript()
string lua=Path.Combine(LUAPTH,"c"+tb_cardcode.Text+".lua"); string lua=Path.Combine(LUAPTH,"c"+tb_cardcode.Text+".lua");
if(!File.Exists(lua)) if(!File.Exists(lua))
{ {
if(MyMsg.Question(string.Format(MyMsg.QUES_CreateLua,lua))) if(MyMsg.Question(string.Format(MyMsg.QUES_Create_Lua_,lua)))
{ {
File.Create(lua); File.Create(lua);
} }
...@@ -763,8 +785,8 @@ void Menuitem_openClick(object sender, EventArgs e) ...@@ -763,8 +785,8 @@ void Menuitem_openClick(object sender, EventArgs e)
{ {
using(OpenFileDialog dlg=new OpenFileDialog()) using(OpenFileDialog dlg=new OpenFileDialog())
{ {
dlg.Title="选择卡片数据库(cdb文件)"; dlg.Title=MyMsg.STR_OpenCDB;
dlg.Filter="cdb文件(*.cdb)|*.cdb|所有文件(*.*)|*.*"; dlg.Filter=MyMsg.STR_CDBFilter;
if(dlg.ShowDialog()==DialogResult.OK) if(dlg.ShowDialog()==DialogResult.OK)
{ {
Open(dlg.FileName); Open(dlg.FileName);
...@@ -775,8 +797,8 @@ void Menuitem_newClick(object sender, EventArgs e) ...@@ -775,8 +797,8 @@ void Menuitem_newClick(object sender, EventArgs e)
{ {
using(SaveFileDialog dlg=new SaveFileDialog()) using(SaveFileDialog dlg=new SaveFileDialog())
{ {
dlg.Title="选择卡片数据库(cdb文件)保存位置"; dlg.Title=MyMsg.STR_SaveCDB;
dlg.Filter="cdb文件(*.cdb)|*.cdb|所有文件(*.*)|*.*"; dlg.Filter=MyMsg.STR_CDBFilter;
if(dlg.ShowDialog()==DialogResult.OK) if(dlg.ShowDialog()==DialogResult.OK)
{ {
if(DataBase.Create(dlg.FileName)) if(DataBase.Create(dlg.FileName))
...@@ -787,31 +809,52 @@ void Menuitem_newClick(object sender, EventArgs e) ...@@ -787,31 +809,52 @@ void Menuitem_newClick(object sender, EventArgs e)
} }
} }
void Menuitem_copytoClick(object sender, EventArgs e) void Menuitem_copytoClick(object sender, EventArgs e)
{
CopyTo(false);
}
void Menuitem_copyselecttoClick(object sender, EventArgs e)
{
CopyTo(true);
}
void CopyTo(bool onlyselect)
{ {
if(!Check()) if(!Check())
return; return;
List<Card> cards=new List<Card>();
if(onlyselect)
{
foreach(ListViewItem lvitem in lv_cardlist.SelectedItems)
{
int index=lvitem.Index+(page-1)*MaxRow;
if(index<cardlist.Count)
cards.Add(cardlist[index]);
}
}
else
cards.AddRange(cardlist.ToArray());
using(OpenFileDialog dlg=new OpenFileDialog()) using(OpenFileDialog dlg=new OpenFileDialog())
{ {
dlg.Title="选择卡片数据库(cdb文件)"; dlg.Title=MyMsg.STR_OpenCDB;
dlg.Filter="cdb文件(*.cdb)|*.cdb|所有文件(*.*)|*.*"; dlg.Filter=MyMsg.STR_CDBFilter;
if(dlg.ShowDialog()==DialogResult.OK) if(dlg.ShowDialog()==DialogResult.OK)
{ {
if(MyMsg.Question("是否覆盖已经存在的卡片?")) if(MyMsg.Question(MyMsg.QUES_ReplaceCard))
DataBase.CopyDB(dlg.FileName,false,cardlist.ToArray()); DataBase.CopyDB(dlg.FileName,false,cards.ToArray());
else else
DataBase.CopyDB(dlg.FileName,true,cardlist.ToArray()); DataBase.CopyDB(dlg.FileName,true,cards.ToArray());
} }
} }
} }
void Menuitem_readydkClick(object sender, EventArgs e) void Menuitem_readydkClick(object sender, EventArgs e)
{ {
if(!Check()) if(!Check())
return; return;
using(OpenFileDialog dlg=new OpenFileDialog()) using(OpenFileDialog dlg=new OpenFileDialog())
{ {
dlg.Title="选择卡组文件(ydk文件)"; dlg.Title=MyMsg.STR_Openydk;
dlg.Filter="ydk文件(*.ydk)|*.ydk|所有文件(*.*)|*.*"; dlg.Filter=MyMsg.STR_ydkFilter;
if(dlg.ShowDialog()==DialogResult.OK) if(dlg.ShowDialog()==DialogResult.OK)
{ {
SetCards(DataBase.ReadYdk(nowCdbFile, dlg.FileName), false); SetCards(DataBase.ReadYdk(nowCdbFile, dlg.FileName), false);
...@@ -825,7 +868,7 @@ void Menuitem_readimagesClick(object sender, EventArgs e) ...@@ -825,7 +868,7 @@ void Menuitem_readimagesClick(object sender, EventArgs e)
return; return;
using(FolderBrowserDialog fdlg=new FolderBrowserDialog()) using(FolderBrowserDialog fdlg=new FolderBrowserDialog())
{ {
fdlg.Description="请选择卡片图像目录"; fdlg.Description=MyMsg.STR_SelectImages;
if(fdlg.ShowDialog()==DialogResult.OK) if(fdlg.ShowDialog()==DialogResult.OK)
{ {
SetCards(DataBase.ReadImage(nowCdbFile, fdlg.SelectedPath), false); SetCards(DataBase.ReadImage(nowCdbFile, fdlg.SelectedPath), false);
...@@ -859,6 +902,5 @@ void OnimgFormClosed(object sender, EventArgs e) ...@@ -859,6 +902,5 @@ void OnimgFormClosed(object sender, EventArgs e)
} }
#endregion #endregion
} }
} }
...@@ -102,6 +102,7 @@ ...@@ -102,6 +102,7 @@
<None Include="readme.txt"> <None Include="readme.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="update.txt" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>
\ No newline at end of file
...@@ -18,18 +18,27 @@ public static class MyMsg ...@@ -18,18 +18,27 @@ public static class MyMsg
public static readonly string ABOUT="程序:DataEditorX\n作者:247321453\nE-mail:247321453@qq.com\n"; public static readonly string ABOUT="程序:DataEditorX\n作者:247321453\nE-mail:247321453@qq.com\n";
public static readonly string ERROR_NoSeclectScriptText="请选中脚本文本"; public static readonly string ERROR_NoSeclectScriptText="请选中脚本文本";
public static readonly string INFO_Delete="删除成功!"; public static readonly string INFO_Delete="删除成功!";
public static readonly string INFO_Modifty="修改 {0} 成功!"; public static readonly string INFO_Modifty_Card="修改 {0} 成功!";
public static readonly string INFO_Addition="添加 {0} 成功!"; public static readonly string INFO_Addition_Card="添加 {0} 成功!";
public static readonly string INFO_NoChanged="卡片没有被修改!"; public static readonly string INFO_NoChanged="卡片没有被修改!";
public static readonly string ERROR_NoCard="没有卡片!"; public static readonly string ERROR_NoCard="没有卡片!";
public static readonly string WARN_NoSelectCDB="请打开一个数据库!"; public static readonly string ERROR_NoSelectCDB="请打开一个数据库!";
public static readonly string ERROR_FileNotExisit="文件不存在!\n{0}"; public static readonly string ERROR_Card_IsExisit="卡片已经存在!\n{0}";
public static readonly string ERROR_File_NotExisit="文件不存在!\n{0}";
public static readonly string ERROR_ModiftyFail="修改失败!"; public static readonly string ERROR_ModiftyFail="修改失败!";
public static readonly string ERROR_AdditionFail="修添加失败!"; public static readonly string ERROR_AdditionFail="修添加失败!";
public static readonly string ERROR_CardCodeIsZero="卡片密码必须大于0!"; public static readonly string ERROR_CardCodeIsZero="卡片密码必须大于0!";
public static readonly string ERROR_DeleteFail="删除失败!"; public static readonly string ERROR_DeleteFail="删除失败!";
public static readonly string QUES_CreateLua="是否创建脚本?\n{0}"; public static readonly string QUES_Create_Lua_="是否创建脚本?\n{0}";
public static readonly string QUES_DeleteCard="是否删除选择的{0}张卡?"; public static readonly string QUES_Delete_Card="是否删除卡片?\n{0}";
public static readonly string QUES_Delete_Cards="是否删除选择的{0}张卡?";
public static readonly string QUES_ReplaceCard="是否覆盖已经存在的卡片?";
public static readonly string STR_OpenCDB="选择卡片数据库(cdb文件)";
public static readonly string STR_SaveCDB="选择卡片数据库(cdb文件)保存位置";
public static readonly string STR_Openydk="选择卡组文件(ydk文件)";
public static readonly string STR_SelectImages="请选择卡片图像目录";
public static readonly string STR_CDBFilter="cdb文件(*.cdb)|*.cdb|所有文件(*.*)|*.*";
public static readonly string STR_ydkFilter="ydk文件(*.ydk)|*.ydk|所有文件(*.*)|*.*";
public static void Show(string strMsg) public static void Show(string strMsg)
{ {
MessageBox.Show(strMsg, "提示", MessageBox.Show(strMsg, "提示",
......
配置文件 ★卡片复制:
DataEditorX.txt 替换复制:如果存在卡片,就用最新的替换
不替换复制:如果存在卡片,就跳过
★卡片搜索
1.不支持系列名,ATK,DEF搜索
2.支持卡片名称,描述,规则,属性,等级,种族,卡片类型,效果类型,密码
3.密码范围搜索示例:
--大于密码10000000的卡片 卡片密码: 10000000 同名卡: -1
--小于密码10000000的卡片 卡片密码: -1 同名卡: 10000000
--大于密码10000000,小于20000000的卡片 卡片密码: 10000000 同名卡: 20000000
★配置文件
1.游戏目录 1.游戏目录
2.更新网址 2.更新网址
3.源码网址 3.源码网址
DataEditorX.txt
F:\game\YGOPRO F:\game\YGOPRO
http://247321453.ys168.com http://247321453.ys168.com
https://github.com/247321453/DataEditorX https://github.com/247321453/DataEditorX
\ No newline at end of file
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