Commit 01034ce5 authored by keyongyu's avatar keyongyu

2.1

parent 8475b4df
......@@ -130,11 +130,6 @@ void DataEditFormFormClosing(object sender, FormClosingEventArgs e)
}
}
if(!string.IsNullOrEmpty(nowCdbFile)){
Configuration cfa = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
cfa.AppSettings.Settings["cdb"].Value = nowCdbFile;
cfa.Save(ConfigurationSaveMode.Modified);
}
}
void DataEditFormEnter(object sender, EventArgs e)
{
......@@ -1134,13 +1129,6 @@ void Menuitem_readimagesClick(object sender, EventArgs e)
}
}
}
//打开最后的数据库
void Menuitem_openLastDataBaseClick(object sender, EventArgs e)
{
string cdb=System.Configuration.ConfigurationManager.AppSettings["cdb"];
if(File.Exists(cdb))
Open(cdb);
}
//关闭
void Menuitem_quitClick(object sender, EventArgs e)
{
......
......@@ -75,6 +75,7 @@ public enum LMSG : uint
IfCancelTask,
CopyCards,
PasteCards,
ClearHistory,
COUNT,
}
}
......@@ -59,8 +59,6 @@ private void InitializeComponent()
this.menuitem_copyselect = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_pastecards = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
this.menuitem_openLastDataBase = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.menuitem_quit = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_windows = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_dataeditor = new System.Windows.Forms.ToolStripMenuItem();
......@@ -68,6 +66,7 @@ private void InitializeComponent()
this.menuitem_close = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_closeother = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_closeall = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_history = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
......@@ -130,6 +129,7 @@ private void InitializeComponent()
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.menuitem_file,
this.menuitem_history,
this.menuitem_windows});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.MdiWindowListItem = this.menuitem_windows;
......@@ -147,8 +147,6 @@ private void InitializeComponent()
this.menuitem_copyselect,
this.menuitem_pastecards,
this.toolStripSeparator4,
this.menuitem_openLastDataBase,
this.toolStripSeparator1,
this.menuitem_quit});
this.menuitem_file.Name = "menuitem_file";
this.menuitem_file.Size = new System.Drawing.Size(53, 21);
......@@ -198,18 +196,6 @@ private void InitializeComponent()
this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(258, 6);
//
// menuitem_openLastDataBase
//
this.menuitem_openLastDataBase.Name = "menuitem_openLastDataBase";
this.menuitem_openLastDataBase.Size = new System.Drawing.Size(261, 22);
this.menuitem_openLastDataBase.Text = "Open Last DataBase";
this.menuitem_openLastDataBase.Click += new System.EventHandler(this.Menuitem_openLastDataBaseClick);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(258, 6);
//
// menuitem_quit
//
this.menuitem_quit.Name = "menuitem_quit";
......@@ -232,36 +218,42 @@ private void InitializeComponent()
// menuitem_dataeditor
//
this.menuitem_dataeditor.Name = "menuitem_dataeditor";
this.menuitem_dataeditor.Size = new System.Drawing.Size(145, 22);
this.menuitem_dataeditor.Size = new System.Drawing.Size(152, 22);
this.menuitem_dataeditor.Text = "DataEditor";
this.menuitem_dataeditor.Click += new System.EventHandler(this.DataEditorToolStripMenuItemClick);
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(142, 6);
this.toolStripSeparator2.Size = new System.Drawing.Size(149, 6);
//
// menuitem_close
//
this.menuitem_close.Name = "menuitem_close";
this.menuitem_close.Size = new System.Drawing.Size(145, 22);
this.menuitem_close.Size = new System.Drawing.Size(152, 22);
this.menuitem_close.Text = "Close";
this.menuitem_close.Click += new System.EventHandler(this.CloseToolStripMenuItemClick);
//
// menuitem_closeother
//
this.menuitem_closeother.Name = "menuitem_closeother";
this.menuitem_closeother.Size = new System.Drawing.Size(145, 22);
this.menuitem_closeother.Size = new System.Drawing.Size(152, 22);
this.menuitem_closeother.Text = "Close Other";
this.menuitem_closeother.Click += new System.EventHandler(this.CloseOtherToolStripMenuItemClick);
//
// menuitem_closeall
//
this.menuitem_closeall.Name = "menuitem_closeall";
this.menuitem_closeall.Size = new System.Drawing.Size(145, 22);
this.menuitem_closeall.Size = new System.Drawing.Size(152, 22);
this.menuitem_closeall.Text = "Close All";
this.menuitem_closeall.Click += new System.EventHandler(this.CloseAllToolStripMenuItemClick);
//
// menuitem_history
//
this.menuitem_history.Name = "menuitem_history";
this.menuitem_history.Size = new System.Drawing.Size(78, 21);
this.menuitem_history.Text = "History(&H)";
//
// MainForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
......@@ -286,8 +278,7 @@ private void InitializeComponent()
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
private System.Windows.Forms.ToolStripMenuItem menuitem_copyselect;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripMenuItem menuitem_openLastDataBase;
private System.Windows.Forms.ToolStripMenuItem menuitem_history;
private System.Windows.Forms.ToolStripMenuItem menuitem_new;
private System.Windows.Forms.ToolStripMenuItem menuitem_quit;
private System.Windows.Forms.ToolStripMenuItem menuitem_open;
......
......@@ -28,6 +28,9 @@ public partial class MainForm : Form
public const int CLOSE_ALL=3;
public const int WM_OPEN=0x0401;
public const string TMPFILE="open.tmp";
public const int MAX_HISTORY=0x20;
string cdbHistoryFile;
List<string> cdblist;
string datapath;
string conflang,conflang_de,confmsg;
Card[] tCards;
......@@ -46,8 +49,10 @@ public MainForm(string datapath)
void Init(string datapath)
{
tCards=null;
cdblist=new List<string>();
list=new Dictionary<DataEditForm,string>();
this.datapath=datapath;
cdbHistoryFile =Path.Combine(datapath, "history.txt");
conflang = Path.Combine(datapath, "language-mainform.txt");
conflang_de = Path.Combine(datapath, "language-dataeditor.txt");
confmsg = Path.Combine(datapath, "message.txt");
......@@ -58,6 +63,78 @@ void Init(string datapath)
LANG.SetLanguage(this);
}
#endregion
#region History
void ReadHistory()
{
if(!File.Exists(cdbHistoryFile))
return;
string[] lines=File.ReadAllLines(cdbHistoryFile);
foreach(string line in lines)
{
if(string.IsNullOrEmpty(line) || line.StartsWith("#"))
continue;
if(File.Exists(line) && cdblist.IndexOf(line)<0){
cdblist.Add(line);
}
}
}
void AddHistory(string file)
{
int index=cdblist.IndexOf(file);
if(index>=0){
cdblist.RemoveAt(index);
}
else{
int i=cdblist.Count-MainForm.MAX_HISTORY+1;
while(i>=0 && i<cdblist.Count)
{
cdblist.RemoveAt(i);
i--;
}
}
cdblist.Add(file);
SaveHistory();
MenuHistory();
}
void SaveHistory()
{
string texts="# history";
foreach(string str in cdblist)
{
if(File.Exists(str))
texts += Environment.NewLine + str;
}
File.Delete(cdbHistoryFile);
File.WriteAllText(cdbHistoryFile, texts);
}
void MenuHistory()
{
menuitem_history.DropDownItems.Clear();
foreach(string str in cdblist)
{
ToolStripMenuItem tsmi=new ToolStripMenuItem(str);
tsmi.Click+=MenuHistoryItem_Click;
menuitem_history.DropDownItems.Add(tsmi);
}
menuitem_history.DropDownItems.Add(new ToolStripSeparator());
ToolStripMenuItem tsmiclear=new ToolStripMenuItem(LANG.GetMsg(LMSG.ClearHistory));
tsmiclear.Click+=MenuHistoryClear_Click;
menuitem_history.DropDownItems.Add(tsmiclear);
}
void MenuHistoryClear_Click(object sender, EventArgs e)
{
cdblist.Clear();
MenuHistory();
SaveHistory();
}
void MenuHistoryItem_Click(object sender, EventArgs e)
{
ToolStripMenuItem tsmi=sender as ToolStripMenuItem;
if(tsmi!=null)
Open(tsmi.Text);
}
#endregion
#region message
protected override void DefWndProc(ref System.Windows.Forms.Message m)
......@@ -81,6 +158,9 @@ protected override void DefWndProc(ref System.Windows.Forms.Message m)
#region DataEditor
public void Open(string file)
{
if(!string.IsNullOrEmpty(file) && File.Exists(file)){
AddHistory(file);
}
if(checkOpen(file))
return;
if(OpenInNull(file))
......@@ -144,7 +224,8 @@ void DataEditorToolStripMenuItemClick(object sender, EventArgs e)
#region form
void MainFormLoad(object sender, System.EventArgs e)
{
ReadHistory();
MenuHistory();
}
void MainFormFormClosing(object sender, FormClosingEventArgs e)
......@@ -213,13 +294,6 @@ void QuitToolStripMenuItemClick(object sender, EventArgs e)
Application.Exit();
}
void Menuitem_openLastDataBaseClick(object sender, EventArgs e)
{
string cdb=System.Configuration.ConfigurationManager.AppSettings["cdb"];
if(File.Exists(cdb))
Open(cdb);
}
void Menuitem_newClick(object sender, EventArgs e)
{
using(SaveFileDialog dlg=new SaveFileDialog())
......@@ -281,7 +355,7 @@ void Menuitem_pastecardsClick(object sender, EventArgs e)
df.SaveCards(tCards);
MyMsg.Show(LMSG.PasteCards);
}
#endregion
}
}
......@@ -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("2.0.0.3")]
[assembly: AssemblyVersion("2.1.0.0")]
......@@ -16,8 +16,7 @@
<add key="sourceURL" value="https://github.com/247321453/DataEditorX" />
<!-- DataEditorX update url-->
<add key="updateURL" value="https://github.com/247321453/DataEditorX/tree/master/win32/readme.txt" />
<!-- Defult DataBase -->
<add key="cdb" value="cards.cdb" />
<!-- Defult Images -->
<add key="image_quilty" value="96" />
<add key="image" value="44,64,177,254" />
<add key="image_other" value="25,54,128,128" />
......
......@@ -3,7 +3,7 @@ MainForm->menuitem_new 新建(&N)
MainForm->menuitem_open 打开(&O)
MainForm->menuitem_copyselect 复制所选卡片
MainForm->menuitem_pastecards 粘贴卡片
MainForm->menuitem_openLastDataBase 最后打开的数据库
MainForm->menuitem_history 历史(&H)
MainForm->menuitem_quit 退出(&Q)
MainForm->menuitem_windows 窗口(&W)
MainForm->menuitem_dataeditor 新建标签
......
......@@ -58,4 +58,5 @@
0x39 任务出错
0x3a 是否取消当前任务?
0x3b 复制完成
0x3c 粘贴完成
\ No newline at end of file
0x3c 粘贴完成
0x3d 清空历史记录
\ No newline at end of file
......@@ -3,7 +3,7 @@ MainForm->menuitem_new New DataBase
MainForm->menuitem_open Open DataBase
MainForm->menuitem_copyselect Copy Select
MainForm->menuitem_pastecards Paste Cards
MainForm->menuitem_openLastDataBase Open Last DataBase
MainForm->menuitem_history History(&H)
MainForm->menuitem_quit Quit(&Q)
MainForm->menuitem_windows Windwos(&W)
MainForm->menuitem_dataeditor New DataEditor
......
......@@ -58,4 +58,5 @@
0x39 Task has Error
0x3a Cancel Task?
0x3b Copy
0x3c Paste
\ No newline at end of file
0x3c Paste
0x3d Clear History
\ No newline at end of file
[DataEditorX]2.0.0.2[DataEditorX]
[DataEditorX]2.1.0.0[DataEditorX]
[URL]https://github.com/247321453/DataEditorX/raw/master/win32/win32.zip[URL]
★使用前,请关联lua的打开方式,例如记事本,notepad++,等。
......@@ -66,6 +66,8 @@ DataEditorX.exe.config
描述不详细的bug,我修复不了。(都不知道是bug是什么)
★更新历史
2.1.0.0
添加历史记录,最多32条
2.0.0.3
更新mse-config.txt
2.0.0.2
......
No preview for this file type
......@@ -16,8 +16,7 @@
<add key="sourceURL" value="https://github.com/247321453/DataEditorX" />
<!-- DataEditorX update url-->
<add key="updateURL" value="https://github.com/247321453/DataEditorX/tree/master/win32/readme.txt" />
<!-- Defult DataBase -->
<add key="cdb" value="cards.cdb" />
<!-- Defult Images -->
<add key="image_quilty" value="96" />
<add key="image" value="44,64,177,254" />
<add key="image_other" value="25,54,128,128" />
......
......@@ -3,7 +3,7 @@ MainForm->menuitem_new 新建(&N)
MainForm->menuitem_open 打开(&O)
MainForm->menuitem_copyselect 复制所选卡片
MainForm->menuitem_pastecards 粘贴卡片
MainForm->menuitem_openLastDataBase 最后打开的数据库
MainForm->menuitem_history 历史(&H)
MainForm->menuitem_quit 退出(&Q)
MainForm->menuitem_windows 窗口(&W)
MainForm->menuitem_dataeditor 新建标签
......
......@@ -58,4 +58,5 @@
0x39 任务出错
0x3a 是否取消当前任务?
0x3b 复制完成
0x3c 粘贴完成
\ No newline at end of file
0x3c 粘贴完成
0x3d 清空历史记录
\ No newline at end of file
......@@ -3,7 +3,7 @@ MainForm->menuitem_new New DataBase
MainForm->menuitem_open Open DataBase
MainForm->menuitem_copyselect Copy Select
MainForm->menuitem_pastecards Paste Cards
MainForm->menuitem_openLastDataBase Open Last DataBase
MainForm->menuitem_history History(&H)
MainForm->menuitem_quit Quit(&Q)
MainForm->menuitem_windows Windwos(&W)
MainForm->menuitem_dataeditor New DataEditor
......
......@@ -58,4 +58,5 @@
0x39 Task has Error
0x3a Cancel Task?
0x3b Copy
0x3c Paste
\ No newline at end of file
0x3c Paste
0x3d Clear History
\ No newline at end of file
[DataEditorX]2.0.0.2[DataEditorX]
[DataEditorX]2.1.0.0[DataEditorX]
[URL]https://github.com/247321453/DataEditorX/raw/master/win32/win32.zip[URL]
★使用前,请关联lua的打开方式,例如记事本,notepad++,等。
......@@ -66,6 +66,8 @@ DataEditorX.exe.config
描述不详细的bug,我修复不了。(都不知道是bug是什么)
★更新历史
2.1.0.0
添加历史记录,最多32条
2.0.0.3
更新mse-config.txt
2.0.0.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