當前位置: 首頁>>代碼示例>>C#>>正文


C# AutoIndentEventArgs類代碼示例

本文整理匯總了C#中AutoIndentEventArgs的典型用法代碼示例。如果您正苦於以下問題:C# AutoIndentEventArgs類的具體用法?C# AutoIndentEventArgs怎麽用?C# AutoIndentEventArgs使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AutoIndentEventArgs類屬於命名空間,在下文中一共展示了AutoIndentEventArgs類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: PHPAutoIndentNeeded

 private void PHPAutoIndentNeeded(object sender, AutoIndentEventArgs args)
 {
     /*
     FastColoredTextBox tb = sender as FastColoredTextBox;
     tb.CalcAutoIndentShiftByCodeFolding(sender, args);*/
     //block {}
     if (Regex.IsMatch(args.LineText, @"^[^string.Empty']*\{.*\}[^string.Empty']*$"))
         return;
     //start of block {}
     if (Regex.IsMatch(args.LineText, @"^[^string.Empty']*\{"))
     {
         args.ShiftNextLines = args.TabLength;
         return;
     }
     //end of block {}
     if (Regex.IsMatch(args.LineText, @"}[^string.Empty']*$"))
     {
         args.Shift = -args.TabLength;
         args.ShiftNextLines = -args.TabLength;
         return;
     }
     //is unclosed operator in previous line ?
     if (Regex.IsMatch(args.PrevLineText, @"^\s*(if|for|foreach|while|[\}\s]*else)\b[^{]*$"))
         if (!Regex.IsMatch(args.PrevLineText, @"(;\s*$)|(;\s*//)"))//operator is unclosed
         {
             args.Shift = args.TabLength;
             return;
         } 
 }
開發者ID:ndrake,項目名稱:blink1,代碼行數:29,代碼來源:SyntaxHighlighter.cs

示例2: fctb_AutoIndentNeeded

 void fctb_AutoIndentNeeded(object sender, AutoIndentEventArgs e)
 {
     // if current line is "begin" then next
     // line shift to right
     if (e.LineText.Trim() == "begin")
     {
         e.ShiftNextLines = e.TabLength;
         return;
     }
     // if current line is "end" then current
     // and next line shift to left
     if (e.LineText.Trim() == "end")
     {
         e.Shift = -e.TabLength;
         e.ShiftNextLines = -e.TabLength;
         return;
     }
     // if previous line contains "then" or "else",
     // and current line do not contain "begin"
     // then shift current line to right
     if (Regex.IsMatch(e.PrevLineText, @"\b(then|else)\b") &&
         !Regex.IsMatch(e.LineText, @"\bbegin\b"))
     {
         e.Shift = e.TabLength;
         return;
     }
 }
開發者ID:Demirbilekmt,項目名稱:FastColored-TextBox-Unicode,代碼行數:27,代碼來源:AutoIndentSample.cs

示例3: fctb_AutoIndentNeeded

 private void fctb_AutoIndentNeeded(object sender, AutoIndentEventArgs e)
 {
     if (Regex.IsMatch(e.PrevLineText, @"^\s*For\(.*\)"))
     {
         e.Shift = e.Shift + e.TabLength;
         e.ShiftNextLines = e.ShiftNextLines + e.TabLength;
         return;
     }
     if (Regex.IsMatch(e.PrevLineText, @"^\s*If\(.*\)"))
     {
         e.Shift = e.Shift + e.TabLength;
         e.ShiftNextLines = e.ShiftNextLines + e.TabLength;
         return;
     }
     if (Regex.IsMatch(e.LineText, @"###"))
     {
         e.Shift = e.Shift - e.TabLength;
         e.ShiftNextLines = e.ShiftNextLines - e.TabLength;
         return;
     }
     if (Regex.IsMatch(e.LineText, @"\$\$\$"))
     {
         e.Shift = e.Shift - e.TabLength;
         e.ShiftNextLines = e.ShiftNextLines - e.TabLength;
         return;
     }
 }
