本文整理汇总了C#中QueryToken.?.FullKey方法的典型用法代码示例。如果您正苦于以下问题:C# QueryToken.?.FullKey方法的具体用法?C# QueryToken.?.FullKey怎么用?C# QueryToken.?.FullKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryToken
的用法示例。
在下文中一共展示了QueryToken.?.FullKey方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SelectInteractive
static UserAssetTokenAction? SelectInteractive(ref QueryToken token, QueryDescription qd, SubTokensOptions options, string remainingText, bool allowRemoveToken, bool allowReGenerate)
{
var top = Console.CursorTop;
try
{
if (Console.Out == null)
throw new InvalidOperationException("Impossible to synchronize without interactive Console");
var subTokens = token.SubTokens(qd, options).OrderBy(a => a.Parent != null).ThenBy(a => a.Key).ToList();
int startingIndex = 0;
SafeConsole.WriteColor(ConsoleColor.Cyan, " " + token?.FullKey());
if (remainingText.HasText())
Console.Write(" " + remainingText);
Console.WriteLine();
bool isRoot = token == null;
retry:
int maxElements = Console.LargestWindowHeight - 11;
subTokens.Skip(startingIndex).Take(maxElements)
.Select((s, i) => "- {1,2}: {2} ".FormatWith(i + " ", i + startingIndex, ((isRoot && s.Parent != null) ? "-" : "") + s.Key)).ToConsole();
Console.WriteLine();
int remaining = subTokens.Count - startingIndex - maxElements;
if (remaining > 0)
SafeConsole.WriteLineColor(ConsoleColor.White, "- +: Show more values ({0} remaining)", remaining);
if (token != null)
{
SafeConsole.WriteLineColor(ConsoleColor.White, "- b: Back");
SafeConsole.WriteLineColor(ConsoleColor.Green, "- c: Confirm");
}
SafeConsole.WriteLineColor(ConsoleColor.Yellow, "- s: Skip entity");
if (allowRemoveToken)
SafeConsole.WriteLineColor(ConsoleColor.DarkRed, "- r: Remove token");
if (allowReGenerate)
SafeConsole.WriteLineColor(ConsoleColor.Magenta, "- g: Generate from default template");
SafeConsole.WriteLineColor(ConsoleColor.Red, "- d: Delete entity");
while (true)
{
string answer = Console.ReadLine();
if (answer == null)
throw new InvalidOperationException("Impossible to synchronize interactively without Console");
answer = answer.ToLower();
if (answer == "+" && remaining > 0)
{
startingIndex += maxElements;
goto retry;
}
if (answer == "s")
return UserAssetTokenAction.SkipEntity;
if (answer == "r" && allowRemoveToken)
return UserAssetTokenAction.RemoveToken;
if (answer == "d")
return UserAssetTokenAction.DeleteEntity;
if (answer == "g")
return UserAssetTokenAction.ReGenerateEntity;
if (token != null)
{
if (answer == "c")
return UserAssetTokenAction.Confirm;
if (answer == "b")
{
token = token.Parent;
return null;
}
}
int option = 0;
if (int.TryParse(answer, out option))
{
token = subTokens[option];
return null;
}
Console.WriteLine("Error");
}
}
finally
{
Clean(top, Console.CursorTop);
//.........这里部分代码省略.........