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";
......@@ -133,6 +139,7 @@ public class MyConfig
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);
}
}
}
This diff is collapsed.
......@@ -11,80 +11,83 @@ namespace DataEditorX.Language
{
public enum LMSG : uint
{
titleInfo=0,
titleError,
titleWarning,
titleQuestion,
titleInfo = 0 ,
titleError = 0x1,
titleWarning = 0x2,
titleQuestion = 0x3,
CreateSucceed,
CreateFail,
AddSucceed,
AddFail,
CreateSucceed = 0x4,
CreateFail = 0x5,
AddSucceed = 0x6,
AddFail = 0x7,
CodeCanNotIsZero,
ItIsExists,
CodeCanNotIsZero = 0x8,
ItIsExists = 0x9,
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,
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,10 +37,11 @@ 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);
}
}
......
......@@ -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