開發者ID:0xack13,項目名稱:FastColoredTextBox,代碼行數:27,代碼來源:Sandbox.cs

示例4: AutoIndentNeeded

 public virtual void AutoIndentNeeded(object sender, AutoIndentEventArgs args)
 {
     FastColoredTextBox tb = (sender as FastColoredTextBox);
     Language language = tb.Language;
     switch (language)
     {
         case Language.CSharp: CSharpAutoIndentNeeded(sender, args); break;
         case Language.VB: VBAutoIndentNeeded(sender, args); break;
         case Language.HTML: HTMLAutoIndentNeeded(sender, args); break;
         case Language.SQL: SQLAutoIndentNeeded(sender, args); break;
         case Language.PHP: PHPAutoIndentNeeded(sender, args); break;
         default:
             break;
     }
 }
開發者ID:ndrake,項目名稱:blink1,代碼行數:15,代碼來源:SyntaxHighlighter.cs

示例5: AutoIndentNeeded

        public virtual void AutoIndentNeeded(object sender, AutoIndentEventArgs args)
        {
            var tb = (sender as FastColoredTextBox);
            switch (tb.Language)

            {
                case "CSharp":
                    CSharpAutoIndentNeeded(sender, args);
                    break;

                case "VB":
                    VBAutoIndentNeeded(sender, args);
                    break;

                case "HTML":
                    HTMLAutoIndentNeeded(sender, args);
                    break;

                case "Xml":
                    HTMLAutoIndentNeeded(sender, args);
                    break;

                case "SQL":
                    SQLAutoIndentNeeded(sender, args);
                    break;

                case "PHP":
                    PHPAutoIndentNeeded(sender, args);
                    break;

                case "Python":
                    PythonAutoIndentNeeded(sender, args);
                    break;
                case "Ruby":
                    RubyAutoIndentNeeded(sender, args);
                    break;
                case "Lua":
                    LuaAutoIndentNeeded(sender, args);
                    break;
                default:
                    CSharpAutoIndentNeeded(sender, args);
                    break;
            }
        }
開發者ID:samarjeet27,項目名稱:ynoteclassic,代碼行數:44,代碼來源:SyntaxHighlighter.cs

示例6: CSharpAutoIndentNeeded

 private void CSharpAutoIndentNeeded(object sender, AutoIndentEventArgs args)
 {
     //block {}
     if (Regex.IsMatch(args.LineText, @"^[^""']*\{.*\}[^""']*$"))
         return;
     //start of block {}
     if (Regex.IsMatch(args.LineText, @"^[^""']*\{"))
     {
         args.ShiftNextLines = args.TabLength;
         return;
     }
     //end of block {}
     if (Regex.IsMatch(args.LineText, @"}[^""']*$"))
     {
         args.Shift = -args.TabLength;
         args.ShiftNextLines = -args.TabLength;
         return;
     }
     //label
     if (Regex.IsMatch(args.LineText, @"^\s*\w+\s*:\s*($|//)") &&
         !Regex.IsMatch(args.LineText, @"^\s*default\s*:"))
     {
         args.Shift = -args.TabLength;
         return;
     }
     //some statements: case, default
     if (Regex.IsMatch(args.LineText, @"^\s*(case|default)\b.*:\s*($|//)"))
     {
         args.Shift = -args.TabLength/2;
         return;
     }
     //is unclosed operator in previous line ?
     if (Regex.IsMatch(args.PrevLineText, @"^\s*(if|for|foreach|while|[\}\s]*else)\b[^{]*$"))
         if (!Regex.IsMatch(args.PrevLineText, @"(;\s*$)|(;\s*//)")) //operator is unclosed
         {
             args.Shift = args.TabLength;
         }
 }
開發者ID:samarjeet27,項目名稱:ynoteclassic,代碼行數:38,代碼來源:SyntaxHighlighter.cs

