当前位置: 首页>>代码示例>>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;未经允许,请勿转载。