本文整理汇总了C#中PowerShell.GetContextFromTLS方法的典型用法代码示例。如果您正苦于以下问题:C# PowerShell.GetContextFromTLS方法的具体用法?C# PowerShell.GetContextFromTLS怎么用?C# PowerShell.GetContextFromTLS使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PowerShell
的用法示例。
在下文中一共展示了PowerShell.GetContextFromTLS方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetResults
internal List<CompletionResult> GetResults(PowerShell powerShell, out int replacementIndex, out int replacementLength)
{
var completionContext = CreateCompletionContext(powerShell.GetContextFromTLS());
completionContext.Helper = new CompletionExecutionHelper(powerShell);
PSLanguageMode? previousLanguageMode = null;
try
{
// Tab expansion is called from a trusted function - we should apply ConstrainedLanguage if necessary.
if (ExecutionContext.HasEverUsedConstrainedLanguage)
{
previousLanguageMode = completionContext.ExecutionContext.LanguageMode;
completionContext.ExecutionContext.LanguageMode = PSLanguageMode.ConstrainedLanguage;
}
return GetResultHelper(completionContext, out replacementIndex, out replacementLength, false);
}
finally
{
if (previousLanguageMode.HasValue)
{
completionContext.ExecutionContext.LanguageMode = previousLanguageMode.Value;
}
}
}
示例2: GetResults
internal List<CompletionResult> GetResults(PowerShell powerShell, out int replacementIndex, out int replacementLength)
{
CompletionContext completionContext = this.CreateCompletionContext(powerShell.GetContextFromTLS());
completionContext.Helper = new CompletionExecutionHelper(powerShell);
return this.GetResultHelper(completionContext, out replacementIndex, out replacementLength, false);
}