本文整理汇总了C#中MonoDevelop.GetCharAt方法的典型用法代码示例。如果您正苦于以下问题:C# MonoDevelop.GetCharAt方法的具体用法?C# MonoDevelop.GetCharAt怎么用?C# MonoDevelop.GetCharAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MonoDevelop
的用法示例。
在下文中一共展示了MonoDevelop.GetCharAt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCurrentParameterIndex
internal static int GetCurrentParameterIndex (MonoDevelop.Ide.Gui.TextEditor editor, int offset, int memberStart)
{
int cursor = editor.CursorPosition;
int i = offset;
if (i > cursor)
return -1;
if (i == cursor)
return 1;
int index = memberStart + 1;
int depth = 0;
do {
char c = editor.GetCharAt (i - 1);
if (c == ',' && depth == 1)
index++;
if (c == '<')
depth++;
if (c == '>')
depth--;
i++;
} while (i <= cursor && depth > 0);
return depth == 0 ? -1 : index;
}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:26,代码来源:NRefactoryTemplateParameterDataProvider.cs
示例2: GetCurrentParameterIndex
internal static int GetCurrentParameterIndex (MonoDevelop.Ide.Gui.TextEditor editor, int offset, int memberStart)
{
int cursor = editor.CursorPosition;
int i = offset;
if (i > cursor)
return -1;
if (i == cursor)
return 1; // parameters are 1 based
IEnumerable<string> types = MonoDevelop.Ide.DesktopService.GetMimeTypeInheritanceChain (CSharpFormatter.MimeType);
CSharpIndentEngine engine = new CSharpIndentEngine (MonoDevelop.Projects.Policies.PolicyService.GetDefaultPolicy<CSharpFormattingPolicy> (types));
int index = memberStart + 1;
int parentheses = 0;
int bracket = 0;
do {
char c = editor.GetCharAt (i - 1);
engine.Push (c);
switch (c) {
case '{':
if (!engine.IsInsideOrdinaryCommentOrString)
bracket++;
break;
case '}':
if (!engine.IsInsideOrdinaryCommentOrString)
bracket--;
break;
case '(':
if (!engine.IsInsideOrdinaryCommentOrString)
parentheses++;
break;
case ')':
if (!engine.IsInsideOrdinaryCommentOrString)
parentheses--;
break;
case ',':
if (!engine.IsInsideOrdinaryCommentOrString && parentheses == 1 && bracket == 0)
index++;
break;
}
i++;
} while (i <= cursor && parentheses >= 0);
return parentheses != 1 || bracket > 0 ? -1 : index;
}
示例3: FindPrevWordStart
static int FindPrevWordStart (MonoDevelop.Ide.Gui.TextEditor editor, int offset)
{
while (--offset >= 0 && !Char.IsWhiteSpace (editor.GetCharAt (offset)))
;
return ++offset;
}