Commit 785afac3 authored by keyongyu's avatar keyongyu

1.4.0.0

parent 7e8f6e5f
...@@ -52,7 +52,7 @@ public static string GetHtmlContentByUrl(string url) ...@@ -52,7 +52,7 @@ public static string GetHtmlContentByUrl(string url)
try { try {
HttpWebRequest httpWebRequest = HttpWebRequest httpWebRequest =
(HttpWebRequest)WebRequest.Create(url); (HttpWebRequest)WebRequest.Create(url);
httpWebRequest.Timeout = 5000; httpWebRequest.Timeout = 30000;
using(HttpWebResponse httpWebResponse = using(HttpWebResponse httpWebResponse =
(HttpWebResponse)httpWebRequest.GetResponse()) (HttpWebResponse)httpWebRequest.GetResponse())
{ {
......
...@@ -69,13 +69,13 @@ private void InitializeComponent() ...@@ -69,13 +69,13 @@ private void InitializeComponent()
this.tb_pleft = new System.Windows.Forms.TextBox(); this.tb_pleft = new System.Windows.Forms.TextBox();
this.tb_pright = new System.Windows.Forms.TextBox(); this.tb_pright = new System.Windows.Forms.TextBox();
this.lb_atkdef = new System.Windows.Forms.Label(); this.lb_atkdef = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label(); this.lb4 = new System.Windows.Forms.Label();
this.tb_page = new System.Windows.Forms.TextBox(); this.tb_page = new System.Windows.Forms.TextBox();
this.tb_pagenum = new System.Windows.Forms.TextBox(); this.tb_pagenum = new System.Windows.Forms.TextBox();
this.btn_PageUp = new System.Windows.Forms.Button(); this.btn_PageUp = new System.Windows.Forms.Button();
this.btn_PageDown = new System.Windows.Forms.Button(); this.btn_PageDown = new System.Windows.Forms.Button();
this.btn_add = new System.Windows.Forms.Button(); this.btn_add = new System.Windows.Forms.Button();
this.label5 = new System.Windows.Forms.Label(); this.lb5 = new System.Windows.Forms.Label();
this.tb_atk = new System.Windows.Forms.TextBox(); this.tb_atk = new System.Windows.Forms.TextBox();
this.tb_def = new System.Windows.Forms.TextBox(); this.tb_def = new System.Windows.Forms.TextBox();
this.lb_cardcode = new System.Windows.Forms.Label(); this.lb_cardcode = new System.Windows.Forms.Label();
...@@ -88,9 +88,7 @@ private void InitializeComponent() ...@@ -88,9 +88,7 @@ private void InitializeComponent()
this.btn_reset = new System.Windows.Forms.Button(); this.btn_reset = new System.Windows.Forms.Button();
this.btn_serach = new System.Windows.Forms.Button(); this.btn_serach = new System.Windows.Forms.Button();
this.lb_categorys = new System.Windows.Forms.Label(); this.lb_categorys = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label(); this.lb2 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
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.pl_image = new System.Windows.Forms.Panel(); this.pl_image = new System.Windows.Forms.Panel();
...@@ -409,15 +407,15 @@ private void InitializeComponent() ...@@ -409,15 +407,15 @@ private void InitializeComponent()
this.lb_atkdef.TabIndex = 7; this.lb_atkdef.TabIndex = 7;
this.lb_atkdef.Text = "ATK/DEF"; this.lb_atkdef.Text = "ATK/DEF";
// //
// label4 // lb4
// //
this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.lb4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label4.AutoSize = true; this.lb4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(102, 548); this.lb4.Location = new System.Drawing.Point(102, 548);
this.label4.Name = "label4"; this.lb4.Name = "lb4";
this.label4.Size = new System.Drawing.Size(11, 12); this.lb4.Size = new System.Drawing.Size(11, 12);
this.label4.TabIndex = 7; this.lb4.TabIndex = 7;
this.label4.Text = "/"; this.lb4.Text = "/";
// //
// tb_page // tb_page
// //
...@@ -467,7 +465,7 @@ private void InitializeComponent() ...@@ -467,7 +465,7 @@ private void InitializeComponent()
// //
// btn_add // btn_add
// //
this.btn_add.Location = new System.Drawing.Point(548, 540); this.btn_add.Location = new System.Drawing.Point(548, 539);
this.btn_add.Name = "btn_add"; this.btn_add.Name = "btn_add";
this.btn_add.Size = new System.Drawing.Size(84, 28); this.btn_add.Size = new System.Drawing.Size(84, 28);
this.btn_add.TabIndex = 5; this.btn_add.TabIndex = 5;
...@@ -475,14 +473,14 @@ private void InitializeComponent() ...@@ -475,14 +473,14 @@ private void InitializeComponent()
this.btn_add.UseVisualStyleBackColor = true; this.btn_add.UseVisualStyleBackColor = true;
this.btn_add.Click += new System.EventHandler(this.Btn_addClick); this.btn_add.Click += new System.EventHandler(this.Btn_addClick);
// //
// label5 // lb5
// //
this.label5.AutoSize = true; this.lb5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(491, 314); this.lb5.Location = new System.Drawing.Point(491, 314);
this.label5.Name = "label5"; this.lb5.Name = "lb5";
this.label5.Size = new System.Drawing.Size(11, 12); this.lb5.Size = new System.Drawing.Size(11, 12);
this.label5.TabIndex = 7; this.lb5.TabIndex = 7;
this.label5.Text = "/"; this.lb5.Text = "/";
// //
// tb_atk // tb_atk
// //
...@@ -545,7 +543,7 @@ private void InitializeComponent() ...@@ -545,7 +543,7 @@ private void InitializeComponent()
// //
// btn_mod // btn_mod
// //
this.btn_mod.Location = new System.Drawing.Point(638, 540); this.btn_mod.Location = new System.Drawing.Point(638, 539);
this.btn_mod.Name = "btn_mod"; this.btn_mod.Name = "btn_mod";
this.btn_mod.Size = new System.Drawing.Size(84, 28); this.btn_mod.Size = new System.Drawing.Size(84, 28);
this.btn_mod.TabIndex = 5; this.btn_mod.TabIndex = 5;
...@@ -556,7 +554,7 @@ private void InitializeComponent() ...@@ -556,7 +554,7 @@ private void InitializeComponent()
// btn_del // btn_del
// //
this.btn_del.ForeColor = System.Drawing.Color.DarkRed; this.btn_del.ForeColor = System.Drawing.Color.DarkRed;
this.btn_del.Location = new System.Drawing.Point(461, 540); this.btn_del.Location = new System.Drawing.Point(774, 540);
this.btn_del.Name = "btn_del"; this.btn_del.Name = "btn_del";
this.btn_del.Size = new System.Drawing.Size(84, 28); this.btn_del.Size = new System.Drawing.Size(84, 28);
this.btn_del.TabIndex = 5; this.btn_del.TabIndex = 5;
...@@ -567,7 +565,7 @@ private void InitializeComponent() ...@@ -567,7 +565,7 @@ private void InitializeComponent()
// btn_lua // btn_lua
// //
this.btn_lua.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(64)))), ((int)(((byte)(0))))); this.btn_lua.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(64)))), ((int)(((byte)(0)))));
this.btn_lua.Location = new System.Drawing.Point(776, 539); this.btn_lua.Location = new System.Drawing.Point(462, 539);
this.btn_lua.Name = "btn_lua"; this.btn_lua.Name = "btn_lua";
this.btn_lua.Size = new System.Drawing.Size(84, 28); this.btn_lua.Size = new System.Drawing.Size(84, 28);
this.btn_lua.TabIndex = 5; this.btn_lua.TabIndex = 5;
...@@ -606,28 +604,14 @@ private void InitializeComponent() ...@@ -606,28 +604,14 @@ private void InitializeComponent()
this.lb_categorys.Text = "Card Categorys"; this.lb_categorys.Text = "Card Categorys";
this.lb_categorys.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.lb_categorys.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
// //
// label2 // lb2
// //
this.label2.AutoSize = true; this.lb2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(317, 315); this.lb2.Location = new System.Drawing.Point(317, 315);
this.label2.Name = "label2"; this.lb2.Name = "lb2";
this.label2.Size = new System.Drawing.Size(11, 12); this.lb2.Size = new System.Drawing.Size(11, 12);
this.label2.TabIndex = 7; this.lb2.TabIndex = 7;
this.label2.Text = "/"; this.lb2.Text = "/";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(530, -168);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(281, 21);
this.textBox1.TabIndex = 4;
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(534, -235);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(281, 21);
this.textBox2.TabIndex = 4;
// //
// pl_cardtype // pl_cardtype
// //
...@@ -707,13 +691,13 @@ private void InitializeComponent() ...@@ -707,13 +691,13 @@ private void InitializeComponent()
this.Controls.Add(this.tb_cardalias); this.Controls.Add(this.tb_cardalias);
this.Controls.Add(this.tb_cardcode); this.Controls.Add(this.tb_cardcode);
this.Controls.Add(this.tb_atk); this.Controls.Add(this.tb_atk);
this.Controls.Add(this.label4); this.Controls.Add(this.lb4);
this.Controls.Add(this.lb_cardalias); this.Controls.Add(this.lb_cardalias);
this.Controls.Add(this.tb_pleft); this.Controls.Add(this.tb_pleft);
this.Controls.Add(this.lb_cardcode); this.Controls.Add(this.lb_cardcode);
this.Controls.Add(this.label5); this.Controls.Add(this.lb5);
this.Controls.Add(this.lb_atkdef); this.Controls.Add(this.lb_atkdef);
this.Controls.Add(this.label2); this.Controls.Add(this.lb2);
this.Controls.Add(this.lb_pleft_right); this.Controls.Add(this.lb_pleft_right);
this.Controls.Add(this.lb_scripttext); this.Controls.Add(this.lb_scripttext);
this.Controls.Add(this.btn_reset); this.Controls.Add(this.btn_reset);
...@@ -723,9 +707,7 @@ private void InitializeComponent() ...@@ -723,9 +707,7 @@ private void InitializeComponent()
this.Controls.Add(this.btn_mod); this.Controls.Add(this.btn_mod);
this.Controls.Add(this.btn_add); this.Controls.Add(this.btn_add);
this.Controls.Add(this.btn_PageDown); this.Controls.Add(this.btn_PageDown);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.btn_PageUp); this.Controls.Add(this.btn_PageUp);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.tb_cardtext); this.Controls.Add(this.tb_cardtext);
this.Controls.Add(this.tb_cardname); this.Controls.Add(this.tb_cardname);
this.Controls.Add(this.cb_setname3); this.Controls.Add(this.cb_setname3);
...@@ -756,8 +738,6 @@ private void InitializeComponent() ...@@ -756,8 +738,6 @@ private void InitializeComponent()
private System.Windows.Forms.ToolStripMenuItem menuitem_copyselectto; 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.TextBox textBox2;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label lb_tiptexts; private System.Windows.Forms.Label lb_tiptexts;
private System.Windows.Forms.Label lb_categorys; private System.Windows.Forms.Label lb_categorys;
private System.Windows.Forms.Label lb_types; private System.Windows.Forms.Label lb_types;
...@@ -774,15 +754,15 @@ private void InitializeComponent() ...@@ -774,15 +754,15 @@ private void InitializeComponent()
private System.Windows.Forms.Label lb_cardcode; private System.Windows.Forms.Label lb_cardcode;
private System.Windows.Forms.TextBox tb_def; private System.Windows.Forms.TextBox tb_def;
private System.Windows.Forms.TextBox tb_atk; private System.Windows.Forms.TextBox tb_atk;
private System.Windows.Forms.Label label5; private System.Windows.Forms.Label lb5;
private System.Windows.Forms.Button btn_add; private System.Windows.Forms.Button btn_add;
private System.Windows.Forms.Button btn_PageDown; private System.Windows.Forms.Button btn_PageDown;
private System.Windows.Forms.Button btn_PageUp; private System.Windows.Forms.Button btn_PageUp;
private System.Windows.Forms.TextBox tb_pagenum; private System.Windows.Forms.TextBox tb_pagenum;
private System.Windows.Forms.TextBox tb_page; private System.Windows.Forms.TextBox tb_page;
private System.Windows.Forms.Label label4; private System.Windows.Forms.Label lb4;
private System.Windows.Forms.Label lb_atkdef; private System.Windows.Forms.Label lb_atkdef;
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label lb2;
private System.Windows.Forms.TextBox tb_pright; private System.Windows.Forms.TextBox tb_pright;
private System.Windows.Forms.TextBox tb_pleft; private System.Windows.Forms.TextBox tb_pleft;
private System.Windows.Forms.Label lb_pleft_right; private System.Windows.Forms.Label lb_pleft_right;
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
using System.Windows.Forms; using System.Windows.Forms;
using DataEditorX.Core; using DataEditorX.Core;
using DataEditorX.Language;
namespace DataEditorX namespace DataEditorX
{ {
...@@ -44,7 +45,7 @@ public partial class DataEditForm : Form ...@@ -44,7 +45,7 @@ public partial class DataEditForm : Form
Dictionary<long, string> dicCardTypes=null; Dictionary<long, string> dicCardTypes=null;
Dictionary<long, string> dicCardcategorys=null; Dictionary<long, string> dicCardcategorys=null;
string conflang, confrule, confattribute, confrace, conflevel; string conflang, confrule, confattribute, confrace, conflevel;
string confsetname, conftype, confcategory, confcover; string confsetname, conftype, confcategory, confcover, confmsg;
public DataEditForm(string cdbfile) public DataEditForm(string cdbfile)
{ {
InitializeComponent(); InitializeComponent();
...@@ -59,17 +60,11 @@ public DataEditForm() ...@@ -59,17 +60,11 @@ public DataEditForm()
#endregion #endregion
#region 界面初始化 #region 界面初始化
//窗体第一次加载 //窗体第一次加载
void DataEditFormLoad(object sender, EventArgs e) void DataEditFormLoad(object sender, EventArgs e)
{ {
InitListRows(); InitListRows();
#if DEBUG
this.Text=this.Text+"(DEBUG)";
#endif
this.Text=this.Text+" Ver:"+Application.ProductVersion;
title=this.Text;
//界面初始化 //界面初始化
string dir=ConfigurationManager.AppSettings["language"]; string dir=ConfigurationManager.AppSettings["language"];
...@@ -80,8 +75,16 @@ void DataEditFormLoad(object sender, EventArgs e) ...@@ -80,8 +75,16 @@ void DataEditFormLoad(object sender, EventArgs e)
string datapath=Path.Combine(Application.StartupPath, dir); string datapath=Path.Combine(Application.StartupPath, dir);
InitPath(datapath); InitPath(datapath);
MyMsg.Init(conflang); LanguageHelper.InitForm(this, conflang);
InitString(); LanguageHelper.LoadMessage(confmsg);
LanguageHelper.SetLanguage(this);
this.Text=this.Text+" Ver:"+Application.ProductVersion;
title=this.Text;
#if DEBUG
this.Text=this.Text+"(DEBUG)";
#endif
InitGameData(); InitGameData();
...@@ -99,42 +102,13 @@ void DataEditFormLoad(object sender, EventArgs e) ...@@ -99,42 +102,13 @@ void DataEditFormLoad(object sender, EventArgs e)
//窗体关闭 //窗体关闭
void DataEditFormFormClosing(object sender, FormClosingEventArgs e) void DataEditFormFormClosing(object sender, FormClosingEventArgs e)
{ {
#if DEBUG
} LanguageHelper.GetLanguage(this);
LanguageHelper.SaveLanguage(this, conflang+"bak.txt");
//设置界面文字 LanguageHelper.SaveMessage(confmsg+"bak.txt");
void InitString() #endif
{
btn_add.Text=MyMsg.GetString("Add");
btn_serach.Text=MyMsg.GetString("Search");
btn_reset.Text=MyMsg.GetString("Reset");
btn_del.Text=MyMsg.GetString("Delete");
btn_mod.Text=MyMsg.GetString("Modify");
btn_lua.Text=MyMsg.GetString("Lua Script");
lb_cardalias.Text= MyMsg.GetString("Alias Card");
lb_cardcode.Text=MyMsg.GetString("Card Code");
lb_types.Text=MyMsg.GetString("Card Types");
lb_categorys.Text=MyMsg.GetString("Card Categorys");
lb_tiptexts.Text=MyMsg.GetString("Tips Texts");
menuitem_help.Text=MyMsg.GetString("Help");
menuitem_about.Text=MyMsg.GetString("About");
menuitem_checkupdate.Text=MyMsg.GetString("Check Update");
menuitem_github.Text=MyMsg.GetString("Source");
menuitem_file.Text=MyMsg.GetString("File");
menuitem_open.Text=MyMsg.GetString("Open Database");
menuitem_new.Text=MyMsg.GetString("New Database");
menuitem_readydk.Text=MyMsg.GetString("Cards Form ydk file");
menuitem_readimages.Text=MyMsg.GetString("Cards From Images");
menuitem_copyselectto.Text=MyMsg.GetString("Select Copy To");
menuitem_copyto.Text=MyMsg.GetString("All Now Copy To");
menuitem_quit.Text=MyMsg.GetString("Quit");
lv_cardlist.Columns[0].Text=MyMsg.GetString("Card Code");
lv_cardlist.Columns[1].Text=MyMsg.GetString("Card Name");
} }
//按cdb路径设置目录 //按cdb路径设置目录
void SetCDB(string cdb) void SetCDB(string cdb)
...@@ -164,6 +138,7 @@ void InitPath(string datapath) ...@@ -164,6 +138,7 @@ void InitPath(string datapath)
conftype=Path.Combine(datapath, "card-type.txt"); conftype=Path.Combine(datapath, "card-type.txt");
confcategory=Path.Combine(datapath, "card-category.txt"); confcategory=Path.Combine(datapath, "card-category.txt");
confcover= Path.Combine(datapath, "cover.jpg"); confcover= Path.Combine(datapath, "cover.jpg");
confmsg = Path.Combine(datapath, "message.txt");
} }
//保存dic //保存dic
...@@ -557,7 +532,7 @@ public bool Check() ...@@ -557,7 +532,7 @@ public bool Check()
return true; return true;
else else
{ {
MyMsg.Warning(MyMsg.GetString("Please select a DataBase!")); MyMsg.Warning(LMSG.NotSelectDataBase);
return false; return false;
} }
} }
...@@ -567,7 +542,7 @@ public bool Open(string cdbFile) ...@@ -567,7 +542,7 @@ public bool Open(string cdbFile)
{ {
if(!File.Exists(cdbFile)) if(!File.Exists(cdbFile))
{ {
MyMsg.Error(MyMsg.GetString("File is not exists!")); MyMsg.Error(LMSG.FileIsNotExists);
return false; return false;
} }
SetCDB(cdbFile); SetCDB(cdbFile);
...@@ -636,24 +611,24 @@ public bool AddCard() ...@@ -636,24 +611,24 @@ public bool AddCard()
Card c=GetCard(); Card c=GetCard();
if(c.id<=0) if(c.id<=0)
{ {
MyMsg.Error(MyMsg.GetString("Card Code is zero!")); MyMsg.Error(LMSG.CodeCanNotIsZero);
return false; return false;
} }
foreach(Card ckey in cardlist) foreach(Card ckey in cardlist)
{ {
if(c.id==ckey.id) if(c.id==ckey.id)
{ {
MyMsg.Warning(MyMsg.GetString("Card is exists!")); MyMsg.Warning(LMSG.ItIsExists);
return false; return false;
} }
} }
if(DataBase.Command(nowCdbFile, DataBase.GetInsertSQL(c,true))>=2) if(DataBase.Command(nowCdbFile, DataBase.GetInsertSQL(c,true))>=2)
{ {
MyMsg.Show(MyMsg.GetString("Add Card succeed")); MyMsg.Show(LMSG.AddSucceed);
Search(srcCard, true); Search(srcCard, true);
return true; return true;
} }
MyMsg.Error(MyMsg.GetString("Add Card fail")); MyMsg.Error(LMSG.AddFail);
return false; return false;
} }
//修改 //修改
...@@ -665,23 +640,22 @@ public bool ModCard() ...@@ -665,23 +640,22 @@ public bool ModCard()
if(c.Equals(oldCard)) if(c.Equals(oldCard))
{ {
MyMsg.Show(MyMsg.GetString("Card is not changed!")); MyMsg.Show(LMSG.ItIsNotChanged);
return false; return false;
} }
if(c.id<=0) if(c.id<=0)
{ {
MyMsg.Error(MyMsg.GetString("Card Code is zero")); MyMsg.Error(LMSG.CodeCanNotIsZero);
return false; return false;
} }
string sql; string sql;
if(c.id!=oldCard.id) if(c.id!=oldCard.id)
{ {
if(MyMsg.Question(string.Format( if(MyMsg.Question(LMSG.IfDeleteCard))
MyMsg.GetString("Delete Card {0} ?"),oldCard.ToString())))
{ {
if(DataBase.Command(nowCdbFile, DataBase.GetDeleteSQL(oldCard))<2) if(DataBase.Command(nowCdbFile, DataBase.GetDeleteSQL(oldCard))<2)
{ {
MyMsg.Error(MyMsg.GetString("Delete Card fail!")); MyMsg.Error(LMSG.DeleteFail);
return false; return false;
} }
} }
...@@ -691,11 +665,11 @@ public bool ModCard() ...@@ -691,11 +665,11 @@ public bool ModCard()
sql=DataBase.GetUpdateSQL(c); sql=DataBase.GetUpdateSQL(c);
if(DataBase.Command(nowCdbFile, sql)>0) if(DataBase.Command(nowCdbFile, sql)>0)
{ {
MyMsg.Show(MyMsg.GetString("Modify Card succeed!")); MyMsg.Show(LMSG.ModifySucceed);
Search(srcCard, true); Search(srcCard, true);
} }
else else
MyMsg.Error(MyMsg.GetString("Modify Card fail!")); MyMsg.Error(LMSG.ModifyFail);
return false; return false;
} }
//删除 //删除
...@@ -706,7 +680,7 @@ public bool DelCards() ...@@ -706,7 +680,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.GetString("Delete {0} Cards ?"),ic))) if(!MyMsg.Question(LMSG.IfDeleteCard))
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)
...@@ -720,13 +694,13 @@ public bool DelCards() ...@@ -720,13 +694,13 @@ public bool DelCards()
} }
if(DataBase.Command(nowCdbFile, sql.ToArray())>=(sql.Count*2)) if(DataBase.Command(nowCdbFile, sql.ToArray())>=(sql.Count*2))
{ {
MyMsg.Show(MyMsg.GetString("Delete Card succeed!")); MyMsg.Show(LMSG.DeleteSucceed);
Search(srcCard, true); Search(srcCard, true);
return true; return true;
} }
else else
{ {
MyMsg.Error(MyMsg.GetString("Delete Card fail!")); MyMsg.Error(LMSG.DeleteFail);
Search(srcCard, true); Search(srcCard, true);
} }
...@@ -740,8 +714,7 @@ public bool OpenScript() ...@@ -740,8 +714,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( if(MyMsg.Question(LMSG.IfCreateScript))
string.Format(MyMsg.GetString("create script file?{0}"),"\n"+lua)))
{ {
if(!Directory.Exists(LUAPTH)) if(!Directory.Exists(LUAPTH))
Directory.CreateDirectory(LUAPTH); Directory.CreateDirectory(LUAPTH);
...@@ -836,7 +809,7 @@ void Setscripttext(string str) ...@@ -836,7 +809,7 @@ void Setscripttext(string str)
} }
catch{ catch{
index=-1; index=-1;
MyMsg.Error(MyMsg.GetString("Please select script text!")); MyMsg.Error(LMSG.NotSelectScriptText);
} }
if(index>=0) if(index>=0)
{ {
...@@ -856,7 +829,7 @@ string Getscripttext() ...@@ -856,7 +829,7 @@ string Getscripttext()
} }
catch{ catch{
index=-1; index=-1;
MyMsg.Error(MyMsg.GetString("Please select script text!")); MyMsg.Error(LMSG.NotSelectScriptText);
} }
if(index>=0) if(index>=0)
return strs[index]; return strs[index];
...@@ -880,12 +853,11 @@ void Tb_edittextKeyPress(object sender, KeyPressEventArgs e) ...@@ -880,12 +853,11 @@ void Tb_edittextKeyPress(object sender, KeyPressEventArgs e)
#region 帮助菜单 #region 帮助菜单
void Menuitem_aboutClick(object sender, EventArgs e) void Menuitem_aboutClick(object sender, EventArgs e)
{ {
MyMsg.Show(string.Format( MyMsg.Show(
MyMsg.GetString("About:{0}Version:{1}Author:{2}Email:{3}") LanguageHelper.GetMsg(LMSG.About)+"\t"+Application.ProductName+"\n"
,"\t"+Application.ProductName+"\n" +LanguageHelper.GetMsg(LMSG.Version)+"\t"+Application.ProductVersion+"\n"
,"\t"+Application.ProductVersion+"\n" +LanguageHelper.GetMsg(LMSG.Author)+"\t247321453\n"
,"\t247321453\n" +"Email:\t247321453@qq.com");
,"\t247321453@qq.com"));
} }
void Menuitem_checkupdateClick(object sender, EventArgs e) void Menuitem_checkupdateClick(object sender, EventArgs e)
...@@ -909,8 +881,8 @@ void Menuitem_openClick(object sender, EventArgs e) ...@@ -909,8 +881,8 @@ void Menuitem_openClick(object sender, EventArgs e)
{ {
using(OpenFileDialog dlg=new OpenFileDialog()) using(OpenFileDialog dlg=new OpenFileDialog())
{ {
dlg.Title=MyMsg.GetString("Please select database."); dlg.Title=LanguageHelper.GetMsg(LMSG.SelectDataBasePath);
dlg.Filter=MyMsg.GetString("cdb file(*.cdb)|*.cdb|all files(*.*)|*.*"); dlg.Filter=LanguageHelper.GetMsg(LMSG.CdbType);
if(dlg.ShowDialog()==DialogResult.OK) if(dlg.ShowDialog()==DialogResult.OK)
{ {
Open(dlg.FileName); Open(dlg.FileName);
...@@ -921,19 +893,19 @@ void Menuitem_newClick(object sender, EventArgs e) ...@@ -921,19 +893,19 @@ void Menuitem_newClick(object sender, EventArgs e)
{ {
using(SaveFileDialog dlg=new SaveFileDialog()) using(SaveFileDialog dlg=new SaveFileDialog())
{ {
dlg.Title=MyMsg.GetString("Please select database."); dlg.Title=LanguageHelper.GetMsg(LMSG.SelectDataBasePath);
dlg.Filter=MyMsg.GetString("cdb file(*.cdb)|*.cdb|all files(*.*)|*.*"); dlg.Filter=LanguageHelper.GetMsg(LMSG.CdbType);
if(dlg.ShowDialog()==DialogResult.OK) if(dlg.ShowDialog()==DialogResult.OK)
{ {
if(DataBase.Create(dlg.FileName)) if(DataBase.Create(dlg.FileName))
{ {
if(MyMsg.Question(MyMsg.GetString("if open this new database?"))) if(MyMsg.Question(LMSG.IfOpenDataBase))
Open(dlg.FileName); Open(dlg.FileName);
} }
} }
} }
} }
void Menuitem_copytoClick(object sender, EventArgs e) void Menuitem_copytoClick(object sender, EventArgs e)
{ {
CopyTo(false); CopyTo(false);
...@@ -962,11 +934,11 @@ void CopyTo(bool onlyselect) ...@@ -962,11 +934,11 @@ void CopyTo(bool onlyselect)
cards.AddRange(cardlist.ToArray()); cards.AddRange(cardlist.ToArray());
using(OpenFileDialog dlg=new OpenFileDialog()) using(OpenFileDialog dlg=new OpenFileDialog())
{ {
dlg.Title=MyMsg.GetString("Please select database."); dlg.Title=LanguageHelper.GetMsg(LMSG.SelectDataBasePath);
dlg.Filter=MyMsg.GetString("cdb file(*.cdb)|*.cdb|all files(*.*)|*.*"); dlg.Filter=LanguageHelper.GetMsg(LMSG.CdbType);
if(dlg.ShowDialog()==DialogResult.OK) if(dlg.ShowDialog()==DialogResult.OK)
{ {
if(MyMsg.Question(MyMsg.GetString("Overwrite existing card?"))) if(MyMsg.Question(LMSG.IfReplaceExistingCard))
DataBase.CopyDB(dlg.FileName,false,cards.ToArray()); DataBase.CopyDB(dlg.FileName,false,cards.ToArray());
else else
DataBase.CopyDB(dlg.FileName,true,cards.ToArray()); DataBase.CopyDB(dlg.FileName,true,cards.ToArray());
...@@ -979,8 +951,8 @@ void Menuitem_readydkClick(object sender, EventArgs e) ...@@ -979,8 +951,8 @@ void Menuitem_readydkClick(object sender, EventArgs e)
return; return;
using(OpenFileDialog dlg=new OpenFileDialog()) using(OpenFileDialog dlg=new OpenFileDialog())
{ {
dlg.Title=MyMsg.GetString("Please select ydk file."); dlg.Title=LanguageHelper.GetMsg(LMSG.SelectYdkPath);
dlg.Filter=MyMsg.GetString("ydk file(*.ydk)|*.ydk|all files(*.*)|*.*"); dlg.Filter=LanguageHelper.GetMsg(LMSG.ydkType);
if(dlg.ShowDialog()==DialogResult.OK) if(dlg.ShowDialog()==DialogResult.OK)
{ {
SetCards(DataBase.ReadYdk(nowCdbFile, dlg.FileName), false); SetCards(DataBase.ReadYdk(nowCdbFile, dlg.FileName), false);
...@@ -994,7 +966,7 @@ void Menuitem_readimagesClick(object sender, EventArgs e) ...@@ -994,7 +966,7 @@ void Menuitem_readimagesClick(object sender, EventArgs e)
return; return;
using(FolderBrowserDialog fdlg=new FolderBrowserDialog()) using(FolderBrowserDialog fdlg=new FolderBrowserDialog())
{ {
fdlg.Description= MyMsg.GetString("Please select images directory"); fdlg.Description= LanguageHelper.GetMsg(LMSG.SelectImagePath);
if(fdlg.ShowDialog()==DialogResult.OK) if(fdlg.ShowDialog()==DialogResult.OK)
{ {
SetCards(DataBase.ReadImage(nowCdbFile, fdlg.SelectedPath), false); SetCards(DataBase.ReadImage(nowCdbFile, fdlg.SelectedPath), false);
...@@ -1025,9 +997,9 @@ void BackgroundWorker1RunWorkerCompleted(object sender, System.ComponentModel.Ru ...@@ -1025,9 +997,9 @@ void BackgroundWorker1RunWorkerCompleted(object sender, System.ComponentModel.Ru
if(isdownload) if(isdownload)
{ {
if(CheckUpdate.isOK) if(CheckUpdate.isOK)
MyMsg.Show(MyMsg.GetString("Download succeed.")); MyMsg.Show(LMSG.DownloadSucceed);
else else
MyMsg.Show(MyMsg.GetString("Download fail.")+"\n"+CheckUpdate.URL); MyMsg.Show(LMSG.DownloadFail);
} }
else else
{ {
...@@ -1037,9 +1009,7 @@ void BackgroundWorker1RunWorkerCompleted(object sender, System.ComponentModel.Ru ...@@ -1037,9 +1009,7 @@ void BackgroundWorker1RunWorkerCompleted(object sender, System.ComponentModel.Ru
int.TryParse(newver.Replace(".",""), out iver2); int.TryParse(newver.Replace(".",""), out iver2);
if(iver2>iver) if(iver2>iver)
{ {
if(MyMsg.Question(string.Format( if(MyMsg.Question(LMSG.HaveNewVersion))
MyMsg.GetString("have a new version.{0}version:{1}"),
"\n",newver)))
{ {
if(!backgroundWorker1.IsBusy) if(!backgroundWorker1.IsBusy)
{ {
...@@ -1054,9 +1024,7 @@ void BackgroundWorker1RunWorkerCompleted(object sender, System.ComponentModel.Ru ...@@ -1054,9 +1024,7 @@ void BackgroundWorker1RunWorkerCompleted(object sender, System.ComponentModel.Ru
{ {
if(!isbgcheck) if(!isbgcheck)
{ {
if( MyMsg.Question(string.Format( if( MyMsg.Question(LMSG.NowIsNewVersion))
MyMsg.GetString("Is Last Version.{0}Version:{1}"),
"\n",newver+"\n")))
{ {
if(!backgroundWorker1.IsBusy) if(!backgroundWorker1.IsBusy)
...@@ -1071,7 +1039,7 @@ void BackgroundWorker1RunWorkerCompleted(object sender, System.ComponentModel.Ru ...@@ -1071,7 +1039,7 @@ void BackgroundWorker1RunWorkerCompleted(object sender, System.ComponentModel.Ru
else else
{ {
if(!isbgcheck) if(!isbgcheck)
MyMsg.Error(MyMsg.GetString("Check update fail!")); MyMsg.Error(LMSG.CheckUpdateFail);
} }
} }
} }
......
...@@ -56,7 +56,6 @@ ...@@ -56,7 +56,6 @@
<ItemGroup> <ItemGroup>
<Compile Include="Common\CheckUpdate.cs" /> <Compile Include="Common\CheckUpdate.cs" />
<Compile Include="Common\DoubleContorl.cs" /> <Compile Include="Common\DoubleContorl.cs" />
<Compile Include="Common\MyMsg.cs" />
<Compile Include="Core\Card.cs" /> <Compile Include="Core\Card.cs" />
<Compile Include="Core\DataBase.cs" /> <Compile Include="Core\DataBase.cs" />
<Compile Include="Core\DataManager.cs" /> <Compile Include="Core\DataManager.cs" />
...@@ -64,6 +63,9 @@ ...@@ -64,6 +63,9 @@
<Compile Include="DataEditForm.Designer.cs"> <Compile Include="DataEditForm.Designer.cs">
<DependentUpon>DataEditForm.cs</DependentUpon> <DependentUpon>DataEditForm.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Language\LanguageHelper.cs" />
<Compile Include="Language\LMsg.cs" />
<Compile Include="Language\MyMsg.cs" />
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
...@@ -77,6 +79,7 @@ ...@@ -77,6 +79,7 @@
<Folder Include="Core" /> <Folder Include="Core" />
<Folder Include="en" /> <Folder Include="en" />
<Folder Include="Common" /> <Folder Include="Common" />
<Folder Include="Language" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="app.config"> <None Include="app.config">
...@@ -109,6 +112,9 @@ ...@@ -109,6 +112,9 @@
<None Include="chs\language.txt"> <None Include="chs\language.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="chs\message.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="en\card-attribute.txt"> <None Include="en\card-attribute.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
...@@ -136,6 +142,9 @@ ...@@ -136,6 +142,9 @@
<None Include="en\language.txt"> <None Include="en\language.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="en\message.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="readme.txt"> <None Include="readme.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
......
/*
* 由SharpDevelop创建。
* 用户: Acer
* 日期: 7月8 星期二
* 时间: 10:21
*
*/
using System;
namespace DataEditorX.Language
{
public enum LMSG : uint
{
titleInfo=0,
titleError,
titleWarning,
titleQuestion,
CreateSucceed,
CreateFail,
AddSucceed,
AddFail,
CodeCanNotIsZero,
ItIsExists,
ItIsNotChanged,
IfDeleteCard,
IfCreateScript,
IfOpenDataBase,
IfReplaceExistingCard,
NowIsNewVersion,
CheckUpdateFail,
HaveNewVersion,
FileIsNotExists,
NotSelectDataBase,
SelectDataBasePath,
SelectYdkPath,
SelectImagePath,
DownloadSucceed,
DownloadFail,
NotSelectScriptText,
DeleteSucceed,
DeleteFail,
ModifySucceed,
ModifyFail,
About,
Version,
Author,
CdbType,
ydkType,
COUNT,
}
}
/*
* 由SharpDevelop创建。
* 用户: Acer
* 日期: 7月8 星期二
* 时间: 9:52
*
*/
using System;
using System.IO;
using System.Text;
using System.Globalization;
using System.Collections.Generic;
using System.Windows.Forms;
namespace DataEditorX.Language
{
/// <summary>
/// Description of Language.
/// </summary>
public static class LanguageHelper
{
static Dictionary<Form, SortedList<string, string>> wordslist;
static SortedList<LMSG, string> msglist;
static string SEP="->";
static LanguageHelper()
{
wordslist=new Dictionary<Form, SortedList<string, string>>();
msglist=new SortedList<LMSG, string>();
}
public static void InitForm(Form fm, string langfile)
{
if(!wordslist.ContainsKey(fm))
{
wordslist.Add(fm, LoadLanguage(langfile));
}
}
/// <summary>
/// 获取消息文字
/// </summary>
/// <param name="lMsg"></param>
/// <returns></returns>
public static string GetMsg(LMSG lMsg)
{
if(msglist.IndexOfKey(lMsg)>=0)
return msglist[lMsg];
return lMsg.ToString();
}
#region 设置控件信息
/// <summary>
/// 设置控件文字
/// </summary>
/// <param name="fm"></param>
public static bool SetLanguage(Form fm)
{
if(wordslist.ContainsKey(fm))
{
SortedList<string, string> list=wordslist[fm];
SetText(fm, list);
return true;
}
return false;
}
static void SetText(Control c, SortedList<string, string> list)
{
if ( c is ListView )
{
ListView lv = (ListView)c;
int i,count=lv.Columns.Count;
for(i=0;i<count;i++)
{
ColumnHeader cn=lv.Columns[i];
string v;
list.TryGetValue(lv.Name+i.ToString(), out v);
if(!string.IsNullOrEmpty(v))
cn.Text = v;
}
}
else if ( c is ToolStrip)
{
ToolStrip ms = (ToolStrip)c;
foreach ( ToolStripItem tsi in ms.Items )
{
SetMenuItem(tsi, list);
}
}
else
{
string v;
list.TryGetValue(c.Name, out v);
if(!string.IsNullOrEmpty(v))
c.Text = v;
}
if ( c.Controls.Count > 0 )
{
foreach ( Control sc in c.Controls )
{
SetText(sc, list);
}
}
ContextMenuStrip conms=c.ContextMenuStrip;
if ( conms!=null )
{
foreach ( ToolStripItem ts in conms.Items )
{
SetMenuItem(ts, list);
}
}
}
static void SetMenuItem(ToolStripItem tsi, SortedList<string, string> list)
{
if ( tsi is ToolStripMenuItem )
{
ToolStripMenuItem tsmi = (ToolStripMenuItem)tsi;
string v;
list.TryGetValue(tsmi.Name, out v);
if(!string.IsNullOrEmpty(v))
tsmi.Text = v;
if(tsmi.HasDropDownItems)
{
foreach ( ToolStripItem subtsi in tsmi.DropDownItems )
{
if ( subtsi is ToolStripMenuItem )
{
ToolStripMenuItem ts2 = (ToolStripMenuItem)subtsi;
SetMenuItem(ts2, list);
}
}
}
}
else if ( tsi is ToolStripLabel )
{
ToolStripLabel tlbl=(ToolStripLabel)tsi;
string v;
list.TryGetValue(tlbl.Name, out v);
if(!string.IsNullOrEmpty(v))
tlbl.Text = v;
}
}
#endregion
#region 获取控件信息
/// <summary>
/// 获取控件名
/// </summary>
/// <param name="fm"></param>
public static void GetLanguage(Form fm)
{
SortedList<string, string> list=new SortedList<string, string>();
GetText(fm, list);
if(wordslist.ContainsKey(fm))
wordslist[fm]=list;
else
wordslist.Add(fm, list);
}
static void GetText(Control c, SortedList<string, string> list)
{
if ( c is ListView )
{
ListView lv = (ListView)c;
int i,count=lv.Columns.Count;
for(i=0;i<count;i++)
{
ColumnHeader cn=lv.Columns[i];
if ( list.ContainsKey(lv.Name+i.ToString()) )
list[cn.Name]=cn.Text;
else
list.Add(lv.Name+i.ToString(), cn.Text);
}
}
else if ( c is ToolStrip)
{
ToolStrip ms = (ToolStrip)c;
foreach ( ToolStripItem tsi in ms.Items )
{
GetMenuItem(tsi, list);
}
}
else
{
if(list.ContainsKey(c.Name))
list[c.Name]=c.Text;
else
list.Add(c.Name, c.Text);
}
if ( c.Controls.Count > 0 )
{
foreach ( Control sc in c.Controls )
{
GetText(sc, list);
}
}
ContextMenuStrip conms=c.ContextMenuStrip;
if ( conms!=null )
{
foreach ( ToolStripItem ts in conms.Items )
{
GetMenuItem(ts, list);
}
}
}
static void GetMenuItem(ToolStripItem tsi, SortedList<string, string> list)
{
if ( tsi is ToolStripMenuItem )
{
ToolStripMenuItem tsmi = (ToolStripMenuItem)tsi;
if(list.ContainsKey(tsmi.Name))
list[tsi.Name] = tsmi.Text;
else
list.Add(tsi.Name, tsmi.Text);
if(tsmi.HasDropDownItems)
{
foreach ( ToolStripItem subtsi in tsmi.DropDownItems )
{
if ( subtsi is ToolStripMenuItem )
{
ToolStripMenuItem ts2 = (ToolStripMenuItem)subtsi;
GetMenuItem(ts2, list);
}
}
}
}
else if ( tsi is ToolStripLabel )
{
ToolStripLabel tlbl=(ToolStripLabel)tsi;
if(list.ContainsKey(tlbl.Name))
list[tlbl.Name] = tlbl.Text;
else
list.Add(tlbl.Name, tlbl.Text);
}
}
#endregion
#region 保存语言文件
public static bool SaveLanguage(Form fm, string f)
{
if(!wordslist.ContainsKey(fm))
return false;
SortedList<string, string> fmlist=wordslist[fm];
using(FileStream fs=new FileStream(f, FileMode.Create, FileAccess.Write))
{
StreamWriter sw=new StreamWriter(fs, Encoding.UTF8);
foreach(string k in fmlist.Keys)
{
sw.WriteLine(fm.Name+SEP+k+" "+fmlist[k]);
}
sw.Close();
fs.Close();
}
return true;
}
public static bool SaveMessage(string f)
{
using(FileStream fs=new FileStream(f, FileMode.Create, FileAccess.Write))
{
StreamWriter sw=new StreamWriter(fs, Encoding.UTF8);
foreach(LMSG k in msglist.Keys)
{
sw.WriteLine("0x"+((uint)k).ToString("x")+" "+msglist[k].Replace("\n","/n"));
}
foreach ( LMSG k in Enum.GetValues(typeof(LMSG)))
{
if(!msglist.ContainsKey(k))
sw.WriteLine("0x"+((uint)k).ToString("x")+" "+k.ToString());
}
sw.Close();
fs.Close();
}
return true;
}
#endregion
#region 加载语言文件
public static SortedList<string, string> LoadLanguage(string f)
{
SortedList<string, string> list=new SortedList<string, string>();
if(File.Exists(f))
{
using(FileStream fs=new FileStream(f, FileMode.Open, FileAccess.Read))
{
StreamReader sr=new StreamReader(fs, Encoding.UTF8);
string line,sk,v;
while((line=sr.ReadLine())!=null)
{
if(!line.StartsWith("#"))
{
int ss=line.IndexOf(SEP);
int si=(ss>0)?line.IndexOf(" "):-1;
if(si>0)
{
sk=line.Substring(ss+SEP.Length,si-ss-SEP.Length);
v=line.Substring(si+1);
if(!list.ContainsKey(sk))
list.Add(sk,v);
}
}
}
sr.Close();
fs.Close();
}
}
return list;
}
public static void LoadMessage(string f)
{
if(File.Exists(f))
{
msglist.Clear();
using(FileStream fs=new FileStream(f, FileMode.Open, FileAccess.Read))
{
StreamReader sr=new StreamReader(fs, Encoding.UTF8);
string line,sk,v;
uint utemp;
LMSG ltemp;
while((line=sr.ReadLine())!=null)
{
if(!line.StartsWith("#"))
{
int si=line.IndexOf(" ");
if(si>0)
{
sk=line.Substring(0,si);
v=line.Substring(si+1);
if(sk.StartsWith("0x"))
uint.TryParse(sk.Replace("0x",""), NumberStyles.HexNumber, null, out utemp);
else
uint.TryParse(sk, out utemp);
ltemp=(LMSG)utemp;
if(msglist.IndexOfKey(ltemp)<0)
msglist.Add(ltemp, v.Replace("/n","\n"));
}
}
}
sr.Close();
fs.Close();
}
}
}
#endregion
}
}
...@@ -12,71 +12,63 @@ ...@@ -12,71 +12,63 @@
using System.Configuration; using System.Configuration;
using System.Collections.Generic; using System.Collections.Generic;
namespace DataEditorX namespace DataEditorX.Language
{ {
/// <summary> /// <summary>
/// 消息 /// 消息
/// </summary> /// </summary>
public static class MyMsg public static class MyMsg
{ {
static Dictionary<string ,string> strDic=new Dictionary<string,string>(); static string info, warning, error, question;
public static bool Init(string file) static MyMsg()
{ {
if(!File.Exists(file)) info = LanguageHelper.GetMsg(LMSG.titleInfo);
return false; warning = LanguageHelper.GetMsg(LMSG.titleWarning);
strDic.Clear(); error = LanguageHelper.GetMsg(LMSG.titleError);
using(FileStream fs=new FileStream(file,FileMode.Open, FileAccess.Read)) question = LanguageHelper.GetMsg(LMSG.titleQuestion);
{
StreamReader sr=new StreamReader(fs,Encoding.UTF8);
string line;
string k,v;
while((line=sr.ReadLine())!=null)
{
if(!string.IsNullOrEmpty(line)&&!line.StartsWith("!"))
{
int l=line.IndexOf(" ");
if(l>0)
{
k=line.Substring(0,l);
v=line.Substring(l+1);
if(!strDic.ContainsKey(k))
strDic.Add(k,v);
}
}
}
sr.Close();
fs.Close();
}
return true;
}
public static string GetString(string keyStr)
{
//string str=ConfigurationManager.AppSettings[keyStr];
string str=keyStr;
if(strDic.ContainsKey(keyStr))
str=strDic[keyStr];
if(string.IsNullOrEmpty(str))
return keyStr;
return str;
} }
public static void Show(string strMsg) public static void Show(string strMsg)
{ {
MessageBox.Show(strMsg, GetString("info"), MessageBox.Show(strMsg, info,
MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
public static void Warning(string strWarn) public static void Warning(string strWarn)
{ {
MessageBox.Show(strWarn, GetString("warning"), MessageBox.Show(strWarn, warning,
MessageBoxButtons.OK, MessageBoxIcon.Warning); MessageBoxButtons.OK, MessageBoxIcon.Warning);
} }
public static void Error(string strError) public static void Error(string strError)
{ {
MessageBox.Show(strError, GetString("error"), MessageBox.Show(strError, error,
MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
public static bool Question(string strQues) public static bool Question(string strQues)
{ {
if(MessageBox.Show(strQues, GetString("question"), if(MessageBox.Show(strQues, question,
MessageBoxButtons.OKCancel,
MessageBoxIcon.Question)==DialogResult.OK)
return true;
else
return false;
}
public static void Show(LMSG msg)
{
MessageBox.Show(LanguageHelper.GetMsg(msg), info,
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
public static void Warning(LMSG msg)
{
MessageBox.Show(LanguageHelper.GetMsg(msg), warning,
MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
public static void Error(LMSG msg)
{
MessageBox.Show(LanguageHelper.GetMsg(msg), error,
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
public static bool Question(LMSG msg)
{
if(MessageBox.Show(LanguageHelper.GetMsg(msg), question,
MessageBoxButtons.OKCancel, MessageBoxButtons.OKCancel,
MessageBoxIcon.Question)==DialogResult.OK) MessageBoxIcon.Question)==DialogResult.OK)
return true; return true;
......
...@@ -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.3.4.2")] [assembly: AssemblyVersion("1.4.0.0")]
!chs DataEditForm->btn_add 添加(&A)
info 提示 DataEditForm->btn_del 删除(&D)
error 错误 DataEditForm->btn_lua 脚本(&L)
warning 警告 DataEditForm->btn_mod 修改(&M)
DataEditForm->btn_PageDown 下一页
question 询问 DataEditForm->btn_PageUp 上一页
DataEditForm->btn_reset 重置(&R)
Add 添加卡片 DataEditForm->btn_serach 搜索(&S)
Modify 修改卡片 DataEditForm->DataEditForm DataEditorX by 247321453
Delete 删除卡片 DataEditForm->lb_atkdef ATK/DEF
Lua Script lua脚本 DataEditForm->lb_cardalias 同名卡
Search 搜索 DataEditForm->lb_cardcode 卡片密码
Reset 重置 DataEditForm->lb_categorys 效果种类
DataEditForm->lb_pleft_right PScale
Alias Card 同名卡 DataEditForm->lb_scripttext
Card Code 卡片密码 DataEditForm->lb_tiptexts 提示文字
Card Types 卡片种类 DataEditForm->lb_types 卡片种类
Card Categorys 效果种类 DataEditForm->lb2 /
Tips Texts 提示文字 DataEditForm->lb4 /
DataEditForm->lb5 /
Help 帮助(&H) DataEditForm->lv_cardlist0 卡片密码
About 关于 DataEditForm->lv_cardlist1 卡片名称
Check Update 检查更新 DataEditForm->menuitem_about 关于(&A)
Source 源码主页 DataEditForm->menuitem_checkupdate 检查更新
DataEditForm->menuitem_copyselectto 选中卡片复制到...
File 文件(&F) DataEditForm->menuitem_copyto 当前所有卡片复制到...
Card Name 卡片名称 DataEditForm->menuitem_file 文件(&F)
DataEditForm->menuitem_github 源码主页
Open Database 打开 DataEditForm->menuitem_help 帮助(&H)
New Database 新建 DataEditForm->menuitem_new 新建(&N)
Cards Form ydk file 从ydk文件读取 DataEditForm->menuitem_open 打开(&O)
Cards From Images 从图像文件夹读取 DataEditForm->menuitem_quit 退出(&Q)
Select Copy To 选中卡片复制到... DataEditForm->menuitem_readimages 从图像文件夹读取
All Now Copy To 当前所有卡片复制到... DataEditForm->menuitem_readydk 从ydk文件读取
\ No newline at end of file
Quit 退出
Is Last Version.{0}Version:{1} 已经是最新版本!{0}版本号:{1}是否重新下载?
Check update fail! 查询失败!
have a new version.{0}version:{1} 发现一个新版本。是否下载?{0}版本号{1}
Download succeed. 下载成功。
Download fail. 下载失败。
if open this new database? 是否打开新建的数据库?
Please select a DataBase! 请打开一个数据库!
File is not exists! 文件不存在!
Card is exists! 卡片已经存在!
Add Card succeed! 添加成功!
Add Card fail! 添加失败!
Delete Card {0} ? 是否删除卡片 {0}?
Delete {0} Cards ? 是否删除 {0} 张卡片?
Delete Card succeed! 删除成功!
Delete Card fail! 删除失败!
Card is not changed! 卡片没有被修改!
Modify Card succeed! 修改成功!
Modify Card fail! 修改失败!
Please select script text! 请选中脚本文本!
create script file?{0} 是否创建脚本文件?{0}
Card Code is zero! 卡片密码必须大于0!
Please select images directory! 请选择一个图像文件夹!
Please select ydk file. 选择卡组文件(ydk文件)
ydk file(*.ydk)|*.ydk|all files(*.*)|*.* ydk文件(*.ydk)|*.ydk|所有文件(*.*)|*.*
Overwrite existing card? 是否覆盖已经存在的卡片?
Please select database. 请选择数据库(*.cdb)
cdb file(*.cdb)|*.cdb|all files(*.*)|*.* cdb文件(*.cdb)|*.cdb|所有文件(*.*)|*.*
About:{0}Version:{1}Author:{2}Email:{3} 关于:{0}版本:{1}作者:{2}邮箱:{3}
\ No newline at end of file
0x0 提示
0x1 错误
0x2 警告
0x3 询问
0x4 创建成功!
0x5 创建失败!
0x6 添加成功!
0x7 添加失败!
0x8 密码不能为0!
0x9 已经存在!
0xa 内容没有改变。
0xb 是否删除卡片?
0xc 是否创建脚本文件?
0xd 是否打开数据库?
0xe 是否替换已经存在的卡片?
0xf 已经是最新版本了。/n需要重新下载,请点击“确定”重新下载。
0x10 检查更新失败,请检查网络。
0x11 发现新的版本,是否更新?
0x12 文件不存在!
0x13 没有选择数据库!
0x14 选择数据库文件
0x15 选择ydk文件
0x16 选择图像目录
0x17 下载成功!
0x18 下载失败!
0x19 没有选中脚本文本!
0x1a 删除成功!
0x1b 删除失败!
0x1c 修改成功!
0x1d 修改失败!
0x1e 关于:
0x1f 版本:
0x20 作者:
0x21 cdb文件(*.cdb)|*.cdb|所有文件(*.*)|*.*
0x22 ydk文件(*.ydk)|*.ydk|所有文件(*.*)|*.*
!english DataEditForm->btn_add Add
info Info DataEditForm->btn_del Delte
error Error DataEditForm->btn_lua Lua
warning Warning DataEditForm->btn_mod Modify
DataEditForm->btn_PageDown >>
question Question DataEditForm->btn_PageUp <<
DataEditForm->btn_reset Rest
Add Add DataEditForm->btn_serach Search
Modify &Modify DataEditForm->DataEditForm DataEditorX by 247321453
Delete &Delete DataEditForm->lb_atkdef ATK/DEF
Lua Script &Lua Script DataEditForm->lb_cardalias Alias
Search &Search DataEditForm->lb_cardcode Card Code
Reset &Reset DataEditForm->lb_categorys Category
DataEditForm->lb_pleft_right PScale
Alias Card Alias Card DataEditForm->lb_scripttext
Card Code Card Code DataEditForm->lb_tiptexts TipText
Card Types Card Types DataEditForm->lb_types Card Type
Card Categorys Card Categorys DataEditForm->lb2 /
Tips Texts Tips Texts DataEditForm->lb4 /
DataEditForm->lb5 /
Help &Help DataEditForm->lv_cardlist0 Card Code
About About DataEditForm->lv_cardlist1 Card Name
Check Update Check Update DataEditForm->menuitem_about About
Source Source DataEditForm->menuitem_checkupdate Check Update
DataEditForm->menuitem_copyselectto Slect Cards Copy To...
File &File DataEditForm->menuitem_copyto Now All Cards Copy To...
Card Name Card Name DataEditForm->menuitem_file File
DataEditForm->menuitem_github Github
Open Database Open Database DataEditForm->menuitem_help Help
New Database New Database DataEditForm->menuitem_new New
Cards Form ydk file Cards Form ydk file DataEditForm->menuitem_open Open
Cards From Images Cards From Images DataEditForm->menuitem_quit Quit
Select Copy To Select Copy To... DataEditForm->menuitem_readimages Read for Image Folder
All Now Copy To All Now Copy To... DataEditForm->menuitem_readydk Read for ydk file
\ No newline at end of file
Quit &Quit
Is Last Version.{0}Version:{1} Is Last Version.{0}Version:{1}
Check update fail! check update fail
have a new version.{0}version:{1} have a new version.{0}version:{1}
Download succeed. Download succeed.
if open this new database? If open this new database?
Please select a DataBase! Please select a DataBase!
File is not exists! File is not exists!
Card is exists! Card is exists!
Add Card succeed! Add Card succeed!
Add Card fail! Add Card fail!
Delete Card {0} ? Delete Card {0} ?
Delete {0} Cards ? Delete {0} Cards ?
Delete Card succeed! Delete Card succeed!
Delete Card fail! Delete Card fail!
Card is not changed! Card is not changed!
Modify Card succeed! Modify Card succeed!
Modify Card fail! Modify Card fail!
Please select script text! Please select script text!
create script file?{0} create script file?{0}
Card Code is zero! Card Code is zero!
Please select images directory! Please select images directory!
Please select ydk file. Please select ydk file.
ydk file(*.ydk)|*.ydk|all files(*.*)|*.* ydk file(*.ydk)|*.ydk|all files(*.*)|*.*
Overwrite existing card? Overwrite existing card?
Please select database. Please select database.
cdb file(*.cdb)|*.cdb|all files(*.*)|*.* cdb file(*.cdb)|*.cdb|all files(*.*)|*.*
About:{0}Version:{1}Author:{2}Email:{3} About:{0}Version:{1}Author:{2}Email:{3}
\ No newline at end of file
0x0 Info
0x1 Error
0x2 Warning
0x3 Question
0x4 Create succeed!
0x5 Create fail!
0x6 Add succeed!
0x7 Add fail!
0x8 Code can't is 0!
0x9 It's exitis!
0xa It's no changed.
0xb If delete Card(s)?
0xc If create script file?
0xd If open databse?
0xe If replace exitis cards?
0xf It's new version.
0x10 Check update fail,/nPlease Check Network.
0x11 Find a new version,/nIf Download it?
0x12 File is't exitis!
0x13 No select database!
0x14 select database file
0x15 select ydk file
0x16 selcet image folder
0x17 Download succeed!
0x18 Download fail!
0x19 No slect script text!
0x1a Delete succeed!
0x1b Delete fail!
0x1c Modify succeed!
0x1d Modify fail!
0x1e About :
0x1f Version:
0x20 Author :
0x21 cdb file(*.cdb)|*.cdb|all files(*.*)|*.*
0x22 ydk file(*.ydk)|*.ydk|all files(*.*)|*.*
[DataEditorX]1.3.4.2[DataEditorX] [DataEditorX]1.4.0.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]
★支持关联cdb文件,命令参数启动。 ★支持关联cdb文件,命令参数启动。
...@@ -41,6 +41,8 @@ DataEditorX.exe.config ...@@ -41,6 +41,8 @@ DataEditorX.exe.config
描述不详细的bug,我修复不了。(都不知道是bug是什么) 描述不详细的bug,我修复不了。(都不知道是bug是什么)
★更新历史 ★更新历史
1.4.0.0
增加多语言文件的可修改性。
1.3.4.2 1.3.4.2
新建数据库,改为提示是否打开。 新建数据库,改为提示是否打开。
打开空白数据库,将会清空当前列表和内容。 打开空白数据库,将会清空当前列表和内容。
......
No preview for this file type
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
System.Configuration.ConfigurationManager.AppSettings[key] System.Configuration.ConfigurationManager.AppSettings[key]
--> -->
<!-- language directory --> <!-- language directory -->
<add key="language" value="chs" /> <add key="language" value="en" />
<!-- DataEditorX source code --> <!-- DataEditorX source code -->
<add key="sourceURL" value="https://github.com/247321453/DataEditorX" /> <add key="sourceURL" value="https://github.com/247321453/DataEditorX" />
<!-- DataEditorX update url--> <!-- DataEditorX update url-->
......
!chs DataEditForm->btn_add 添加(&A)
info 提示 DataEditForm->btn_del 删除(&D)
error 错误 DataEditForm->btn_lua 脚本(&L)
warning 警告 DataEditForm->btn_mod 修改(&M)
DataEditForm->btn_PageDown 下一页
question 询问 DataEditForm->btn_PageUp 上一页
DataEditForm->btn_reset 重置(&R)
Add 添加卡片 DataEditForm->btn_serach 搜索(&S)
Modify 修改卡片 DataEditForm->DataEditForm DataEditorX by 247321453
Delete 删除卡片 DataEditForm->lb_atkdef ATK/DEF
Lua Script lua脚本 DataEditForm->lb_cardalias 同名卡
Search 搜索 DataEditForm->lb_cardcode 卡片密码
Reset 重置 DataEditForm->lb_categorys 效果种类
DataEditForm->lb_pleft_right PScale
Alias Card 同名卡 DataEditForm->lb_scripttext
Card Code 卡片密码 DataEditForm->lb_tiptexts 提示文字
Card Types 卡片种类 DataEditForm->lb_types 卡片种类
Card Categorys 效果种类 DataEditForm->lb2 /
Tips Texts 提示文字 DataEditForm->lb4 /
DataEditForm->lb5 /
Help 帮助(&H) DataEditForm->lv_cardlist0 卡片密码
About 关于 DataEditForm->lv_cardlist1 卡片名称
Check Update 检查更新 DataEditForm->menuitem_about 关于(&A)
Source 源码主页 DataEditForm->menuitem_checkupdate 检查更新
DataEditForm->menuitem_copyselectto 选中卡片复制到...
File 文件(&F) DataEditForm->menuitem_copyto 当前所有卡片复制到...
Card Name 卡片名称 DataEditForm->menuitem_file 文件(&F)
DataEditForm->menuitem_github 源码主页
Open Database 打开 DataEditForm->menuitem_help 帮助(&H)
New Database 新建 DataEditForm->menuitem_new 新建(&N)
Cards Form ydk file 从ydk文件读取 DataEditForm->menuitem_open 打开(&O)
Cards From Images 从图像文件夹读取 DataEditForm->menuitem_quit 退出(&Q)
Select Copy To 选中卡片复制到... DataEditForm->menuitem_readimages 从图像文件夹读取
All Now Copy To 当前所有卡片复制到... DataEditForm->menuitem_readydk 从ydk文件读取
\ No newline at end of file
Quit 退出
Is Last Version.{0}Version:{1} 已经是最新版本!{0}版本号:{1}是否重新下载?
Check update fail! 查询失败!
have a new version.{0}version:{1} 发现一个新版本。是否下载?{0}版本号{1}
Download succeed. 下载成功。
Download fail. 下载失败。
if open this new database? 是否打开新建的数据库?
Please select a DataBase! 请打开一个数据库!
File is not exists! 文件不存在!
Card is exists! 卡片已经存在!
Add Card succeed! 添加成功!
Add Card fail! 添加失败!
Delete Card {0} ? 是否删除卡片 {0}?
Delete {0} Cards ? 是否删除 {0} 张卡片?
Delete Card succeed! 删除成功!
Delete Card fail! 删除失败!
Card is not changed! 卡片没有被修改!
Modify Card succeed! 修改成功!
Modify Card fail! 修改失败!
Please select script text! 请选中脚本文本!
create script file?{0} 是否创建脚本文件?{0}
Card Code is zero! 卡片密码必须大于0!
Please select images directory! 请选择一个图像文件夹!
Please select ydk file. 选择卡组文件(ydk文件)
ydk file(*.ydk)|*.ydk|all files(*.*)|*.* ydk文件(*.ydk)|*.ydk|所有文件(*.*)|*.*
Overwrite existing card? 是否覆盖已经存在的卡片?
Please select database. 请选择数据库(*.cdb)
cdb file(*.cdb)|*.cdb|all files(*.*)|*.* cdb文件(*.cdb)|*.cdb|所有文件(*.*)|*.*
About:{0}Version:{1}Author:{2}Email:{3} 关于:{0}版本:{1}作者:{2}邮箱:{3}
\ No newline at end of file
!english DataEditForm->btn_add Add
info Info DataEditForm->btn_del Delte
error Error DataEditForm->btn_lua Lua
warning Warning DataEditForm->btn_mod Modify
DataEditForm->btn_PageDown >>
question Question DataEditForm->btn_PageUp <<
DataEditForm->btn_reset Rest
Add Add DataEditForm->btn_serach Search
Modify &Modify DataEditForm->DataEditForm DataEditorX by 247321453
Delete &Delete DataEditForm->lb_atkdef ATK/DEF
Lua Script &Lua Script DataEditForm->lb_cardalias Alias
Search &Search DataEditForm->lb_cardcode Card Code
Reset &Reset DataEditForm->lb_categorys Category
DataEditForm->lb_pleft_right PScale
Alias Card Alias Card DataEditForm->lb_scripttext
Card Code Card Code DataEditForm->lb_tiptexts TipText
Card Types Card Types DataEditForm->lb_types Card Type
Card Categorys Card Categorys DataEditForm->lb2 /
Tips Texts Tips Texts DataEditForm->lb4 /
DataEditForm->lb5 /
Help &Help DataEditForm->lv_cardlist0 Card Code
About About DataEditForm->lv_cardlist1 Card Name
Check Update Check Update DataEditForm->menuitem_about About
Source Source DataEditForm->menuitem_checkupdate Check Update
DataEditForm->menuitem_copyselectto Slect Cards Copy To...
File &File DataEditForm->menuitem_copyto Now All Cards Copy To...
Card Name Card Name DataEditForm->menuitem_file File
DataEditForm->menuitem_github Github
Open Database Open Database DataEditForm->menuitem_help Help
New Database New Database DataEditForm->menuitem_new New
Cards Form ydk file Cards Form ydk file DataEditForm->menuitem_open Open
Cards From Images Cards From Images DataEditForm->menuitem_quit Quit
Select Copy To Select Copy To... DataEditForm->menuitem_readimages Read for Image Folder
All Now Copy To All Now Copy To... DataEditForm->menuitem_readydk Read for ydk file
\ No newline at end of file
Quit &Quit
Is Last Version.{0}Version:{1} Is Last Version.{0}Version:{1}
Check update fail! check update fail
have a new version.{0}version:{1} have a new version.{0}version:{1}
Download succeed. Download succeed.
if open this new database? If open this new database?
Please select a DataBase! Please select a DataBase!
File is not exists! File is not exists!
Card is exists! Card is exists!
Add Card succeed! Add Card succeed!
Add Card fail! Add Card fail!
Delete Card {0} ? Delete Card {0} ?
Delete {0} Cards ? Delete {0} Cards ?
Delete Card succeed! Delete Card succeed!
Delete Card fail! Delete Card fail!
Card is not changed! Card is not changed!
Modify Card succeed! Modify Card succeed!
Modify Card fail! Modify Card fail!
Please select script text! Please select script text!
create script file?{0} create script file?{0}
Card Code is zero! Card Code is zero!
Please select images directory! Please select images directory!
Please select ydk file. Please select ydk file.
ydk file(*.ydk)|*.ydk|all files(*.*)|*.* ydk file(*.ydk)|*.ydk|all files(*.*)|*.*
Overwrite existing card? Overwrite existing card?
Please select database. Please select database.
cdb file(*.cdb)|*.cdb|all files(*.*)|*.* cdb file(*.cdb)|*.cdb|all files(*.*)|*.*
About:{0}Version:{1}Author:{2}Email:{3} About:{0}Version:{1}Author:{2}Email:{3}
\ No newline at end of file
[DataEditorX]1.3.4.2[DataEditorX] [DataEditorX]1.4.0.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]
★支持关联cdb文件,命令参数启动。 ★支持关联cdb文件,命令参数启动。
...@@ -41,6 +41,8 @@ DataEditorX.exe.config ...@@ -41,6 +41,8 @@ DataEditorX.exe.config
描述不详细的bug,我修复不了。(都不知道是bug是什么) 描述不详细的bug,我修复不了。(都不知道是bug是什么)
★更新历史 ★更新历史
1.4.0.0
增加多语言文件的可修改性。
1.3.4.2 1.3.4.2
新建数据库,改为提示是否打开。 新建数据库,改为提示是否打开。
打开空白数据库,将会清空当前列表和内容。 打开空白数据库,将会清空当前列表和内容。
......
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