private void RunBtn_Click(object sender, EventArgs e)
        {
            Stopwatch stopWatch = new Stopwatch();  // Create a high resolution time

            SLAB.Text = "";
            TV.Nodes.Clear();

            // Reset all colors
            rtb.SelectAll();
            rtb.SelectionBackColor = BGColor;
            rtb.SelectionColor     = FGColor;

            string  pattern  = TB.Text.Trim();
            string  source   = rtb.Text;
            Boolean isGlobal = false;

            if (clearCache.Checked)
            {
                Regex.CacheSize    = 0;
                clearCache.Checked = false;
            }

            RegexOptions theOpts = RegexOptions.None;

            foreach (var item in CB.CheckedItems)
            {
                if (item.ToString().ToLower() == "global")
                {
                    isGlobal = true;
                }
                if (item.ToString().ToLower() == "multiline")
                {
                    theOpts = theOpts | RegexOptions.Multiline;
                }
                if (item.ToString().ToLower() == "ignore case")
                {
                    theOpts = theOpts | RegexOptions.IgnoreCase;
                }
                if (item.ToString().ToLower() == "singleline")
                {
                    theOpts = theOpts | RegexOptions.Singleline;
                }
                if (item.ToString().ToLower() == "compiled")
                {
                    theOpts = theOpts | RegexOptions.Compiled;
                }
                if (item.ToString().ToLower() == "ignorepatternwhitespace")
                {
                    theOpts = theOpts | RegexOptions.IgnorePatternWhitespace;
                }
                if (item.ToString().ToLower() == "righttoleft")
                {
                    theOpts = theOpts | RegexOptions.RightToLeft;
                }
                if (item.ToString().ToLower() == "emcascript")
                {
                    theOpts = theOpts | RegexOptions.ECMAScript;
                }
                if (item.ToString().ToLower() == "cultureinvariant")
                {
                    theOpts = theOpts | RegexOptions.CultureInvariant;
                }
            }



            // Start the timer
            stopWatch.Start();

            List <TreeNode> rootNode  = new List <TreeNode>();
            int             TreeIndex = -1;

            // If global, then iterate the Matches collection
            if (isGlobal)
            {
                try
                {
                    Regex theExpr = new Regex(pattern, theOpts);

                    foreach (Match match in theExpr.Matches(source))
                    {
                        int endindex = match.Length;
                        rtb.Select(match.Index, endindex);
                        rtb.SelectionBackColor = BGHighlight;
                        rtb.SelectionColor     = FGHighlight;

                        rootNode.Add(TV.Nodes.Add("[ " + match.Value + " ]"));
                        TreeIndex++;


                        foreach (string groupName in theExpr.GetGroupNames())
                        {
                            Group theGroup = match.Groups[groupName];
                            if (groupName != "0")
                            {
                                TreeNode ChildNode = rootNode[TreeIndex].Nodes.Add("<" + groupName + "> (" + theGroup + ")");
                                foreach (Capture theCapture in theGroup.Captures)
                                {
                                    ChildNode.Nodes.Add(theCapture.Value);
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    SLAB.Text = ex.Message;
                }
            }
            else
            {
                try
                {
                    Regex theExpr  = new Regex(pattern, theOpts);
                    Match theMatch = theExpr.Match(source);
                    if (theMatch.Success)
                    {
                        int endindex = theMatch.Length;
                        rtb.Select(theMatch.Index, endindex);
                        rtb.SelectionBackColor = BGHighlight;
                        rtb.SelectionColor     = FGHighlight;

                        string theDay     = theMatch.Groups["Digit"].Value;
                        string theLetters = theMatch.Groups[2].Value;

                        CultureInfo defaultCulture = Thread.CurrentThread.CurrentCulture;
                        Thread.CurrentThread.CurrentCulture = new CultureInfo("tr-TR");

                        // Process the regex, using tr-FR (French) casing rules

                        Thread.CurrentThread.CurrentCulture = defaultCulture;


                        rootNode.Add(TV.Nodes.Add("[ " + theMatch.Value + " ]"));
                        TreeIndex++;

                        foreach (string groupName in theExpr.GetGroupNames())
                        {
                            Group theGroup = theMatch.Groups[groupName];
                            if (groupName != "0")
                            {
                                TreeNode ChildNode = rootNode[TreeIndex].Nodes.Add("<" + groupName + "> (" + theGroup + ")");
                                foreach (Capture theCapture in theGroup.Captures)
                                {
                                    ChildNode.Nodes.Add(theCapture.Value);
                                }
                            }
                        }
                    }
                    else

                    {
                        SLAB.Text = "Not found...";
                    }
                }
                catch (Exception ex)
                {
                    SLAB.Text = ex.Message;
                }
            }
            TV.ExpandAll();

            // Record how long the processing took
            stopWatch.Stop();
            TimeSpan HowLong    = stopWatch.Elapsed;
            Double   TotalTicks = HowLong.TotalMilliseconds;

            TimeLabel.Text = TotalTicks.ToString("F3") + " ms";
        }
Exemplo n.º 2
0
 private void cmdExpandModels_Click(object sender, EventArgs e)
 {
     TV.ExpandAll();
 }
Exemplo n.º 3
0
    /// <summary>
    /// 重新加载菜单
    /// </summary>
    private void ReLoadNode()
    {
        errmsg.Text = "";

        tbshowname    = "所有权限组";
        dbtbname.Text = "auth_group";


        if (Request["sortid"] == null || Request["sortid"].ToString().Trim() == "")
        {
            sh_SortID.Text = "0";
            ee_SortID.Text = "0";
        }
        else
        {
            sh_SortID.Text = Request["sortid"].ToString().Trim();
            ee_SortID.Text = Request["sortid"].ToString().Trim();
        }


        //加载原始数据等待修改
        if (sh_SortID.Text == "0" || sh_SortID.Text == "" || dbtbname.Text == "")
        {
        }
        else
        {
            //调用执行方法获取数据
            DataSet  dsD     = new DataSet();
            object[] re_dsiD = IPC.Call("获取单条菜单数据", new object[] { dbtbname.Text, sh_SortID.Text });
            if (re_dsiD[0].ToString() == "ok")
            {
                //这个就是得到远程方法真正的返回值,不同类型的,自行进行强制转换即可。
                dsD = (DataSet)re_dsiD[1];
                try
                {
                    ee_SortName.Text = dsD.Tables["数据记录"].Rows[0]["SortName"].ToString();
                    sh_SortName.Text = dsD.Tables["数据记录"].Rows[0]["SortName"].ToString();

                    //把已有的权限分解并展示
                    Dictionary <string, string> dic_Unumber1 = AuthComm.GetEnumFormUnumber(dsD.Tables["数据记录"].Rows[0]["Unumber1"].ToString());
                    foreach (KeyValuePair <string, string> kv in dic_Unumber1)
                    {
                        ListItem lt = Unumber1.Items.FindByValue(kv.Value);
                        if (lt != null)
                        {
                            lt.Selected = true;
                        }
                    }

                    Dictionary <string, string> dic_Unumber2 = AuthComm.GetEnumFormUnumber(dsD.Tables["数据记录"].Rows[0]["Unumber2"].ToString());
                    foreach (KeyValuePair <string, string> kv in dic_Unumber2)
                    {
                        ListItem lt = Unumber2.Items.FindByValue(kv.Value);
                        if (lt != null)
                        {
                            lt.Selected = true;
                        }
                    }

                    Dictionary <string, string> dic_Unumber3 = AuthComm.GetEnumFormUnumber(dsD.Tables["数据记录"].Rows[0]["Unumber3"].ToString());
                    foreach (KeyValuePair <string, string> kv in dic_Unumber3)
                    {
                        ListItem lt = Unumber3.Items.FindByValue(kv.Value);
                        if (lt != null)
                        {
                            lt.Selected = true;
                        }
                    }

                    Dictionary <string, string> dic_Unumber4 = AuthComm.GetEnumFormUnumber(dsD.Tables["数据记录"].Rows[0]["Unumber4"].ToString());
                    foreach (KeyValuePair <string, string> kv in dic_Unumber4)
                    {
                        ListItem lt = Unumber4.Items.FindByValue(kv.Value);
                        if (lt != null)
                        {
                            lt.Selected = true;
                        }
                    }

                    Dictionary <string, string> dic_Unumber5 = AuthComm.GetEnumFormUnumber(dsD.Tables["数据记录"].Rows[0]["Unumber5"].ToString());
                    foreach (KeyValuePair <string, string> kv in dic_Unumber5)
                    {
                        ListItem lt = Unumber5.Items.FindByValue(kv.Value);
                        if (lt != null)
                        {
                            lt.Selected = true;
                        }
                    }
                }
                catch (Exception ex)
                {
                    errmsg.Text = "获取数据出错";
                }
            }
            else
            {
                errmsg.Text = re_dsiD[1].ToString();//向客户端输出错误字符串
            }
        }

        TV.Nodes.Clear();
        //调用执行方法获取数据
        DataTable dt = new DataTable();

        object[] re_dsi = IPC.Call("获取菜单数据", new object[] { dbtbname.Text, 0, 1 });
        if (re_dsi[0].ToString() == "ok")
        {
            //这个就是得到远程方法真正的返回值,不同类型的,自行进行强制转换即可。
            dt = (DataTable)re_dsi[1];
        }
        else
        {
            errmsg.Text = re_dsi[1].ToString();//向客户端输出错误字符串
        }
        this.InitNode(dt);
        TV.ExpandAll();
    }
Exemplo n.º 4
0
    /// <summary>
    /// 重新加载菜单
    /// </summary>
    private void ReLoadNode()
    {
        errmsg.Text = "";
        ht_nemu_tb["auth_menu_b"] = "后台菜单";
        ht_nemu_tb["auth_menu_f"] = "前台菜单";

        if (Request["tb"] == null || Request["tb"].ToString().Trim() == "")
        {
            tbshowname    = "后台菜单";
            dbtbname.Text = "auth_menu_b";
        }
        else
        {
            string tb1 = Request["tb"].ToString().Trim();
            if (ht_nemu_tb.Contains(tb1))
            {
                tbshowname = ht_nemu_tb[tb1].ToString();
            }
            else
            {
                tbshowname = "";
            }
            dbtbname.Text = tb1;
        }

        if (Request["sortid"] == null || Request["sortid"].ToString().Trim() == "")
        {
            sh_SortID.Text = "0";
            ee_SortID.Text = "0";
        }
        else
        {
            sh_SortID.Text = Request["sortid"].ToString().Trim();
            ee_SortID.Text = Request["sortid"].ToString().Trim();
        }

        //加载原始数据等待修改
        if (sh_SortID.Text == "0" || sh_SortID.Text == "" || dbtbname.Text == "")
        {
        }
        else
        {
            //调用执行方法获取数据
            DataSet  dsD     = new DataSet();
            object[] re_dsiD = IPC.Call("获取单条菜单数据", new object[] { dbtbname.Text, sh_SortID.Text });
            if (re_dsiD[0].ToString() == "ok")
            {
                //这个就是得到远程方法真正的返回值,不同类型的,自行进行强制转换即可。
                dsD = (DataSet)re_dsiD[1];
                try {
                    ee_SortName.Text = dsD.Tables["数据记录"].Rows[0]["SortName"].ToString();
                    sh_SortName.Text = dsD.Tables["数据记录"].Rows[0]["SortName"].ToString();

                    ee_m_url.Text = dsD.Tables["数据记录"].Rows[0]["m_url"].ToString();
                    ee_m_tip.Text = dsD.Tables["数据记录"].Rows[0]["m_tip"].ToString();
                    ee_m_tag.Text = dsD.Tables["数据记录"].Rows[0]["m_tag"].ToString();
                    ee_m_ico.Text = dsD.Tables["数据记录"].Rows[0]["m_ico"].ToString();
                    string yc = dsD.Tables["数据记录"].Rows[0]["m_show"].ToString();
                    if (yc == "不隐藏")
                    {
                        ee_m_show1.Checked = true;
                        ee_m_show0.Checked = false;
                    }
                    else
                    {
                        ee_m_show1.Checked = false;
                        ee_m_show0.Checked = true;
                    }
                }
                catch (Exception ex)
                {
                    errmsg.Text = "获取数据出错";
                }
            }
            else
            {
                errmsg.Text = re_dsiD[1].ToString();//向客户端输出错误字符串
            }
        }

        TV.Nodes.Clear();
        //调用执行方法获取数据
        DataTable dt = new DataTable();

        object[] re_dsi = IPC.Call("获取菜单数据", new object[] { dbtbname.Text, 0, 1 });
        if (re_dsi[0].ToString() == "ok")
        {
            //这个就是得到远程方法真正的返回值,不同类型的,自行进行强制转换即可。
            dt = (DataTable)re_dsi[1];
        }
        else
        {
            errmsg.Text = re_dsi[1].ToString();//向客户端输出错误字符串
        }
        this.InitNode(dt);
        TV.ExpandAll();
    }