本文整理汇总了C#中Interpreter.Print方法的典型用法代码示例。如果您正苦于以下问题:C# Interpreter.Print方法的具体用法?C# Interpreter.Print怎么用?C# Interpreter.Print使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Interpreter
的用法示例。
在下文中一共展示了Interpreter.Print方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Number
private static bool Number(Interpreter interpreter, Source source, Stringe tagName, TagArg[] args)
{
int a, b;
if (!Int32.TryParse(args[0].GetString(), out a) || !Int32.TryParse(args[1].GetString(), out b))
{
throw new ManhoodException(source, tagName, "Range values could not be parsed. They must be numbers.");
}
interpreter.Print(interpreter.FormatNumber(interpreter.RNG.Next(a, b + 1)));
return false;
}
示例2: ReplaceMatch
private static bool ReplaceMatch(Interpreter interpreter, Source source, Stringe tagname, TagArg[] args)
{
interpreter.Print(interpreter.GetMatchString());
return false;
}
示例3: RepNum
private static bool RepNum(Interpreter interpreter, Source source, Stringe tagname, TagArg[] args)
{
if (interpreter.CurrentRepeater == null) throw new ManhoodException(source, tagname, "No active repeaters.");
interpreter.Print(interpreter.FormatNumber(interpreter.CurrentRepeater.Index + 1));
return false;
}
示例4: Arg
private static bool Arg(Interpreter interpreter, Source source, Stringe tagname, TagArg[] args)
{
if (!interpreter.SubArgStack.Any())
throw new ManhoodException(source, tagname, "Tried to access arguments outside of a subroutine body.");
TagArg arg;
var argName = args[0].GetString().Trim();
if (!interpreter.SubArgStack.Peek().TryGetValue(argName, out arg))
throw new ManhoodException(source, tagname, "Could not find argument '" + argName + "'.");
// Argument is string
if (arg.Type == TagArgType.Result)
{
interpreter.Print(arg.GetString());
return false;
}
// Argument is tokens
interpreter.PushState(State.CreateDerivedShared(source, arg.GetTokens(), interpreter));
return true;
}