Commit 1bea0f6c authored by keyongyu's avatar keyongyu

2.2.9.5

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