Exemple #1
0
        private void luaEditorControl1_queryObjects(object sender, luaEditor.QueryEventsArgs e)
        {
            string strOut = "";
            IntPtr ls_out = IntPtr.Zero;

            //参数规定:
            //szCode:   所有的代码
            //nPos:     光标位置(汉字按2个字符算)
            //nIsDelete 0为正常输入,1为删除,
            //  11-22为F1-F12,
            //  1111代表Ctrl+Shift+F1,
            //  1011代表Ctrl+F1
            //   111代表Shift+F1
            int nIsDelete = e.nPos > 0 ? 0 : 1;

            if (e.keyword != "")
            {
                nIsDelete = 10 + Int32.Parse(e.keyword);
            }

            bool bret = LuaRuntime.LuaRun("OnCodeSense", e.szCode, Math.Abs(e.nPos), nIsDelete, "true,1024,显示所有,1,false,语法检查", ref ls_out);
            strOut = Marshal.PtrToStringAnsi(ls_out);

            if (bret == false)
            {
                MessageBox.Show(strOut, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (strOut == null)
            {
                return;
            }

            string[] as_data = strOut.Split(new char[] { '|' });
            if (as_data.Length < 3)
            {
                MessageBox.Show("返回值不正确,返回值为:" + strOut, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // 读取overlen
            e.nOverLen = Int32.Parse((as_data[0]));

            // 初始化游标
            int nPosition = 3;

            // 读取list
            int nListCount = Int32.Parse((as_data[1]));
            if (as_data.Length < 3 + nListCount)
            {
                MessageBox.Show("List返回值个数不正确,返回值为:" + strOut, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            for (int i = 0; i < nListCount; i++)
            {
                string s_name = as_data[nPosition++] as string;
                string s_word = as_data[nPosition++] as string;
                string s_type = as_data[nPosition++] as string;
                string s_info = as_data[nPosition++] as string;
                e.leTable.Add(s_name, new luaEditor.leTableItem(s_name, s_type, s_word, s_info));

            }

            // 读取info
            int nInfoCount = Int32.Parse((as_data[2]));
            if (as_data.Length < 3 + nListCount + nInfoCount)
            {
                MessageBox.Show("Info返回值个数不正确,返回值为:" + strOut, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            for (int i = 0; i < nInfoCount; i++)
            {
                string s_text = as_data[nPosition++] as string;
                e.parms_list.Add(s_text.Replace("\n", "<BR>"));
            }
        }
Exemple #2
0
 /// <summary>
 /// 智能感知
 /// </summary>
 /// <param name="sender">事件发送者</param>
 /// <param name="e">事件参数</param>
 private void codeEditBox_queryObjects(object sender, luaEditor.QueryEventsArgs e)
 {
     AIDiagramHelper.QueryObjects(sender, e);            
 }
Exemple #3
0
 public svEventsArgs(luaEditor.luaEditorControl luace)
 {
     this.luace = luace;
 }