本文整理汇总了C#中CommandParser类的典型用法代码示例。如果您正苦于以下问题:C# CommandParser类的具体用法?C# CommandParser怎么用?C# CommandParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CommandParser类属于命名空间,在下文中一共展示了CommandParser类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CommandParser
string ISyncWork.Run(IWorkContext context)
{
var command = new CommandParser(context.Command).Parse();
var route = new CommandRouteInterpretter(command).GetRoute();
context.CommandInterpretter.AddSyncRoute(route);
return "";
}
开发者ID:jeremyrsellars,项目名称:nodapter.net,代码行数:7,代码来源:AddAsyncRouteWork.cs
示例2: Main
static void Main(string[] args)
{
var commandParser = new CommandParser();
Console.WriteLine("Hello World!");
Console.ReadKey();
}
开发者ID:chamook,项目名称:SimpleSiteCompiler,代码行数:7,代码来源:Program.cs
示例3: Create
public override void Create(CommandParser Parser)
{
Core.StandardMessage("version", "Build: RMUD Hadad <s0>");
Core.StandardMessage("commit", "Commit: <s0>");
Core.StandardMessage("no commit", "Commit version not found.");
Parser.AddCommand(
Or(
KeyWord("VERSION"),
KeyWord("VER")))
.Manual("Displays the server version currently running.")
.ProceduralRule((match, actor) =>
{
var buildVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
MudObject.SendMessage(actor, "@version", buildVersion);
if (System.IO.File.Exists("version.txt"))
MudObject.SendMessage(actor, "@commit", System.IO.File.ReadAllText("version.txt"));
else
MudObject.SendMessage(actor, "@no commit");
foreach (var module in Core.IntegratedModules)
MudObject.SendMessage(actor, module.Info.Description);
return PerformResult.Continue;
});
}
开发者ID:Reddit-Mud,项目名称:RMUD,代码行数:28,代码来源:Version.cs
示例4: TestParseMultiply
public void TestParseMultiply()
{
var commandParser = new CommandParser();
string testInput = "2*8";
var result = commandParser.Parse(testInput);
Assert.AreEqual(16, result);
}
开发者ID:Wiley-Walker,项目名称:simple-calculator,代码行数:7,代码来源:ParserTests.cs
示例5: TestParseSubtract
public void TestParseSubtract()
{
var commandParser = new CommandParser();
string testInput = "2-6";
var result = commandParser.Parse(testInput);
Assert.AreEqual(-4, result);
}
开发者ID:Wiley-Walker,项目名称:simple-calculator,代码行数:7,代码来源:ParserTests.cs
示例6: TestParseDivde
public void TestParseDivde()
{
var commandParser = new CommandParser();
string testInput = "8/2";
var result = commandParser.Parse(testInput);
Assert.AreEqual(4, result);
}
开发者ID:Wiley-Walker,项目名称:simple-calculator,代码行数:7,代码来源:ParserTests.cs
示例7: TestParseMod
public void TestParseMod()
{
var commandParser = new CommandParser();
string testInput = "8%3";
var result = commandParser.Parse(testInput);
Assert.AreEqual(2, result);
}
开发者ID:Wiley-Walker,项目名称:simple-calculator,代码行数:7,代码来源:ParserTests.cs
示例8: TestParseAdd
public void TestParseAdd()
{
var commandParser = new CommandParser();
string testInput = "2+6";
var result = commandParser.Parse(testInput);
Assert.AreEqual(8, result);
}
开发者ID:Wiley-Walker,项目名称:simple-calculator,代码行数:7,代码来源:ParserTests.cs
示例9: doCommand
///<summary>
///This gets the users message and passes it on to everyone currently
///playing.
///</summary>
///<param name="p">The player who invoked the command.</param>
///<param name="cp">The options the player sent along.</param>
public override void doCommand(Player p, CommandParser cp)
{
string you = "You chat: {x{o{y\'{x{o{b" + cp.Arguments + "{x{o{y\'{x\n\r";
string everyone = "\n\r" + p.Name + " chats: {o{y\'{x{o{b" + cp.Arguments + "{x{o{y\'{x\n\r";
Mud.mudSuroden.writeAll(p, everyone, you);
}
开发者ID:lolindrath,项目名称:suroden,代码行数:13,代码来源:commands.cs
示例10: Create
public override void Create(CommandParser Parser)
{
Parser.AddCommand(
new KeyWord("LOOK", false),
new LookProcessor(),
"Look around at your suroundings.");
}
开发者ID:piggybankcowboy,项目名称:let-us-write-a-mud,代码行数:7,代码来源:Look.cs
示例11: HandleAddBlackListCmd
private void HandleAddBlackListCmd(CommandParser.Command param)
{
ulong gUID = 0uL;
ulong.TryParse(param.GetParam(1), out gUID);
MC2S_AddBlackList mC2S_AddBlackList = new MC2S_AddBlackList();
mC2S_AddBlackList.GUID = gUID;
Globals.Instance.CliSession.Send(315, mC2S_AddBlackList);
}
开发者ID:floatyears,项目名称:Decrypt,代码行数:8,代码来源:CommandParser.cs
示例12: Parse_EmptyCommand_ShouldHaveNoTokens
public void Parse_EmptyCommand_ShouldHaveNoTokens()
{
CommandParser parser = new CommandParser();
var tokens = parser.Parse(string.Empty).Tokens.ToArray();
Assert.IsTrue(tokens.Length == 0);
}
开发者ID:gbrusella,项目名称:oberon-bot,代码行数:8,代码来源:CommandParserTest.cs
示例13: cmdParser_HandlesNegativeNumbers
public void cmdParser_HandlesNegativeNumbers()
{
FakeDeveloperConsole console = new FakeDeveloperConsole();
CommandParser parser = new CommandParser("-12", console);
CommandToken token = parser.Tokens[0];
Assert.AreEqual(CommandTokenKind.Number, token.Kind);
}
开发者ID:Dakota628,项目名称:GTAVDeveloperConsole,代码行数:8,代码来源:CommandParserTests.cs
示例14: Main
public static void Main()
{
var reader = new ConsoleReader();
var writer = new ConsoleWriter();
var commandParser = new CommandParser();
Engine.Start(reader, writer, commandParser);
}
开发者ID:cwetanow,项目名称:Telerik,代码行数:8,代码来源:Startup.cs
示例15: cmdParser_HandlesCodeBlock
public void cmdParser_HandlesCodeBlock()
{
FakeDeveloperConsole console = new FakeDeveloperConsole();
CommandParser parser = new CommandParser("{Test()}", console);
CommandToken token = parser.Tokens[0];
Assert.AreEqual(CommandTokenKind.CodeBlock, token.Kind);
}
开发者ID:Dakota628,项目名称:GTAVDeveloperConsole,代码行数:8,代码来源:CommandParserTests.cs
示例16: Parse_NullCommand_ShouldHaveNoTokens
public void Parse_NullCommand_ShouldHaveNoTokens()
{
CommandParser parser = new CommandParser();
var tokens = parser.Parse(null).Tokens.ToArray();
Assert.IsTrue(tokens.Length == 0);
}
开发者ID:gbrusella,项目名称:oberon-bot,代码行数:8,代码来源:CommandParserTest.cs
示例17: cmdParser_HandlesNegativePrefixedWordAsWord
public void cmdParser_HandlesNegativePrefixedWordAsWord()
{
FakeDeveloperConsole console = new FakeDeveloperConsole();
CommandParser parser = new CommandParser("-hello", console);
CommandToken token = parser.Tokens[0];
Assert.AreEqual(CommandTokenKind.Word, token.Kind);
Assert.AreEqual("-hello", token.String);
}
开发者ID:Dakota628,项目名称:GTAVDeveloperConsole,代码行数:9,代码来源:CommandParserTests.cs
示例18: Create
public override void Create(CommandParser Parser)
{
Parser.AddCommand(
new Sequence(
new KeyWord("GO", true),
new Cardinal("DIRECTION")),
new GoProcessor(),
"Move between rooms.");
}
开发者ID:piggybankcowboy,项目名称:let-us-write-a-mud,代码行数:9,代码来源:Go.cs
示例19: CreateCustomOpts
public override CommandParser CreateCustomOpts(CommandParser cli)
{
cli.Argument("p", "password",
"Password will be passed via environment variable PGPASSWORD; this could be security issue on some systems",
"database-password",
CommandArgumentFlags.TakesParameter, (p, v) => Options.Add("password", v));
return cli;
}
开发者ID:prunkster,项目名称:db-migrator-net,代码行数:9,代码来源:Parser.cs
示例20: Parse_OneWordCommand_ShouldHaveOneToken
public void Parse_OneWordCommand_ShouldHaveOneToken()
{
CommandParser parser = new CommandParser();
var tokens = parser.Parse("test").Tokens.ToArray();
Assert.IsTrue(tokens.Length == 1);
Assert.AreEqual("test", tokens[0]);
}
开发者ID:gbrusella,项目名称:oberon-bot,代码行数:9,代码来源:CommandParserTest.cs
注:本文中的CommandParser类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论