示例7: ScpAutoIndentNeeded

 private void ScpAutoIndentNeeded(object sender, AutoIndentEventArgs args)
 {
     if (!Regex.IsMatch(args.LineText, @"^\s*((?i)[i,ı]f).*((?i)end[i,ı]f)\b[^{]*$"))
     {
         if (Regex.IsMatch(args.LineText, @"^\s*((?i)[i,ı]f)"))
         {
             args.ShiftNextLines = args.TabLength;
         }
         else if (Regex.IsMatch(args.LineText, @"((?i)end[i,ı]f)\b[^{]*$"))
         {
             args.Shift = -args.TabLength;
             args.ShiftNextLines = -args.TabLength;
         }
         else if (Regex.IsMatch(args.PrevLineText, @"^\s*((?i)else[i,ı]f|(?i)el[i,ı]f|[\}\s]*(?i)else)\b[^{]*$") && !Regex.IsMatch(args.PrevLineText, @"(;\s*$)|(;\s*//)"))
         {
             args.Shift = args.TabLength;
         }
         else if (!Regex.IsMatch(args.LineText, @"^\s*((?i)for).*((?i)endfor)\b[^{]*$"))
         {
             if (Regex.IsMatch(args.LineText, @"^\s*((?i)for)"))
             {
                 args.ShiftNextLines = args.TabLength;
             }
             else if (Regex.IsMatch(args.LineText, @"((?i)endfor)\b[^{]*$"))
             {
                 args.Shift = -args.TabLength;
                 args.ShiftNextLines = -args.TabLength;
             }
             else if (!Regex.IsMatch(args.LineText, @"^\s*((?i)dorand).*((?i)enddo)\b[^{]*$"))
             {
                 if (Regex.IsMatch(args.LineText, @"^\s*((?i)dorand)"))
                 {
                     args.ShiftNextLines = args.TabLength;
                 }
                 else if (Regex.IsMatch(args.LineText, @"((?i)enddo)\b[^{]*$"))
                 {
                     args.Shift = -args.TabLength;
                     args.ShiftNextLines = -args.TabLength;
                 }
                 else if (!Regex.IsMatch(args.LineText, @"^\s*((?i)begin).*((?i)end)\b[^{]*$"))
                 {
                     if (Regex.IsMatch(args.LineText, @"^\s*((?i)begin)"))
                     {
                         args.ShiftNextLines = args.TabLength;
                     }
                     else if (Regex.IsMatch(args.LineText, @"((?i)end)\b[^{]*$"))
                     {
                         args.Shift = -args.TabLength;
                         args.ShiftNextLines = -args.TabLength;
                     }
                 }
             }
         }
     }
 }
開發者ID:msx752,項目名稱:ScriptCommunityPack-Editor,代碼行數:55,代碼來源:SyntaxHighlighter.cs

示例8: PHPAutoIndentNeeded

 protected void PHPAutoIndentNeeded(object sender, AutoIndentEventArgs args)
 {
     var flag = Regex.IsMatch(args.LineText, "^[^\"']*\\{.*\\}[^\"']*$");
     if (!flag)
     {
         var flag2 = Regex.IsMatch(args.LineText, "^[^\"']*\\{");
         if (flag2)
         {
             args.ShiftNextLines = args.TabLength;
         }
         else
         {
             var flag3 = Regex.IsMatch(args.LineText, "}[^\"']*$");
             if (flag3)
             {
                 args.Shift = -args.TabLength;
                 args.ShiftNextLines = -args.TabLength;
             }
             else
             {
                 var flag4 = Regex.IsMatch(args.PrevLineText,
                     "^\\s*(if|for|foreach|while|[\\}\\s]*else)\\b[^{]*$");
                 if (flag4)
                 {
                     var flag5 = !Regex.IsMatch(args.PrevLineText, "(;\\s*$)|(;\\s*//)");
                     if (flag5)
                     {
                         args.Shift = args.TabLength;
                     }
                 }
             }
         }
     }
 }
開發者ID:McSwaggens,項目名稱:FastColoredTextBox,代碼行數:34,代碼來源:SyntaxHighlighter.cs

