本文整理汇总了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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
}
}
}
}
示例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;
}
}
}
}
}
}
示例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;
}
}
示例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;
}
}
}
}
}
示例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;
}
}
}
}
}
}
}
}
示例12: PythonAutoIndentNeeded
private void PythonAutoIndentNeeded(object sender, AutoIndentEventArgs e)
{
if (Regex.IsMatch(e.LineText, @"^[^""']*\:"))
{
e.ShiftNextLines = e.TabLength;
}
}
示例13: SQLAutoIndentNeeded
private void SQLAutoIndentNeeded(object sender, AutoIndentEventArgs args)
{
var tb = sender as FastColoredTextBox;
tb.CalcAutoIndentShiftByCodeFolding(sender, args);
}
示例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;
}
}
示例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;
}
}