本文整理汇总了C#中ArgumentList.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ArgumentList.ToString方法的具体用法?C# ArgumentList.ToString怎么用?C# ArgumentList.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArgumentList
的用法示例。
在下文中一共展示了ArgumentList.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseAndProcess
/// <summary>
/// Parses and process a command from a sender
/// </summary>
/// <param name="sender">Sender.</param>
/// <param name="line">Line.</param>
public void ParseAndProcess(ISender sender, string line)
{
var ctx = new HookContext
{
Sender = sender,
#if Full_API
Player = sender as Player
#endif
};
#if Full_API
ctx.Connection = ctx.Player != null ? ctx.Player.Connection.Socket : null;
#endif
var hargs = new HookArgs.ServerCommand();
try
{
CommandInfo info;
var firstSpace = line.IndexOf(' ');
if (firstSpace < 0)
firstSpace = line.Length;
var prefix = line.Substring(0, firstSpace).ToLower();
hargs.Prefix = prefix;
if (FindStringCommand(prefix, out info))
{
hargs.ArgumentString = (firstSpace < line.Length - 1 ? line.Substring(firstSpace + 1, line.Length - firstSpace - 1) : "").Trim();
HookPoints.ServerCommand.Invoke(ref ctx, ref hargs);
if (ctx.CheckForKick() || ctx.Result == HookResult.IGNORE)
return;
if (ctx.Result != HookResult.CONTINUE && !CheckAccessLevel(info, sender))
{
sender.SendMessage("Permissions error", 255, 238, 130, 238);
return;
}
try
{
info.Run(sender, hargs.ArgumentString);
}
catch (NLua.Exceptions.LuaScriptException e)
{
if (e.IsNetException)
{
var ex = e.GetBaseException();
if (ex != null)
{
if (ex is CommandError)
{
sender.SendMessage(prefix + ": " + ex.Message);
info.ShowHelp(sender);
}
}
}
}
catch (ExitException e)
{
throw e;
}
catch (CommandError e)
{
sender.SendMessage(prefix + ": " + e.Message);
info.ShowHelp(sender);
}
return;
}
var args = new ArgumentList();
var command = Tokenize(line, args);
if (command != null)
{
if (FindTokenCommand(command, out info))
{
hargs.Arguments = args;
hargs.ArgumentString = args.ToString();
foreach (BasePlugin plg in PluginManager._plugins.Values)
{
if (plg.commands.ContainsKey(command))
{
args.Plugin = plg;
}
}
HookPoints.ServerCommand.Invoke(ref ctx, ref hargs);
//.........这里部分代码省略.........