Commit 4532cde0 authored by JoyJ's avatar JoyJ

add simple syntax check

parent 19748d8b
......@@ -52,6 +52,8 @@ private void InitializeComponent()
this.menuitem_setcard = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_help = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_about = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_tools = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_testlua = new System.Windows.Forms.ToolStripMenuItem();
this.tb_input = new System.Windows.Forms.TextBox();
this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
......@@ -66,7 +68,8 @@ private void InitializeComponent()
this.mainMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.menuitem_file,
this.menuitem_setting,
this.menuitem_help});
this.menuitem_help,
this.menuitem_tools});
this.mainMenu.Location = new System.Drawing.Point(0, 0);
this.mainMenu.Name = "mainMenu";
this.mainMenu.Size = new System.Drawing.Size(705, 25);
......@@ -129,8 +132,8 @@ private void InitializeComponent()
this.menuitem_replace,
this.menuitem_setcard});
this.menuitem_setting.Name = "menuitem_setting";
this.menuitem_setting.Size = new System.Drawing.Size(67, 21);
this.menuitem_setting.Text = "Tools(&S)";
this.menuitem_setting.Size = new System.Drawing.Size(81, 21);
this.menuitem_setting.Text = "Settings(&S)";
//
// menuitem_showmap
//
......@@ -181,10 +184,26 @@ private void InitializeComponent()
// menuitem_about
//
this.menuitem_about.Name = "menuitem_about";
this.menuitem_about.Size = new System.Drawing.Size(111, 22);
this.menuitem_about.Size = new System.Drawing.Size(180, 22);
this.menuitem_about.Text = "About";
this.menuitem_about.Click += new System.EventHandler(this.AboutToolStripMenuItemClick);
//
// menuitem_tools
//
this.menuitem_tools.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.menuitem_testlua});
this.menuitem_tools.Name = "menuitem_tools";
this.menuitem_tools.Size = new System.Drawing.Size(67, 21);
this.menuitem_tools.Text = "Tools(&T)";
//
// menuitem_testlua
//
this.menuitem_testlua.Name = "menuitem_testlua";
this.menuitem_testlua.ShortcutKeys = System.Windows.Forms.Keys.F5;
this.menuitem_testlua.Size = new System.Drawing.Size(180, 22);
this.menuitem_testlua.Text = "Syntax Check";
this.menuitem_testlua.Click += new System.EventHandler(this.menuitem_testlua_Click);
//
// tb_input
//
this.tb_input.BackColor = System.Drawing.SystemColors.Control;
......@@ -226,6 +245,8 @@ private void InitializeComponent()
this.fctb.CharWidth = 10;
this.fctb.CommentPrefix = "--";
this.fctb.Cursor = System.Windows.Forms.Cursors.IBeam;
this.fctb.DelayedEventsInterval = 1;
this.fctb.DelayedTextChangedInterval = 1;
this.fctb.DisabledColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(180)))), ((int)(((byte)(180)))), ((int)(((byte)(180)))));
this.fctb.Dock = System.Windows.Forms.DockStyle.Fill;
this.fctb.Font = new System.Drawing.Font("Consolas", 14.25F);
......@@ -244,8 +265,10 @@ private void InitializeComponent()
this.fctb.RightBracket = ')';
this.fctb.RightBracket2 = '}';
this.fctb.SelectionColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(255)))));
this.fctb.ServiceColors = ((FastColoredTextBoxNS.ServiceColors)(resources.GetObject("fctb.ServiceColors")));
this.fctb.Size = new System.Drawing.Size(514, 369);
this.fctb.TabIndex = 0;
this.fctb.ToolTipDelay = 1;
this.fctb.WordWrap = true;
this.fctb.Zoom = 100;
this.fctb.ToolTipNeeded += new System.EventHandler<FastColoredTextBoxNS.ToolTipNeededEventArgs>(this.FctbToolTipNeeded);
......@@ -308,7 +331,7 @@ private void InitializeComponent()
private System.Windows.Forms.MenuStrip mainMenu;
private System.ComponentModel.BackgroundWorker backgroundWorker1;
private System.Windows.Forms.ToolTip toolTip1;
}
private System.Windows.Forms.ToolStripMenuItem menuitem_tools;
private System.Windows.Forms.ToolStripMenuItem menuitem_testlua;
}
}
......@@ -10,6 +10,7 @@
using DataEditorX.Core;
using DataEditorX.Language;
using FastColoredTextBoxNS;
using Neo.IronLua;
using System;
using System.Collections.Generic;
using System.Drawing;
......@@ -601,5 +602,31 @@ void FctbMouseClick(object sender, MouseEventArgs e)
}
#endregion
private void menuitem_testlua_Click(object sender, EventArgs e)
{
string fn = new FileInfo(this.nowFile).Name;
if (!fn.ToUpper().EndsWith(".LUA"))
{
return;
}
string cCode = fn.Substring(0,fn.Length - 4);
bool error=false;
try
{
Lua lua = new Lua();
var env = lua.CreateEnvironment();
env.DoChunk("Duel={} Effect={} Card={} aux={} Auxiliary={} _G={}" + cCode + "={} " + this.fctb.Text,"test.lua");
}
catch(LuaException ex)
{
MessageBox.Show($"LINE{ex.Line} - {ex.Message}");
error = true;
}
if (!error)
{
MyMsg.Show(LMSG.syntaxCheckPassed);
}
}
}
}
......@@ -112,21 +112,39 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="mainMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="mainMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="backgroundWorker1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="backgroundWorker1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>132, 17</value>
</metadata>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>306, 17</value>
</metadata>
<data name="fctb.Hotkeys" xml:space="preserve">
<value>Tab=IndentIncrease, Escape=ClearHints, PgUp=GoPageUp, PgDn=GoPageDown, End=GoEnd, Home=GoHome, Left=GoLeft, Up=GoUp, Right=GoRight, Down=GoDown, Ins=ReplaceMode, Del=DeleteCharRight, F3=FindNext, Shift+Tab=IndentDecrease, Shift+PgUp=GoPageUpWithSelection, Shift+PgDn=GoPageDownWithSelection, Shift+End=GoEndWithSelection, Shift+Home=GoHomeWithSelection, Shift+Left=GoLeftWithSelection, Shift+Up=GoUpWithSelection, Shift+Right=GoRightWithSelection, Shift+Down=GoDownWithSelection, Shift+Ins=Paste, Shift+Del=Cut, Ctrl+Back=ClearWordLeft, Ctrl+Space=AutocompleteMenu, Ctrl+End=GoLastLine, Ctrl+Home=GoFirstLine, Ctrl+Left=GoWordLeft, Ctrl+Up=ScrollUp, Ctrl+Right=GoWordRight, Ctrl+Down=ScrollDown, Ctrl+Ins=Copy, Ctrl+Del=ClearWordRight, Ctrl+0=ZoomNormal, Ctrl+A=SelectAll, Ctrl+B=BookmarkLine, Ctrl+C=Copy, Ctrl+E=MacroExecute, Ctrl+F=FindDialog, Ctrl+G=GoToDialog, Ctrl+H=ReplaceDialog, Ctrl+I=AutoIndentChars, Ctrl+M=MacroRecord, Ctrl+R=Redo, Ctrl+U=UpperCase, Ctrl+V=Paste, Ctrl+X=Cut, Ctrl+Z=Undo, Ctrl+Add=ZoomIn, Ctrl+Subtract=ZoomOut, Ctrl+F3=GoNextBookmark, Ctrl+OemMinus=NavigateBackward, Ctrl+Shift+End=GoLastLineWithSelection, Ctrl+Shift+Home=GoFirstLineWithSelection, Ctrl+Shift+Left=GoWordLeftWithSelection, Ctrl+Shift+Right=GoWordRightWithSelection, Ctrl+Shift+B=UnbookmarkLine, Ctrl+Shift+C=CommentSelected, Ctrl+Shift+N=GoPrevBookmark, Ctrl+Shift+U=LowerCase, Ctrl+Shift+OemMinus=NavigateForward, Alt+Back=Undo, Alt+Up=MoveSelectedLinesUp, Alt+Down=MoveSelectedLinesDown, Alt+F=FindChar, Alt+Shift+Left=GoLeft_ColumnSelectionMode, Alt+Shift+Up=GoUp_ColumnSelectionMode, Alt+Shift+Right=GoRight_ColumnSelectionMode, Alt+Shift+Down=GoDown_ColumnSelectionMode</value>
</data>
<data name="fctb.ServiceColors" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAFdGYXN0Q29sb3JlZFRleHRCb3gsIFZlcnNpb249Mi4xNi4yNC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWZiOGFhMTJiOTk0ZWY2MWIMAwAAAFFTeXN0
ZW0uRHJhd2luZywgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2Vu
PWIwM2Y1ZjdmMTFkNTBhM2EFAQAAACJGYXN0Q29sb3JlZFRleHRCb3hOUy5TZXJ2aWNlQ29sb3JzBgAA
ACg8Q29sbGFwc2VNYXJrZXJGb3JlQ29sb3I+a19fQmFja2luZ0ZpZWxkKDxDb2xsYXBzZU1hcmtlckJh
Y2tDb2xvcj5rX19CYWNraW5nRmllbGQqPENvbGxhcHNlTWFya2VyQm9yZGVyQ29sb3I+a19fQmFja2lu
Z0ZpZWxkJjxFeHBhbmRNYXJrZXJGb3JlQ29sb3I+a19fQmFja2luZ0ZpZWxkJjxFeHBhbmRNYXJrZXJC
YWNrQ29sb3I+a19fQmFja2luZ0ZpZWxkKDxFeHBhbmRNYXJrZXJCb3JkZXJDb2xvcj5rX19CYWNraW5n
RmllbGQEBAQEBAQUU3lzdGVtLkRyYXdpbmcuQ29sb3IDAAAAFFN5c3RlbS5EcmF3aW5nLkNvbG9yAwAA
ABRTeXN0ZW0uRHJhd2luZy5Db2xvcgMAAAAUU3lzdGVtLkRyYXdpbmcuQ29sb3IDAAAAFFN5c3RlbS5E
cmF3aW5nLkNvbG9yAwAAABRTeXN0ZW0uRHJhd2luZy5Db2xvcgMAAAACAAAABfz///8UU3lzdGVtLkRy
YXdpbmcuQ29sb3IEAAAABG5hbWUFdmFsdWUKa25vd25Db2xvcgVzdGF0ZQEAAAAJBwcDAAAACgAAAAAA
AAAAlgABAAH7/////P///woAAAAAAAAAAKQAAQAB+v////z///8KAAAAAAAAAACWAAEAAfn////8////
CgAAAAAAAAAAjQABAAH4/////P///woAAAAAAAAAAKQAAQAB9/////z///8KAAAAAAAAAACWAAEACw==
</value>
</data>
</root>
\ No newline at end of file
......@@ -62,7 +62,11 @@
<Reference Include="FastColoredTextBox, Version=2.16.24.0, Culture=neutral, PublicKeyToken=fb8aa12b994ef61b, processorArchitecture=MSIL">
<HintPath>..\packages\FCTB.2.16.24\lib\FastColoredTextBox.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="Neo.Lua, Version=5.3.0.0, Culture=neutral, PublicKeyToken=fdb0cd4fe8a6e3b2, processorArchitecture=MSIL">
<HintPath>..\packages\NeoLua.1.3.11\lib\net45\Neo.Lua.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>DLL\Newtonsoft.Json.dll</HintPath>
</Reference>
......
......@@ -93,6 +93,7 @@ public enum LMSG : uint
PlzRestart = 0x49,
exportMseImages = 0x4a,
exportMseImagesErr = 0x4b,
syntaxCheckPassed = 0x4c,
COUNT,
}
}
......@@ -27,4 +27,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("3.0.0.1")]
[assembly: AssemblyVersion("3.0.0.2")]
......@@ -46,7 +46,7 @@
IME = true 使用輸入法,正常顯示文字,反應變慢
IME = false English
-->
<add key="IME" value="false"/>
<add key="IME" value="true"/>
<add key="wordwrap" value="true"/>
<add key="tabisspace" value="false"/>
<add key="fontname" value="Consolas"/>
......
......@@ -12,6 +12,8 @@ CodeEditForm.mainMenu.menuitem_replace 替换
CodeEditForm.mainMenu.menuitem_setcard 设置卡片库
CodeEditForm.mainMenu.menuitem_help 帮助(&H)
CodeEditForm.mainMenu.menuitem_about 关于
CodeEditForm.mainMenu.menuitem_testlua 语法错误检查
CodeEditForm.mainMenu.menuitem_tools 工具(&T)
#
DataEditForm.pl_bottom.btn_img 导入图片
DataEditForm.pl_main.splitContainer..lb_types 卡片类型
......@@ -168,3 +170,4 @@ MainForm.mainMenu.menuitem_closeall 关闭所有
0x49 请重启程序使更改生效。
0x4a 从MSE存档导出图片完成。
0x4b 从MSE存档导出图片失败。
0x4c 测试完成,没有发现语法错误。
......@@ -2,6 +2,8 @@
<packages>
<package id="EntityFramework" version="6.4.4" targetFramework="net46" />
<package id="FCTB" version="2.16.24" targetFramework="net46" />
<package id="Microsoft.CSharp" version="4.5.0" targetFramework="net46" />
<package id="NeoLua" version="1.3.11" targetFramework="net46" />
<package id="System.Data.SQLite" version="1.0.113.1" targetFramework="net46" />
<package id="System.Data.SQLite.Core" version="1.0.113.1" targetFramework="net46" />
<package id="System.Data.SQLite.EF6" version="1.0.113.0" targetFramework="net46" />
......
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