Commit 1bea0f6c authored by keyongyu's avatar keyongyu

2.2.9.5

parent 9f3b4475
...@@ -31,10 +31,14 @@ public partial class CodeEditForm : DockContent, IEditForm ...@@ -31,10 +31,14 @@ public partial class CodeEditForm : DockContent, IEditForm
MarkerStyle SameWordsStyle = new MarkerStyle(new SolidBrush(Color.FromArgb(40, Color.White))); MarkerStyle SameWordsStyle = new MarkerStyle(new SolidBrush(Color.FromArgb(40, Color.White)));
#endregion #endregion
#region init #region init 函数提示菜单
//自动完成
AutocompleteMenu popupMenu; AutocompleteMenu popupMenu;
//函数
AutocompleteMenu popupMenu_fun; AutocompleteMenu popupMenu_fun;
//常量
AutocompleteMenu popupMenu_con; AutocompleteMenu popupMenu_con;
//搜索
AutocompleteMenu popupMenu_find; AutocompleteMenu popupMenu_find;
string nowFile; string nowFile;
string title; string title;
...@@ -77,6 +81,7 @@ void InitForm() ...@@ -77,6 +81,7 @@ void InitForm()
popupMenu_find.Items.Width = 300; popupMenu_find.Items.Width = 300;
title = this.Text; title = this.Text;
//设置字体,大小
string fontname = MyConfig.readString(MyConfig.TAG_FONT_NAME); string fontname = MyConfig.readString(MyConfig.TAG_FONT_NAME);
float fontsize = MyConfig.readFloat(MyConfig.TAG_FONT_SIZE, 14); float fontsize = MyConfig.readFloat(MyConfig.TAG_FONT_SIZE, 14);
fctb.Font = new Font(fontname, fontsize); fctb.Font = new Font(fontname, fontsize);
...@@ -99,7 +104,7 @@ public void LoadXml(string xmlfile) ...@@ -99,7 +104,7 @@ public void LoadXml(string xmlfile)
#endregion #endregion
#region Open #region IEditForm接口
public void SetActived() public void SetActived()
{ {
this.Activate(); this.Activate();
...@@ -116,6 +121,10 @@ public bool Create(string file) ...@@ -116,6 +121,10 @@ public bool Create(string file)
{ {
return Open(file); return Open(file);
} }
public bool Save()
{
return savefile(string.IsNullOrEmpty(nowFile));
}
public bool Open(string file) public bool Open(string file)
{ {
if (!string.IsNullOrEmpty(file)) if (!string.IsNullOrEmpty(file))
...@@ -128,7 +137,7 @@ public bool Open(string file) ...@@ -128,7 +137,7 @@ public bool Open(string file)
nowFile = file; nowFile = file;
string cdb = MyPath.Combine( string cdb = MyPath.Combine(
Path.GetDirectoryName(file), "../cards.cdb"); Path.GetDirectoryName(file), "../cards.cdb");
SetCardDB(cdb); SetCardDB(cdb);//后台加载卡片数据
fctb.OpenFile(nowFile, new UTF8Encoding(false)); fctb.OpenFile(nowFile, new UTF8Encoding(false));
oldtext = fctb.Text; oldtext = fctb.Text;
SetTitle(); SetTitle();
...@@ -137,23 +146,10 @@ public bool Open(string file) ...@@ -137,23 +146,10 @@ public bool Open(string file)
return false; return false;
} }
void HideMenu()
{
if (this.MdiParent == null)
return;
mainMenu.Visible = false;
menuitem_file.Visible = false;
menuitem_file.Enabled = false;
}
void CodeEditFormLoad(object sender, EventArgs e)
{
HideMenu();
fctb.OnTextChangedDelayed(fctb.Range);
}
#endregion #endregion
#region doc map #region 文档视图
//文档视图
void ShowMapToolStripMenuItemClick(object sender, EventArgs e) void ShowMapToolStripMenuItemClick(object sender, EventArgs e)
{ {
if (menuitem_showmap.Checked) if (menuitem_showmap.Checked)
...@@ -171,7 +167,7 @@ void ShowMapToolStripMenuItemClick(object sender, EventArgs e) ...@@ -171,7 +167,7 @@ void ShowMapToolStripMenuItemClick(object sender, EventArgs e)
} }
#endregion #endregion
#region title #region 设置标题
void SetTitle() void SetTitle()
{ {
string str = title; string str = title;
...@@ -179,7 +175,7 @@ void SetTitle() ...@@ -179,7 +175,7 @@ void SetTitle()
str = title; str = title;
else else
str = nowFile + "-" + title; str = nowFile + "-" + title;
if (this.MdiParent != null) if (this.MdiParent != null)//如果父容器不为空
{ {
if (string.IsNullOrEmpty(nowFile)) if (string.IsNullOrEmpty(nowFile))
this.Text = title; this.Text = title;
...@@ -197,7 +193,7 @@ void CodeEditFormEnter(object sender, EventArgs e) ...@@ -197,7 +193,7 @@ void CodeEditFormEnter(object sender, EventArgs e)
} }
#endregion #endregion
#region tooltip #region 自动完成
public void InitTooltip(CodeConfig codeconfig) public void InitTooltip(CodeConfig codeconfig)
{ {
this.tooltipDic = codeconfig.TooltipDic; this.tooltipDic = codeconfig.TooltipDic;
...@@ -208,7 +204,7 @@ public void InitTooltip(CodeConfig codeconfig) ...@@ -208,7 +204,7 @@ public void InitTooltip(CodeConfig codeconfig)
popupMenu_con.Items.SetAutocompleteItems(codeconfig.ConList); popupMenu_con.Items.SetAutocompleteItems(codeconfig.ConList);
popupMenu_fun.Items.SetAutocompleteItems(codeconfig.FunList); popupMenu_fun.Items.SetAutocompleteItems(codeconfig.FunList);
} }
//查找函数说明
string FindTooltip(string word) string FindTooltip(string word)
{ {
string desc = ""; string desc = "";
...@@ -223,6 +219,7 @@ string FindTooltip(string word) ...@@ -223,6 +219,7 @@ string FindTooltip(string word)
} }
return desc; return desc;
} }
//悬停的函数说明
void FctbToolTipNeeded(object sender, ToolTipNeededEventArgs e) void FctbToolTipNeeded(object sender, ToolTipNeededEventArgs e)
{ {
if (!string.IsNullOrEmpty(e.HoveredWord)) if (!string.IsNullOrEmpty(e.HoveredWord))
...@@ -238,6 +235,7 @@ void FctbToolTipNeeded(object sender, ToolTipNeededEventArgs e) ...@@ -238,6 +235,7 @@ void FctbToolTipNeeded(object sender, ToolTipNeededEventArgs e)
if (tl > 0) if (tl > 0)
{ {
//获取卡片信息
if (cardlist.ContainsKey(tl)) if (cardlist.ContainsKey(tl))
desc = cardlist[tl]; desc = cardlist[tl];
} }
...@@ -252,19 +250,19 @@ void FctbToolTipNeeded(object sender, ToolTipNeededEventArgs e) ...@@ -252,19 +250,19 @@ void FctbToolTipNeeded(object sender, ToolTipNeededEventArgs e)
} }
#endregion #endregion
#region Key #region 按键监听
void FctbKeyDown(object sender, KeyEventArgs e) void FctbKeyDown(object sender, KeyEventArgs e)
{ {
if (e.KeyData == (Keys.K | Keys.Control)) if (e.KeyData == (Keys.K | Keys.Control))
{ {
//forced show (MinFragmentLength will be ignored) //forced show (MinFragmentLength will be ignored)
popupMenu_fun.Show(true); popupMenu_fun.Show(true);//显示函数列表
e.Handled = true; e.Handled = true;
} }
else if (e.KeyData == (Keys.T | Keys.Control)) else if (e.KeyData == (Keys.T | Keys.Control))
{ {
//forced show (MinFragmentLength will be ignored) //forced show (MinFragmentLength will be ignored)
popupMenu_con.Show(true); popupMenu_con.Show(true);//显示常量列表
e.Handled = true; e.Handled = true;
} }
//else if(e.KeyData == Keys(Keys.Control | Keys //else if(e.KeyData == Keys(Keys.Control | Keys
...@@ -272,7 +270,7 @@ void FctbKeyDown(object sender, KeyEventArgs e) ...@@ -272,7 +270,7 @@ void FctbKeyDown(object sender, KeyEventArgs e)
#endregion #endregion
#region input #region input
//显示/隐藏输入框
void Menuitem_showinputClick(object sender, EventArgs e) void Menuitem_showinputClick(object sender, EventArgs e)
{ {
if (menuitem_showinput.Checked) if (menuitem_showinput.Checked)
...@@ -289,6 +287,21 @@ void Menuitem_showinputClick(object sender, EventArgs e) ...@@ -289,6 +287,21 @@ void Menuitem_showinputClick(object sender, EventArgs e)
#endregion #endregion
#region menu #region menu
//如果是作为mdi,则隐藏菜单
void HideMenu()
{
if (this.MdiParent == null)
return;
mainMenu.Visible = false;
menuitem_file.Visible = false;
menuitem_file.Enabled = false;
}
void CodeEditFormLoad(object sender, EventArgs e)
{
HideMenu();
fctb.OnTextChangedDelayed(fctb.Range);
}
void Menuitem_findClick(object sender, EventArgs e) void Menuitem_findClick(object sender, EventArgs e)
{ {
fctb.ShowFindDialog(); fctb.ShowFindDialog();
...@@ -298,6 +311,7 @@ void Menuitem_replaceClick(object sender, EventArgs e) ...@@ -298,6 +311,7 @@ void Menuitem_replaceClick(object sender, EventArgs e)
{ {
fctb.ShowReplaceDialog(); fctb.ShowReplaceDialog();
} }
#region 保存文件
bool savefile(bool saveas) bool savefile(bool saveas)
{ {
string alltext = fctb.Text; string alltext = fctb.Text;
...@@ -320,10 +334,7 @@ bool savefile(bool saveas) ...@@ -320,10 +334,7 @@ bool savefile(bool saveas)
File.WriteAllText(nowFile, alltext, new UTF8Encoding(false)); File.WriteAllText(nowFile, alltext, new UTF8Encoding(false));
return true; return true;
} }
public bool Save()
{
return savefile(string.IsNullOrEmpty(nowFile));
}
public bool SaveAs() public bool SaveAs()
{ {
return savefile(true); return savefile(true);
...@@ -337,7 +348,7 @@ void SaveAsToolStripMenuItemClick(object sender, EventArgs e) ...@@ -337,7 +348,7 @@ void SaveAsToolStripMenuItemClick(object sender, EventArgs e)
{ {
SaveAs(); SaveAs();
} }
#endregion
void QuitToolStripMenuItemClick(object sender, EventArgs e) void QuitToolStripMenuItemClick(object sender, EventArgs e)
{ {
this.Close(); this.Close();
...@@ -356,7 +367,7 @@ void Menuitem_openClick(object sender, EventArgs e) ...@@ -356,7 +367,7 @@ void Menuitem_openClick(object sender, EventArgs e)
{ {
using (OpenFileDialog sfdlg = new OpenFileDialog()) using (OpenFileDialog sfdlg = new OpenFileDialog())
{ {
sfdlg.Filter = "Script(*.lua)|*.lua|All Files(*.*)|*.*"; sfdlg.Filter = LANG.GetMsg(LMSG.ScriptFilter);
if (sfdlg.ShowDialog() == DialogResult.OK) if (sfdlg.ShowDialog() == DialogResult.OK)
{ {
nowFile = sfdlg.FileName; nowFile = sfdlg.FileName;
...@@ -367,7 +378,8 @@ void Menuitem_openClick(object sender, EventArgs e) ...@@ -367,7 +378,8 @@ void Menuitem_openClick(object sender, EventArgs e)
#endregion #endregion
#region find #region 搜索函数
//搜索函数
void Tb_inputKeyDown(object sender, KeyEventArgs e) void Tb_inputKeyDown(object sender, KeyEventArgs e)
{ {
if (e.KeyCode == Keys.Enter) if (e.KeyCode == Keys.Enter)
...@@ -391,7 +403,7 @@ void Tb_inputKeyDown(object sender, KeyEventArgs e) ...@@ -391,7 +403,7 @@ void Tb_inputKeyDown(object sender, KeyEventArgs e)
} }
#endregion #endregion
#region close #region 关闭提示保存
void CodeEditFormFormClosing(object sender, FormClosingEventArgs e) void CodeEditFormFormClosing(object sender, FormClosingEventArgs e)
{ {
if (!string.IsNullOrEmpty(oldtext)) if (!string.IsNullOrEmpty(oldtext))
...@@ -410,7 +422,7 @@ void CodeEditFormFormClosing(object sender, FormClosingEventArgs e) ...@@ -410,7 +422,7 @@ void CodeEditFormFormClosing(object sender, FormClosingEventArgs e)
} }
#endregion #endregion
#region card tooltip #region 卡片提示
public void SetCDBList(string[] cdbs) public void SetCDBList(string[] cdbs)
{ {
if (cdbs == null) if (cdbs == null)
...@@ -455,7 +467,7 @@ public void SetCards(Card[] cards) ...@@ -455,7 +467,7 @@ public void SetCards(Card[] cards)
} }
#endregion #endregion
#region selection #region 选择高亮
void FctbSelectionChangedDelayed(object sender, EventArgs e) void FctbSelectionChangedDelayed(object sender, EventArgs e)
{ {
tb_input.Text = fctb.SelectedText; tb_input.Text = fctb.SelectedText;
...@@ -475,7 +487,7 @@ void FctbSelectionChangedDelayed(object sender, EventArgs e) ...@@ -475,7 +487,7 @@ void FctbSelectionChangedDelayed(object sender, EventArgs e)
} }
#endregion #endregion
#region goto function define #region 调转函数
void FctbMouseClick(object sender, MouseEventArgs e) void FctbMouseClick(object sender, MouseEventArgs e)
{ {
var fragment = fctb.Selection.GetFragment(@"\w"); var fragment = fctb.Selection.GetFragment(@"\w");
......
...@@ -88,10 +88,6 @@ public static bool CheckVersion(string ver, string oldver) ...@@ -88,10 +88,6 @@ public static bool CheckVersion(string ver, string oldver)
} }
} }
} }
#if DEBUG
MessageBox.Show("new:" + ver + ",oldver:" + oldver + ",hasnew:" + hasNew.ToString());
#endif
return hasNew; return hasNew;
} }
#endregion #endregion
......
...@@ -60,7 +60,7 @@ public AutocompleteItem[] ConList ...@@ -60,7 +60,7 @@ public AutocompleteItem[] ConList
/// 设置系列名 /// 设置系列名
/// </summary> /// </summary>
/// <param name="dic"></param> /// <param name="dic"></param>
public void SetNames(SortedList<long, string> dic) public void SetNames(Dictionary<long, string> dic)
{ {
foreach (long k in dic.Keys) foreach (long k in dic.Keys)
{ {
......
...@@ -33,13 +33,13 @@ public void InitMember(string conf) ...@@ -33,13 +33,13 @@ public void InitMember(string conf)
//conf = MyPath.Combine(datapath, MyConfig.FILE_INFO); //conf = MyPath.Combine(datapath, MyConfig.FILE_INFO);
if(!File.Exists(conf)) if(!File.Exists(conf))
{ {
dicCardRules = new SortedList<long, string>(); dicCardRules = new Dictionary<long, string>();
dicSetnames = new SortedList<long, string>(); dicSetnames = new Dictionary<long, string>();
dicCardTypes = new SortedList<long, string>(); dicCardTypes = new Dictionary<long, string>();
dicCardcategorys = new SortedList<long, string>(); dicCardcategorys = new Dictionary<long, string>();
dicCardAttributes = new SortedList<long, string>(); dicCardAttributes = new Dictionary<long, string>();
dicCardRaces = new SortedList<long, string>(); dicCardRaces = new Dictionary<long, string>();
dicCardLevels = new SortedList<long, string>(); dicCardLevels = new Dictionary<long, string>();
return; return;
} }
//提取内容 //提取内容
...@@ -56,30 +56,30 @@ public void InitMember(string conf) ...@@ -56,30 +56,30 @@ public void InitMember(string conf)
/// <summary> /// <summary>
/// 规则 /// 规则
/// </summary> /// </summary>
public SortedList<long, string> dicCardRules = null; public Dictionary<long, string> dicCardRules = null;
/// <summary> /// <summary>
/// 属性 /// 属性
/// </summary> /// </summary>
public SortedList<long, string> dicCardAttributes = null; public Dictionary<long, string> dicCardAttributes = null;
/// <summary> /// <summary>
/// 种族 /// 种族
/// </summary> /// </summary>
public SortedList<long, string> dicCardRaces = null; public Dictionary<long, string> dicCardRaces = null;
/// <summary> /// <summary>
/// 等级 /// 等级
/// </summary> /// </summary>
public SortedList<long, string> dicCardLevels = null; public Dictionary<long, string> dicCardLevels = null;
/// <summary> /// <summary>
/// 系列名 /// 系列名
/// </summary> /// </summary>
public SortedList<long, string> dicSetnames = null; public Dictionary<long, string> dicSetnames = null;
/// <summary> /// <summary>
/// 卡片类型 /// 卡片类型
/// </summary> /// </summary>
public SortedList<long, string> dicCardTypes = null; public Dictionary<long, string> dicCardTypes = null;
/// <summary> /// <summary>
/// 效果类型 /// 效果类型
/// </summary> /// </summary>
public SortedList<long, string> dicCardcategorys = null; public Dictionary<long, string> dicCardcategorys = null;
} }
} }
...@@ -55,7 +55,7 @@ public static string subString(string content, string tag) ...@@ -55,7 +55,7 @@ public static string subString(string content, string tag)
/// <param name="content">字符串</param> /// <param name="content">字符串</param>
/// <param name="tag">开始的标志</param> /// <param name="tag">开始的标志</param>
/// <returns></returns> /// <returns></returns>
public static SortedList<long, string> Read(string content, string tag) public static Dictionary<long, string> Read(string content, string tag)
{ {
return Read(subString(content,tag)); return Read(subString(content,tag));
} }
...@@ -65,7 +65,7 @@ public static string subString(string content, string tag) ...@@ -65,7 +65,7 @@ public static string subString(string content, string tag)
/// <param name="strFile"></param> /// <param name="strFile"></param>
/// <param name="encode"></param> /// <param name="encode"></param>
/// <returns></returns> /// <returns></returns>
public static SortedList<long, string> Read(string strFile, Encoding encode) public static Dictionary<long, string> Read(string strFile, Encoding encode)
{ {
return Read(File.ReadAllLines(strFile, encode)); return Read(File.ReadAllLines(strFile, encode));
} }
...@@ -74,7 +74,7 @@ public static string subString(string content, string tag) ...@@ -74,7 +74,7 @@ public static string subString(string content, string tag)
/// </summary> /// </summary>
/// <param name="content"></param> /// <param name="content"></param>
/// <returns></returns> /// <returns></returns>
public static SortedList<long, string> Read(string content) public static Dictionary<long, string> Read(string content)
{ {
string text = reReturn(content); string text = reReturn(content);
return Read(text.Split('\n')); return Read(text.Split('\n'));
...@@ -84,9 +84,9 @@ public static string subString(string content, string tag) ...@@ -84,9 +84,9 @@ public static string subString(string content, string tag)
/// </summary> /// </summary>
/// <param name="lines"></param> /// <param name="lines"></param>
/// <returns></returns> /// <returns></returns>
public static SortedList<long, string> Read(string[] lines) public static Dictionary<long, string> Read(string[] lines)
{ {
SortedList<long, string> tempDic = new SortedList<long, string>(); Dictionary<long, string> tempDic = new Dictionary<long, string>();
long lkey; long lkey;
foreach (string line in lines) foreach (string line in lines)
{ {
...@@ -109,7 +109,7 @@ public static string subString(string content, string tag) ...@@ -109,7 +109,7 @@ public static string subString(string content, string tag)
#endregion #endregion
#region 查找 #region 查找
public static List<long> GetKeys(SortedList<long, string> dic) public static List<long> GetKeys(Dictionary<long, string> dic)
{ {
List<long> list = new List<long>(); List<long> list = new List<long>();
foreach (long l in dic.Keys) foreach (long l in dic.Keys)
...@@ -118,17 +118,14 @@ public static List<long> GetKeys(SortedList<long, string> dic) ...@@ -118,17 +118,14 @@ public static List<long> GetKeys(SortedList<long, string> dic)
} }
return list; return list;
} }
public static string[] GetValues(SortedList<long, string> dic) public static string[] GetValues(Dictionary<long, string> dic)
{ {
string[] strs = new string[dic.Count]; List<string> list = new List<string>();
int j = strs.Length; foreach (long l in dic.Keys)
if (j == 0)
return strs;
for (int i = 0; i < j; i++)
{ {
strs[i] = dic.Values[i]; list.Add(dic[l]);
} }
return strs; return list.ToArray();
} }
/// <summary> /// <summary>
/// 获取值 /// 获取值
...@@ -136,7 +133,7 @@ public static string[] GetValues(SortedList<long, string> dic) ...@@ -136,7 +133,7 @@ public static string[] GetValues(SortedList<long, string> dic)
/// <param name="dic"></param> /// <param name="dic"></param>
/// <param name="key"></param> /// <param name="key"></param>
/// <returns></returns> /// <returns></returns>
public static string GetValue(SortedList<long, string> dic, long key) public static string GetValue(Dictionary<long, string> dic, long key)
{ {
if(dic.ContainsKey(key)) if(dic.ContainsKey(key))
return dic[key].Trim(); return dic[key].Trim();
......
using System.Xml; using System;
using System.Xml;
using System.IO; using System.IO;
using DataEditorX.Common; using DataEditorX.Common;
using System.Windows.Forms;
namespace DataEditorX.Config namespace DataEditorX.Config
{ {
...@@ -23,6 +25,10 @@ public class MyConfig ...@@ -23,6 +25,10 @@ public class MyConfig
/// </summary> /// </summary>
public const string TAG_DATA = "data"; public const string TAG_DATA = "data";
/// <summary> /// <summary>
/// 将要打开
/// </summary>
//public const string TAG_OPEN = "open";
/// <summary>
/// MSE /// MSE
/// </summary> /// </summary>
public const string TAG_MSE = "mse"; public const string TAG_MSE = "mse";
...@@ -133,6 +139,7 @@ public class MyConfig ...@@ -133,6 +139,7 @@ public class MyConfig
public const string TAG_SETNAME = "setname"; public const string TAG_SETNAME = "setname";
#endregion #endregion
#region 读取内容
/// <summary> /// <summary>
/// 读取字符串值 /// 读取字符串值
/// </summary> /// </summary>
...@@ -219,6 +226,9 @@ public static bool readBoolean(string key) ...@@ -219,6 +226,9 @@ public static bool readBoolean(string key)
else else
return false; return false;
} }
#endregion
#region XML操作config
/// <summary> /// <summary>
/// 保存值 /// 保存值
/// </summary> /// </summary>
...@@ -263,6 +273,8 @@ public static string GetAppConfig(string appKey) ...@@ -263,6 +273,8 @@ public static string GetAppConfig(string appKey)
} }
return string.Empty; return string.Empty;
} }
#endregion
/// <summary> /// <summary>
/// 语言配置文件名 /// 语言配置文件名
/// </summary> /// </summary>
...@@ -281,6 +293,19 @@ public static string GetCardInfoFile(string path) ...@@ -281,6 +293,19 @@ public static string GetCardInfoFile(string path)
{ {
return MyPath.Combine(path, MyPath.getFileName(MyConfig.TAG_CARDINFO, GetAppConfig(TAG_LANGUAGE))); return MyPath.Combine(path, MyPath.getFileName(MyConfig.TAG_CARDINFO, GetAppConfig(TAG_LANGUAGE)));
} }
/// <summary>
/// 发送消息打开文件
/// </summary>
/// <param name="file"></param>
public static void Open(IntPtr win, string file)
{
//把需要打开的文件写入临时文件
string tmpfile = Path.Combine(Application.StartupPath, MyConfig.FILE_TEMP);
File.WriteAllText(tmpfile, file);
//发送消息
User32.SendMessage(win, MyConfig.WM_OPEN, 0, 0);
Environment.Exit(1);
}
} }
} }
...@@ -25,7 +25,7 @@ namespace DataEditorX ...@@ -25,7 +25,7 @@ namespace DataEditorX
{ {
public partial class DataEditForm : DockContent, IEditForm public partial class DataEditForm : DockContent, IEditForm
{ {
#region 成员变量 #region 成员变量/构造
TaskHelper tasker = null; TaskHelper tasker = null;
string taskname; string taskname;
string GAMEPATH = "", PICPATH = "", PICPATH2 = "", LUAPTH = ""; string GAMEPATH = "", PICPATH = "", PICPATH2 = "", LUAPTH = "";
...@@ -38,6 +38,7 @@ public partial class DataEditForm : DockContent, IEditForm ...@@ -38,6 +38,7 @@ public partial class DataEditForm : DockContent, IEditForm
/// 对比的id集合 /// 对比的id集合
/// </summary> /// </summary>
List<string>tmpCodes; List<string>tmpCodes;
//初始标题
string title; string title;
string nowCdbFile = ""; string nowCdbFile = "";
int MaxRow = 20; int MaxRow = 20;
...@@ -72,7 +73,7 @@ public DataEditForm(string datapath) ...@@ -72,7 +73,7 @@ public DataEditForm(string datapath)
Initialize(); Initialize();
} }
public DataEditForm() public DataEditForm()
{ {//默认启动
string dir = MyConfig.readString(MyConfig.TAG_DATA); string dir = MyConfig.readString(MyConfig.TAG_DATA);
if (string.IsNullOrEmpty(dir)) if (string.IsNullOrEmpty(dir))
{ {
...@@ -119,10 +120,10 @@ public bool Save() ...@@ -119,10 +120,10 @@ public bool Save()
//窗体第一次加载 //窗体第一次加载
void DataEditFormLoad(object sender, EventArgs e) void DataEditFormLoad(object sender, EventArgs e)
{ {
InitListRows(); InitListRows();//调整卡片列表的函数
HideMenu();//是否需要隐藏菜单 HideMenu();//是否需要隐藏菜单
SetTitle(); SetTitle();//设置标题
//加载
msecfg = new MSEConfig(datapath); msecfg = new MSEConfig(datapath);
tasker = new TaskHelper(datapath, bgWorker1, msecfg); tasker = new TaskHelper(datapath, bgWorker1, msecfg);
//设置空白卡片 //设置空白卡片
...@@ -138,6 +139,7 @@ void DataEditFormLoad(object sender, EventArgs e) ...@@ -138,6 +139,7 @@ void DataEditFormLoad(object sender, EventArgs e)
//窗体关闭 //窗体关闭
void DataEditFormFormClosing(object sender, FormClosingEventArgs e) void DataEditFormFormClosing(object sender, FormClosingEventArgs e)
{ {
//当前有任务执行,是否结束
if (tasker != null && tasker.IsRuning()) if (tasker != null && tasker.IsRuning())
{ {
if (!CancelTask()) if (!CancelTask())
...@@ -196,7 +198,7 @@ void SetTitle() ...@@ -196,7 +198,7 @@ void SetTitle()
str = nowCdbFile + "-" + str; str = nowCdbFile + "-" + str;
str2 = Path.GetFileName(nowCdbFile); str2 = Path.GetFileName(nowCdbFile);
} }
if (this.MdiParent != null) if (this.MdiParent != null) //父容器不为空
{ {
this.Text = str2; this.Text = str2;
if (tasker != null && tasker.IsRuning()) if (tasker != null && tasker.IsRuning())
...@@ -238,20 +240,6 @@ void InitPath(string datapath) ...@@ -238,20 +240,6 @@ void InitPath(string datapath)
else else
m_cover = null; m_cover = null;
} }
//保存dic
void SaveDic(string file, Dictionary<long, string> dic)
{
using (FileStream fs = new FileStream(file, FileMode.OpenOrCreate, FileAccess.Write))
{
StreamWriter sw = new StreamWriter(fs, Encoding.UTF8);
foreach (long k in dic.Keys)
{
sw.WriteLine("0x" + k.ToString("x") + " " + dic[k]);
}
sw.Close();
fs.Close();
}
}
#endregion #endregion
#region 界面控件 #region 界面控件
...@@ -260,15 +248,16 @@ public void InitControl(DataConfig datacfg) ...@@ -260,15 +248,16 @@ public void InitControl(DataConfig datacfg)
{ {
if (datacfg == null) if (datacfg == null)
return; return;
//选择框
InitComboBox(cb_cardrace, datacfg.dicCardRaces); InitComboBox(cb_cardrace, datacfg.dicCardRaces);
InitComboBox(cb_cardattribute, datacfg.dicCardAttributes); InitComboBox(cb_cardattribute, datacfg.dicCardAttributes);
InitComboBox(cb_cardrule, datacfg.dicCardRules); InitComboBox(cb_cardrule, datacfg.dicCardRules);
InitComboBox(cb_cardlevel, datacfg.dicCardLevels); InitComboBox(cb_cardlevel, datacfg.dicCardLevels);
//card types //卡片类型
InitCheckPanel(pl_cardtype, datacfg.dicCardTypes); InitCheckPanel(pl_cardtype, datacfg.dicCardTypes);
//card categorys //效果类型
InitCheckPanel(pl_category, datacfg.dicCardcategorys); InitCheckPanel(pl_category, datacfg.dicCardcategorys);
//setname //系列名
List<long> setcodes = DataManager.GetKeys(datacfg.dicSetnames); List<long> setcodes = DataManager.GetKeys(datacfg.dicSetnames);
string[] setnames = DataManager.GetValues(datacfg.dicSetnames); string[] setnames = DataManager.GetValues(datacfg.dicSetnames);
InitComboBox(cb_setname1, setcodes, setnames); InitComboBox(cb_setname1, setcodes, setnames);
...@@ -278,7 +267,7 @@ public void InitControl(DataConfig datacfg) ...@@ -278,7 +267,7 @@ public void InitControl(DataConfig datacfg)
// //
} }
//初始化FlowLayoutPanel //初始化FlowLayoutPanel
void InitCheckPanel(FlowLayoutPanel fpanel, SortedList<long, string> dic) void InitCheckPanel(FlowLayoutPanel fpanel, Dictionary<long, string> dic)
{ {
fpanel.SuspendLayout(); fpanel.SuspendLayout();
fpanel.Controls.Clear(); fpanel.Controls.Clear();
...@@ -286,7 +275,7 @@ void InitCheckPanel(FlowLayoutPanel fpanel, SortedList<long, string> dic) ...@@ -286,7 +275,7 @@ void InitCheckPanel(FlowLayoutPanel fpanel, SortedList<long, string> dic)
{ {
CheckBox _cbox = new CheckBox(); CheckBox _cbox = new CheckBox();
_cbox.Name = fpanel.Name + key.ToString("x"); _cbox.Name = fpanel.Name + key.ToString("x");
_cbox.Tag = key; _cbox.Tag = key;//绑定值
_cbox.Text = dic[key]; _cbox.Text = dic[key];
_cbox.AutoSize = true; _cbox.AutoSize = true;
_cbox.Margin = fpanel.Margin; _cbox.Margin = fpanel.Margin;
...@@ -302,11 +291,12 @@ void PanelOnCheckClick(object sender, EventArgs e) ...@@ -302,11 +291,12 @@ void PanelOnCheckClick(object sender, EventArgs e)
} }
//初始化ComboBox //初始化ComboBox
void InitComboBox(ComboBox cb, SortedList<long, string> tempdic) void InitComboBox(ComboBox cb, Dictionary<long, string> tempdic)
{ {
InitComboBox(cb, DataManager.GetKeys(tempdic), InitComboBox(cb, DataManager.GetKeys(tempdic),
DataManager.GetValues(tempdic)); DataManager.GetValues(tempdic));
} }
//初始化ComboBox
void InitComboBox(ComboBox cb, List<long> keys, string[] values) void InitComboBox(ComboBox cb, List<long> keys, string[] values)
{ {
cb.Items.Clear(); cb.Items.Clear();
...@@ -473,10 +463,10 @@ void SetCard(Card c) ...@@ -473,10 +463,10 @@ void SetCard(Card c)
long sc2 = (c.setcode >> 0x10) & 0xffff; long sc2 = (c.setcode >> 0x10) & 0xffff;
long sc3 = (c.setcode >> 0x20) & 0xffff; long sc3 = (c.setcode >> 0x20) & 0xffff;
long sc4 = (c.setcode >> 0x30) & 0xffff; long sc4 = (c.setcode >> 0x30) & 0xffff;
tb_setcode1.Text = sc1.ToString("x"); //tb_setcode1.Text = sc1.ToString("x");
tb_setcode2.Text = sc2.ToString("x"); //tb_setcode2.Text = sc2.ToString("x");
tb_setcode3.Text = sc3.ToString("x"); //tb_setcode3.Text = sc3.ToString("x");
tb_setcode4.Text = sc4.ToString("x"); //tb_setcode4.Text = sc4.ToString("x");
SetSelect(cb_setname1, sc1); SetSelect(cb_setname1, sc1);
SetSelect(cb_setname2, sc2); SetSelect(cb_setname2, sc2);
SetSelect(cb_setname3, sc3); SetSelect(cb_setname3, sc3);
...@@ -484,9 +474,10 @@ void SetCard(Card c) ...@@ -484,9 +474,10 @@ void SetCard(Card c)
//type,category //type,category
SetCheck(pl_cardtype, c.type); SetCheck(pl_cardtype, c.type);
SetCheck(pl_category, c.category); SetCheck(pl_category, c.category);
//text //Pendulum
tb_pleft.Text = ((c.level >> 0x18) & 0xff).ToString(); tb_pleft.Text = ((c.level >> 0x18) & 0xff).ToString();
tb_pright.Text = ((c.level >> 0x10) & 0xff).ToString(); tb_pright.Text = ((c.level >> 0x10) & 0xff).ToString();
//atk,def
tb_atk.Text = (c.atk < 0) ? "?" : c.atk.ToString(); tb_atk.Text = (c.atk < 0) ? "?" : c.atk.ToString();
tb_def.Text = (c.def < 0) ? "?" : c.def.ToString(); tb_def.Text = (c.def < 0) ? "?" : c.def.ToString();
tb_cardcode.Text = c.id.ToString(); tb_cardcode.Text = c.id.ToString();
...@@ -632,7 +623,7 @@ public bool Open(string file) ...@@ -632,7 +623,7 @@ public bool Open(string file)
return true; return true;
} }
//设置卡片 //设置卡片列表的结果
public void SetCards(Card[] cards, bool isfresh) public void SetCards(Card[] cards, bool isfresh)
{ {
if (cards != null) if (cards != null)
...@@ -641,7 +632,7 @@ public void SetCards(Card[] cards, bool isfresh) ...@@ -641,7 +632,7 @@ public void SetCards(Card[] cards, bool isfresh)
foreach (Card c in cards) foreach (Card c in cards)
{ {
if (srcCard.setcode == 0) if (srcCard.setcode == 0)
cardlist.Add(c); cardlist.Add(c);//setcode搜索在这里进行
else if (c.IsSetCode(srcCard.setcode & 0xffff)) else if (c.IsSetCode(srcCard.setcode & 0xffff))
cardlist.Add(c); cardlist.Add(c);
} }
...@@ -653,7 +644,7 @@ public void SetCards(Card[] cards, bool isfresh) ...@@ -653,7 +644,7 @@ public void SetCards(Card[] cards, bool isfresh)
pageNum = 1; pageNum = 1;
tb_pagenum.Text = pageNum.ToString(); tb_pagenum.Text = pageNum.ToString();
if (isfresh) if (isfresh)//是否跳到之前页数
AddListView(page); AddListView(page);
else else
AddListView(1); AddListView(1);
...@@ -675,6 +666,7 @@ public void Search(Card c, bool isfresh) ...@@ -675,6 +666,7 @@ public void Search(Card c, bool isfresh)
{ {
if (!Check()) if (!Check())
return; return;
//如果临时卡片不为空,则更新,这个在搜索的时候清空
if (tmpCodes.Count > 0) if (tmpCodes.Count > 0)
{ {
Card[] mcards = DataBase.Read(nowCdbFile, Card[] mcards = DataBase.Read(nowCdbFile,
...@@ -703,12 +695,12 @@ public bool AddCard() ...@@ -703,12 +695,12 @@ public bool AddCard()
if (!Check()) if (!Check())
return false; return false;
Card c = GetCard(); Card c = GetCard();
if (c.id <= 0) if (c.id <= 0)//卡片密码不能小于等于0
{ {
MyMsg.Error(LMSG.CodeCanNotIsZero); MyMsg.Error(LMSG.CodeCanNotIsZero);
return false; return false;
} }
foreach (Card ckey in cardlist) foreach (Card ckey in cardlist)//卡片id存在
{ {
if (c.id == ckey.id) if (c.id == ckey.id)
{ {
...@@ -733,7 +725,7 @@ public bool ModCard() ...@@ -733,7 +725,7 @@ public bool ModCard()
return false; return false;
Card c = GetCard(); Card c = GetCard();
if (c.Equals(oldCard)) if (c.Equals(oldCard))//没有修改
{ {
MyMsg.Show(LMSG.ItIsNotChanged); MyMsg.Show(LMSG.ItIsNotChanged);
return false; return false;
...@@ -744,9 +736,9 @@ public bool ModCard() ...@@ -744,9 +736,9 @@ public bool ModCard()
return false; return false;
} }
string sql; string sql;
if (c.id != oldCard.id) if (c.id != oldCard.id)//修改了id
{ {
if (MyMsg.Question(LMSG.IfDeleteCard)) if (MyMsg.Question(LMSG.IfDeleteCard))//是否删除旧卡片
{ {
if (DataBase.Command(nowCdbFile, DataBase.GetDeleteSQL(oldCard)) < 2) if (DataBase.Command(nowCdbFile, DataBase.GetDeleteSQL(oldCard)) < 2)
{ {
...@@ -813,12 +805,10 @@ public bool OpenScript() ...@@ -813,12 +805,10 @@ public bool OpenScript()
string lua = MyPath.Combine(LUAPTH, "c" + tb_cardcode.Text + ".lua"); string lua = MyPath.Combine(LUAPTH, "c" + tb_cardcode.Text + ".lua");
if (!File.Exists(lua)) if (!File.Exists(lua))
{ {
if (!Directory.Exists(LUAPTH)) if (!Directory.Exists(LUAPTH))//创建脚本目录
Directory.CreateDirectory(LUAPTH); Directory.CreateDirectory(LUAPTH);
if (MyMsg.Question(LMSG.IfCreateScript)) if (MyMsg.Question(LMSG.IfCreateScript))//是否创建脚本
{ {
if (!Directory.Exists(LUAPTH))
Directory.CreateDirectory(LUAPTH);
using (FileStream fs = new FileStream( using (FileStream fs = new FileStream(
lua, lua,
FileMode.OpenOrCreate, FileMode.OpenOrCreate,
...@@ -831,7 +821,7 @@ public bool OpenScript() ...@@ -831,7 +821,7 @@ public bool OpenScript()
} }
} }
} }
if (File.Exists(lua)) if (File.Exists(lua))//如果存在,则打开文件
{ {
System.Diagnostics.Process.Start(lua); System.Diagnostics.Process.Start(lua);
} }
...@@ -854,7 +844,7 @@ public void Undo() ...@@ -854,7 +844,7 @@ public void Undo()
//搜索卡片 //搜索卡片
void Btn_serachClick(object sender, EventArgs e) void Btn_serachClick(object sender, EventArgs e)
{ {
tmpCodes.Clear(); tmpCodes.Clear();//清空临时的结果
Search(GetCard(), false); Search(GetCard(), false);
} }
//重置卡片 //重置卡片
...@@ -914,7 +904,7 @@ void Tb_cardcodeKeyPress(object sender, KeyPressEventArgs e) ...@@ -914,7 +904,7 @@ void Tb_cardcodeKeyPress(object sender, KeyPressEventArgs e)
long.TryParse(tb_cardcode.Text, out c.id); long.TryParse(tb_cardcode.Text, out c.id);
if (c.id > 0) if (c.id > 0)
{ {
tmpCodes.Clear(); tmpCodes.Clear();//清空临时的结果
Search(c, false); Search(c, false);
} }
} }
...@@ -928,7 +918,7 @@ void Tb_cardnameKeyDown(object sender, KeyEventArgs e) ...@@ -928,7 +918,7 @@ void Tb_cardnameKeyDown(object sender, KeyEventArgs e)
c.name = tb_cardname.Text; c.name = tb_cardname.Text;
if (c.name.Length > 0) if (c.name.Length > 0)
{ {
tmpCodes.Clear(); tmpCodes.Clear();//清空临时的结果
Search(c, false); Search(c, false);
} }
} }
...@@ -1035,6 +1025,7 @@ void Menuitem_githubClick(object sender, EventArgs e) ...@@ -1035,6 +1025,7 @@ void Menuitem_githubClick(object sender, EventArgs e)
#endregion #endregion
#region 文件菜单 #region 文件菜单
//打开文件
void Menuitem_openClick(object sender, EventArgs e) void Menuitem_openClick(object sender, EventArgs e)
{ {
using (OpenFileDialog dlg = new OpenFileDialog()) using (OpenFileDialog dlg = new OpenFileDialog())
...@@ -1047,6 +1038,7 @@ void Menuitem_openClick(object sender, EventArgs e) ...@@ -1047,6 +1038,7 @@ void Menuitem_openClick(object sender, EventArgs e)
} }
} }
} }
//新建文件
void Menuitem_newClick(object sender, EventArgs e) void Menuitem_newClick(object sender, EventArgs e)
{ {
using (SaveFileDialog dlg = new SaveFileDialog()) using (SaveFileDialog dlg = new SaveFileDialog())
...@@ -1063,7 +1055,7 @@ void Menuitem_newClick(object sender, EventArgs e) ...@@ -1063,7 +1055,7 @@ void Menuitem_newClick(object sender, EventArgs e)
} }
} }
} }
//读取ydk
void Menuitem_readydkClick(object sender, EventArgs e) void Menuitem_readydkClick(object sender, EventArgs e)
{ {
if (!Check()) if (!Check())
...@@ -1082,7 +1074,7 @@ void Menuitem_readydkClick(object sender, EventArgs e) ...@@ -1082,7 +1074,7 @@ void Menuitem_readydkClick(object sender, EventArgs e)
} }
} }
} }
//从图片文件夹读取
void Menuitem_readimagesClick(object sender, EventArgs e) void Menuitem_readimagesClick(object sender, EventArgs e)
{ {
if (!Check()) if (!Check())
...@@ -1108,6 +1100,7 @@ void Menuitem_quitClick(object sender, EventArgs e) ...@@ -1108,6 +1100,7 @@ void Menuitem_quitClick(object sender, EventArgs e)
#endregion #endregion
#region 线程 #region 线程
//是否在执行
bool isRun() bool isRun()
{ {
if (tasker != null && tasker.IsRuning()) if (tasker != null && tasker.IsRuning())
...@@ -1117,7 +1110,7 @@ bool isRun() ...@@ -1117,7 +1110,7 @@ bool isRun()
} }
return false; return false;
} }
//执行任务
void Run(string name) void Run(string name)
{ {
if (isRun()) if (isRun())
...@@ -1185,6 +1178,7 @@ void BgWorker1RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerC ...@@ -1185,6 +1178,7 @@ void BgWorker1RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerC
#endregion #endregion
#region 复制卡片 #region 复制卡片
//得到卡片列表,是否是选中的
public Card[] getCardList(bool onlyselect) public Card[] getCardList(bool onlyselect)
{ {
if (!Check()) if (!Check())
...@@ -1192,9 +1186,6 @@ public Card[] getCardList(bool onlyselect) ...@@ -1192,9 +1186,6 @@ public Card[] getCardList(bool onlyselect)
List<Card> cards = new List<Card>(); List<Card> cards = new List<Card>();
if (onlyselect) if (onlyselect)
{ {
#if DEBUG
MessageBox.Show("select");
#endif
foreach (ListViewItem lvitem in lv_cardlist.SelectedItems) foreach (ListViewItem lvitem in lv_cardlist.SelectedItems)
{ {
int index = lvitem.Index + (page - 1) * MaxRow; int index = lvitem.Index + (page - 1) * MaxRow;
...@@ -1220,6 +1211,7 @@ void Menuitem_copyselecttoClick(object sender, EventArgs e) ...@@ -1220,6 +1211,7 @@ void Menuitem_copyselecttoClick(object sender, EventArgs e)
{ {
CopyTo(true); CopyTo(true);
} }
//保存卡片
public void SaveCards(Card[] cards) public void SaveCards(Card[] cards)
{ {
if (!Check()) if (!Check())
...@@ -1258,6 +1250,7 @@ void CopyTo(bool onlyselect) ...@@ -1258,6 +1250,7 @@ void CopyTo(bool onlyselect)
#endregion #endregion
#region MSE存档 #region MSE存档
//裁剪图片
void Menuitem_cutimagesClick(object sender, EventArgs e) void Menuitem_cutimagesClick(object sender, EventArgs e)
{ {
if (!Check()) if (!Check())
...@@ -1310,9 +1303,6 @@ void SaveAsMSE(bool onlyselect) ...@@ -1310,9 +1303,6 @@ void SaveAsMSE(bool onlyselect)
void Pl_imageDragDrop(object sender, DragEventArgs e) void Pl_imageDragDrop(object sender, DragEventArgs e)
{ {
string[] files = e.Data.GetData(DataFormats.FileDrop) as string[]; string[] files = e.Data.GetData(DataFormats.FileDrop) as string[];
#if DEBUG
MessageBox.Show(files[0]);
#endif
if (File.Exists(files[0])) if (File.Exists(files[0]))
ImportImage(files[0], tb_cardcode.Text); ImportImage(files[0], tb_cardcode.Text);
} }
...@@ -1455,6 +1445,7 @@ bool CheckCard(Card[] cards, Card card, bool checkinfo) ...@@ -1455,6 +1445,7 @@ bool CheckCard(Card[] cards, Card card, bool checkinfo)
} }
return false; return false;
} }
//读取将要对比的数据
Card[] getCompCards() Card[] getCompCards()
{ {
if (tmpCodes.Count == 0) if (tmpCodes.Count == 0)
...@@ -1473,7 +1464,7 @@ public void CompareCards(string cdbfile, bool checktext) ...@@ -1473,7 +1464,7 @@ public void CompareCards(string cdbfile, bool checktext)
Card[] cards = DataBase.Read(cdbfile, true, ""); Card[] cards = DataBase.Read(cdbfile, true, "");
foreach (Card card in mcards) foreach (Card card in mcards)
{ {
if (!CheckCard(cards, card, checktext)) if (!CheckCard(cards, card, checktext))//添加到id集合
tmpCodes.Add(card.id.ToString()); tmpCodes.Add(card.id.ToString());
} }
if (tmpCodes.Count == 0) if (tmpCodes.Count == 0)
...@@ -1486,22 +1477,25 @@ public void CompareCards(string cdbfile, bool checktext) ...@@ -1486,22 +1477,25 @@ public void CompareCards(string cdbfile, bool checktext)
#endregion #endregion
#region MSE配置菜单 #region MSE配置菜单
//把文件添加到菜单
void AddMenuItemFormMSE() void AddMenuItemFormMSE()
{ {
if(!Directory.Exists(datapath)) if(!Directory.Exists(datapath))
return; return;
menuitem_mseconfig.DropDownItems.Clear(); menuitem_mseconfig.DropDownItems.Clear();//清空
string[] files = Directory.GetFiles(datapath); string[] files = Directory.GetFiles(datapath);
foreach (string file in files) foreach (string file in files)
{ {
string name = MyPath.getFullFileName(MSEConfig.TAG, file); string name = MyPath.getFullFileName(MSEConfig.TAG, file);
//是否是MSE配置文件
if (string.IsNullOrEmpty(name)) if (string.IsNullOrEmpty(name))
continue; continue;
//菜单文字是语言
ToolStripMenuItem tsmi = new ToolStripMenuItem(name); ToolStripMenuItem tsmi = new ToolStripMenuItem(name);
tsmi.ToolTipText = file; tsmi.ToolTipText = file;//提示文字为真实路径
tsmi.Click += SetMseConfig_Click; tsmi.Click += SetMseConfig_Click;
if (msecfg.configName.Equals(name, StringComparison.OrdinalIgnoreCase)) if (msecfg.configName.Equals(name, StringComparison.OrdinalIgnoreCase))
tsmi.Checked = true; tsmi.Checked = true;//如果是当前,则打勾
menuitem_mseconfig.DropDownItems.Add(tsmi); menuitem_mseconfig.DropDownItems.Add(tsmi);
} }
} }
...@@ -1512,6 +1506,7 @@ void SetMseConfig_Click(object sender, EventArgs e) ...@@ -1512,6 +1506,7 @@ void SetMseConfig_Click(object sender, EventArgs e)
if (sender is ToolStripMenuItem) if (sender is ToolStripMenuItem)
{ {
ToolStripMenuItem tsmi = (ToolStripMenuItem)sender; ToolStripMenuItem tsmi = (ToolStripMenuItem)sender;
//读取新的配置
msecfg.SetConfig(tsmi.ToolTipText, datapath); msecfg.SetConfig(tsmi.ToolTipText, datapath);
//刷新菜单 //刷新菜单
AddMenuItemFormMSE(); AddMenuItemFormMSE();
...@@ -1540,6 +1535,7 @@ private void menuitem_findluafunc_Click(object sender, EventArgs e) ...@@ -1540,6 +1535,7 @@ private void menuitem_findluafunc_Click(object sender, EventArgs e)
#endregion #endregion
#region 系列名textbox #region 系列名textbox
//系列名输入时
void setCode_InputText(int index, ComboBox cb, TextBox tb) void setCode_InputText(int index, ComboBox cb, TextBox tb)
{ {
if(index>=0 && index < setcodeIsedit.Length) if(index>=0 && index < setcodeIsedit.Length)
...@@ -1550,6 +1546,8 @@ void setCode_InputText(int index, ComboBox cb, TextBox tb) ...@@ -1550,6 +1546,8 @@ void setCode_InputText(int index, ComboBox cb, TextBox tb)
int temp; int temp;
int.TryParse(tb.Text, NumberStyles.HexNumber, null, out temp); int.TryParse(tb.Text, NumberStyles.HexNumber, null, out temp);
//tb.Text = temp.ToString("x"); //tb.Text = temp.ToString("x");
if (temp == 0 && (tb.Text != "0" || tb.Text.Length == 0))
temp = -1;
SetSelect(cb, temp); SetSelect(cb, temp);
setcodeIsedit[index] = false; setcodeIsedit[index] = false;
} }
...@@ -1573,9 +1571,10 @@ private void tb_setcode4_TextChanged(object sender, EventArgs e) ...@@ -1573,9 +1571,10 @@ private void tb_setcode4_TextChanged(object sender, EventArgs e)
{ {
setCode_InputText(4, cb_setname4, tb_setcode4); setCode_InputText(4, cb_setname4, tb_setcode4);
} }
#endregion #endregion
#region 系列名comobox #region 系列名comobox
//系列选择框 选择时
void setCode_Selected(int index, ComboBox cb, TextBox tb) void setCode_Selected(int index, ComboBox cb, TextBox tb)
{ {
if (index >= 0 && index < setcodeIsedit.Length) if (index >= 0 && index < setcodeIsedit.Length)
......
...@@ -11,80 +11,83 @@ namespace DataEditorX.Language ...@@ -11,80 +11,83 @@ namespace DataEditorX.Language
{ {
public enum LMSG : uint public enum LMSG : uint
{ {
titleInfo=0, titleInfo = 0 ,
titleError, titleError = 0x1,
titleWarning, titleWarning = 0x2,
titleQuestion, titleQuestion = 0x3,
CreateSucceed, CreateSucceed = 0x4,
CreateFail, CreateFail = 0x5,
AddSucceed, AddSucceed = 0x6,
AddFail, AddFail = 0x7,
CodeCanNotIsZero, CodeCanNotIsZero = 0x8,
ItIsExists, ItIsExists = 0x9,
ItIsNotChanged, ItIsNotChanged = 0xa,
IfDeleteCard, IfDeleteCard = 0xb,
IfCreateScript, IfCreateScript = 0xc,
IfOpenDataBase, IfOpenDataBase = 0xd,
IfReplaceExistingCard, IfReplaceExistingCard = 0xe,
NowIsNewVersion, NowIsNewVersion = 0xf,
CheckUpdateFail,
HaveNewVersion, CheckUpdateFail = 0x10,
FileIsNotExists, HaveNewVersion = 0x11,
NotSelectDataBase, FileIsNotExists = 0x12,
SelectDataBasePath, NotSelectDataBase = 0x13,
SelectYdkPath, SelectDataBasePath = 0x14,
SelectImagePath, SelectYdkPath = 0x15,
DownloadSucceed, SelectImagePath = 0x16,
DownloadFail, DownloadSucceed = 0x17,
NotSelectScriptText, DownloadFail = 0x18,
DeleteSucceed, NotSelectScriptText = 0x19,
DeleteFail, DeleteSucceed = 0x1a,
ModifySucceed, DeleteFail = 0x1b,
ModifyFail, ModifySucceed = 0x1c,
About, ModifyFail = 0x1d,
Version, About = 0x1e,
Author, Version = 0x1f,
CdbType, Author = 0x20,
ydkType, CdbType = 0x21,
Setcode_error, ydkType = 0x22,
SelectImage, Setcode_error = 0x23,
ImageType, SelectImage = 0x24,
RunError, ImageType =0x25,
checkUpdate, RunError = 0x26,
CopyCardsToDB, checkUpdate = 0x27,
CopyCardsToDBIsOK, CopyCardsToDB = 0x28,
selectMseset, CopyCardsToDBIsOK =0x29,
MseType, selectMseset = 0x2a,
SaveMse, MseType = 0x2b,
SaveMseOK, SaveMse = 0x2c,
CutImage, SaveMseOK = 0x2d,
CutImageOK, CutImage = 0x2e,
NoSelectCard, CutImageOK = 0x2f,
IfReplaceExistingImage,
ConvertImage, NoSelectCard = 0x30,
ConvertImageOK, IfReplaceExistingImage = 0x31,
CompDBOK, ConvertImage = 0x32,
OnlySet, ConvertImageOK = 0x33,
CancelTask, CompDBOK = 0x34,
PauseTask, OnlySet = 0x35,
ResumeTask, CancelTask = 0x36,
TaskError, PauseTask = 0x37,
IfCancelTask, ResumeTask = 0x38,
CopyCards, TaskError = 0x39,
PasteCards, IfCancelTask = 0x3a,
ClearHistory, CopyCards = 0x3b,
ExportData, PasteCards = 0x3c,
ExportDataOK, ClearHistory = 0x3d,
CheckText, ExportData = 0x3e,
CompareOK, ExportDataOK = 0x3f,
OpenFile,
ScriptFilter, CheckText = 0x40,
NewFile, CompareOK = 0x41,
SaveFileOK, OpenFile = 0x42,
IfSaveScript, ScriptFilter =0x43,
NewFile = 0x44,
SaveFileOK = 0x45,
IfSaveScript =0x46,
COUNT, COUNT,
} }
} }
...@@ -37,10 +37,11 @@ private static void Main(string[] args) ...@@ -37,10 +37,11 @@ private static void Main(string[] args)
else else
{ {
//把需要打开的文件写入临时文件 //把需要打开的文件写入临时文件
string tmpfile = Path.Combine(Application.StartupPath, MyConfig.FILE_TEMP); //string tmpfile = Path.Combine(Application.StartupPath, MyConfig.FILE_TEMP);
File.WriteAllText(tmpfile, file); //File.WriteAllText(tmpfile, file);
//发送消息 //发送消息
User32.SendMessage(instance.MainWindowHandle, MyConfig.WM_OPEN, 0, 0); //User32.SendMessage(instance.MainWindowHandle, MyConfig.WM_OPEN, 0, 0);
MyConfig.Open(instance.MainWindowHandle, file);
Environment.Exit(1); Environment.Exit(1);
} }
} }
......
...@@ -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("2.2.9.4")] [assembly: AssemblyVersion("2.2.9.5")]
...@@ -115,6 +115,7 @@ ...@@ -115,6 +115,7 @@
0x800000 超量 0x800000 超量
0x1000000 灵摆 0x1000000 灵摆
##setname ##setname
-1 自定义
0x0 系列 0x0 系列
0x1 正义盟军 A·O·J 0x1 正义盟军 A·O·J
0x2 次世代 ジェネクス 0x2 次世代 ジェネクス
......
...@@ -115,6 +115,7 @@ ...@@ -115,6 +115,7 @@
0x800000 Xyz 0x800000 Xyz
0x1000000 Pendulum 0x1000000 Pendulum
##setname ##setname
-1 Custom
0x0 SetName 0x0 SetName
0x1 A·O·J 0x1 A·O·J
0x2 ジェネクス 0x2 ジェネクス
......
[DataEditorX]2.2.9.4[DataEditorX] [DataEditorX]2.2.9.5[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]
★文件关联(File association) ★文件关联(File association)
...@@ -80,6 +80,8 @@ Ctrl+鼠标左键 跳转到函数定义 ...@@ -80,6 +80,8 @@ Ctrl+鼠标左键 跳转到函数定义
Ctrl+鼠标滑轮 缩放文字 Ctrl+鼠标滑轮 缩放文字
★更新历史 ★更新历史
2.2.9.5
优化选择框
2.2.9.4 2.2.9.4
DataEditor DataEditor
修改游戏数据的查找方式()Dic = >sortlist,加快卡片显示速度 修改游戏数据的查找方式()Dic = >sortlist,加快卡片显示速度
......
No preview for this file type
...@@ -115,6 +115,7 @@ ...@@ -115,6 +115,7 @@
0x800000 超量 0x800000 超量
0x1000000 灵摆 0x1000000 灵摆
##setname ##setname
-1 自定义
0x0 系列 0x0 系列
0x1 正义盟军 A·O·J 0x1 正义盟军 A·O·J
0x2 次世代 ジェネクス 0x2 次世代 ジェネクス
......
...@@ -115,6 +115,7 @@ ...@@ -115,6 +115,7 @@
0x800000 Xyz 0x800000 Xyz
0x1000000 Pendulum 0x1000000 Pendulum
##setname ##setname
-1 Custom
0x0 SetName 0x0 SetName
0x1 A·O·J 0x1 A·O·J
0x2 ジェネクス 0x2 ジェネクス
......
# database history # database history
F:\games\ygopro\cards.cdb F:\games\ygopro\cards.cdb
F:\games\ygopro\p.zip.cdb
# script history # script history
F:\games\ygopro\script\c168917.lua
F:\games\ygopro\script\c218704.lua
F:\games\ygopro\script\c126218.lua
F:\games\ygopro\script\c259314.lua F:\games\ygopro\script\c259314.lua
F:\games\ygopro\script\c62121.lua
F:\games\ygopro\script\c359563.lua F:\games\ygopro\script\c359563.lua
F:\games\ygopro\script\c218704.lua
F:\games\ygopro\script\c42338879.lua F:\games\ygopro\script\c42338879.lua
F:\games\ygopro\script\c42391240.lua F:\games\ygopro\script\c42391240.lua
F:\games\ygopro\script\c191749.lua F:\games\ygopro\script\c191749.lua
......
[DataEditorX]2.2.9.4[DataEditorX] [DataEditorX]2.2.9.5[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]
★文件关联(File association) ★文件关联(File association)
...@@ -80,6 +80,8 @@ Ctrl+鼠标左键 跳转到函数定义 ...@@ -80,6 +80,8 @@ Ctrl+鼠标左键 跳转到函数定义
Ctrl+鼠标滑轮 缩放文字 Ctrl+鼠标滑轮 缩放文字
★更新历史 ★更新历史
2.2.9.5
优化选择框
2.2.9.4 2.2.9.4
DataEditor DataEditor
修改游戏数据的查找方式()Dic = >sortlist,加快卡片显示速度 修改游戏数据的查找方式()Dic = >sortlist,加快卡片显示速度
......
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