示例9: AutoIndentNeeded

 public virtual void AutoIndentNeeded(object sender, AutoIndentEventArgs args)
 {
     var tb = (sender as FastColoredTextBox);
     Language language = tb.Language;
     switch (language)
     {
         case Language.CSharp:
             CSharpAutoIndentNeeded(sender, args);
             break;
         case Language.VB:
             VBAutoIndentNeeded(sender, args);
             break;
         case Language.HTML:
             HTMLAutoIndentNeeded(sender, args);
             break;
         case Language.XML:
             XMLAutoIndentNeeded(sender, args);
             break;
         case Language.SQL:
             SQLAutoIndentNeeded(sender, args);
             break;
         case Language.PHP:
             PHPAutoIndentNeeded(sender, args);
             break;
         case Language.JS:
             CSharpAutoIndentNeeded(sender, args);
             break; //JS like C#
         case Language.Lua:
             LuaAutoIndentNeeded(sender, args);
             break;
         case Language.Scp:
             ScpAutoIndentNeeded(sender, args);
             break;
         default:
             //MAIN.WriteLog("AutoIndentNeeded", MAIN.LoggerType.Error);
             break;
     }
 }
開發者ID:msx752,項目名稱:ScriptCommunityPack-Editor,代碼行數:38,代碼來源:SyntaxHighlighter.cs

示例10: LuaAutoIndentNeeded

 protected void LuaAutoIndentNeeded(object sender, AutoIndentEventArgs args)
 {
     var flag = Regex.IsMatch(args.LineText, "^\\s*(end|until)\\b");
     if (flag)
     {
         args.Shift = -args.TabLength;
         args.ShiftNextLines = -args.TabLength;
     }
     else
     {
         var flag2 = Regex.IsMatch(args.LineText, "\\b(then)\\s*\\S+");
         if (!flag2)
         {
             var flag3 = Regex.IsMatch(args.LineText, "^\\s*(function|do|for|while|repeat|if)\\b");
             if (flag3)
             {
                 args.ShiftNextLines = args.TabLength;
             }
             else
             {
                 var flag4 = Regex.IsMatch(args.LineText, "^\\s*(else|elseif)\\b", RegexOptions.IgnoreCase);
                 if (flag4)
                 {
                     args.Shift = -args.TabLength;
                 }
             }
         }
     }
 }
開發者ID:McSwaggens,項目名稱:FastColoredTextBox,代碼行數:29,代碼來源:SyntaxHighlighter.cs

示例11: CSharpAutoIndentNeeded

 protected void CSharpAutoIndentNeeded(object sender, AutoIndentEventArgs args)
 {
     var flag = Regex.IsMatch(args.LineText, "^[^\"']*\\{.*\\}[^\"']*$");
     if (!flag)
     {
         var flag2 = Regex.IsMatch(args.LineText, "^[^\"']*\\{");
         if (flag2)
         {
             args.ShiftNextLines = args.TabLength;
         }
         else
         {
             var flag3 = Regex.IsMatch(args.LineText, "}[^\"']*$");
             if (flag3)
             {
                 args.Shift = -args.TabLength;
                 args.ShiftNextLines = -args.TabLength;
             }
             else
             {
                 var flag4 = Regex.IsMatch(args.LineText, "^\\s*\\w+\\s*:\\s*($|//)") &&
                             !Regex.IsMatch(args.LineText, "^\\s*default\\s*:");
                 if (flag4)
                 {
                     args.Shift = -args.TabLength;
                 }
                 else
                 {
                     var flag5 = Regex.IsMatch(args.LineText, "^\\s*(case|default)\\b.*:\\s*($|//)");
                     if (flag5)
                     {
                         args.Shift = -args.TabLength/2;
                     }
                     else
                     {
                         var flag6 = Regex.IsMatch(args.PrevLineText,
                             "^\\s*(if|for|foreach|while|[\\}\\s]*else)\\b[^{]*$");
                         if (flag6)
                         {
                             var flag7 = !Regex.IsMatch(args.PrevLineText, "(;\\s*$)|(;\\s*//)");
                             if (flag7)
                             {
                                 args.Shift = args.TabLength;
                             }
                         }
                     }
                 }
             }
         }
     }
 }
