本文整理汇总了C#中IInteractiveWindow.GetOptionValue方法的典型用法代码示例。如果您正苦于以下问题:C# IInteractiveWindow.GetOptionValue方法的具体用法?C# IInteractiveWindow.GetOptionValue怎么用?C# IInteractiveWindow.GetOptionValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IInteractiveWindow
的用法示例。
在下文中一共展示了IInteractiveWindow.GetOptionValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
public Task<ExecutionResult> Execute(IReplWindow window, string arguments)
{
List<string> submissions = new List<string>();
List<string> lines = new List<string>();
arguments = arguments.Trim();
if (arguments.StartsWith("\"") && arguments.EndsWith("\"")) {
arguments = arguments.Substring(1, arguments.Length - 2);
}
string commandPrefix = (string)window.GetOptionValue(ReplOptions.CommandPrefix);
string lineBreak = window.TextView.Options.GetNewLineCharacter();
var eval = window.Evaluator as JReplEvaluator;
var debugEval = window.Evaluator as JDebugReplEvaluator;
if (eval != null) {
window.Submit(eval.SplitCode(File.ReadAllText(arguments)).Where(CommentPrefixPredicate));
return ExecutionResult.Succeeded;
} else if (debugEval != null) {
window.Submit(debugEval.SplitCode(File.ReadAllText(arguments)).Where(CommentPrefixPredicate));
return ExecutionResult.Succeeded;
} else {
// v1 beahvior, will probably never be hit, but if someone was developing their own IReplEvaluator
// and using this class it would be hit.
using (var stream = new StreamReader(arguments)) {
string line;
while ((line = stream.ReadLine()) != null) {
if (line.StartsWith(_commentPrefix)) {
continue;
}
if (line.StartsWith(commandPrefix)) {
AddSubmission(submissions, lines, lineBreak);
submissions.Add(line);
lines.Clear();
} else {
lines.Add(line);
}
}
}
AddSubmission(submissions, lines, lineBreak);
window.Submit(submissions);
return ExecutionResult.Succeeded;
}
}