開發者ID:McSwaggens,項目名稱:FastColoredTextBox,代碼行數:51,代碼來源:SyntaxHighlighter.cs

示例12: PythonAutoIndentNeeded

 private void PythonAutoIndentNeeded(object sender, AutoIndentEventArgs e)
 {
     if (Regex.IsMatch(e.LineText, @"^[^""']*\:"))
     {
         e.ShiftNextLines = e.TabLength;
     }
 }
開發者ID:samarjeet27,項目名稱:ynoteclassic,代碼行數:7,代碼來源:SyntaxHighlighter.cs

示例13: SQLAutoIndentNeeded

 private void SQLAutoIndentNeeded(object sender, AutoIndentEventArgs args)
 {
     var tb = sender as FastColoredTextBox;
     tb.CalcAutoIndentShiftByCodeFolding(sender, args);
 }
開發者ID:samarjeet27,項目名稱:ynoteclassic,代碼行數:5,代碼來源:SyntaxHighlighter.cs

示例14: AutoIndentNeeded

 public void AutoIndentNeeded(object sender, AutoIndentEventArgs args)
 {
     var tb = (sender as FastColoredTextBox);
     Language language = tb.Language;
     switch (language) {
         case Language.CSharp:
             CSharpAutoIndentNeeded(sender, args);
             break;
         case Language.VB:
             VBAutoIndentNeeded(sender, args);
             break;
         case Language.HTML:
             HTMLAutoIndentNeeded(sender, args);
             break;
         case Language.XML:
             XMLAutoIndentNeeded(sender, args);
             break;
         case Language.SQL:
             SQLAutoIndentNeeded(sender, args);
             break;
         case Language.PHP:
             PHPAutoIndentNeeded(sender, args);
             break;
         case Language.JS:
             CSharpAutoIndentNeeded(sender, args);
             break; //JS like C#
         case Language.Lua:
             LuaAutoIndentNeeded(sender, args);
             break;
         // By WendyH < -------------------------------------------------------
         case Language.CPPScript:
             CSharpAutoIndentNeeded(sender, args);
             break;
         case Language.PascalScript:
             PascalAutoIndentNeeded(sender, args);
             break;
         case Language.BasicScript:
             VBAutoIndentNeeded(sender, args);
             break;
         case Language.JScript:
             CSharpAutoIndentNeeded(sender, args);
             break;
         case Language.YAML:
             CSharpAutoIndentNeeded(sender, args);
             break;
         // By WendyH > -------------------------------------------------------
         default:
             break;
     }
 }
開發者ID:WendyH,項目名稱:HMSEditor,代碼行數:50,代碼來源:SyntaxHighlighter.cs

示例15: PascalAutoIndentNeeded

        private void PascalAutoIndentNeeded(object sender, AutoIndentEventArgs args)
        {
            //start of declaration
            if (Regex.IsMatch(args.LineText, @"^\s*(begin|(case +\w+ +of)|( *= *record))\s*", RegexOptions.IgnoreCase))
            {
                //args.Shift = -args.TabLength;
                args.ShiftNextLines = args.TabLength;
                return;
            }

            //end of block
            if (Regex.IsMatch(args.LineText, @"^\s*(end\s*;?)\b", RegexOptions.IgnoreCase))
            {
                args.Shift = -args.TabLength;
                args.ShiftNextLines = -args.TabLength;
                return;
            }

            if (Regex.IsMatch(args.PrevLineText, @"^\s*(if|for|while|else)"))
                if (!Regex.IsMatch(args.PrevLineText, @"(;\s*$)|(;\s*//)"))//operator is unclosed
                {
                    args.Shift = args.TabLength;
                    return;
                }
        }
開發者ID:hoang-nc,項目名稱:FastColoredTextBox,代碼行數:25,代碼來源:SyntaxHighlighter.cs


注:本文中的AutoIndentEventArgs類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。