本文整理汇总了C#中IUser.SendMessage方法的典型用法代码示例。如果您正苦于以下问题:C# IUser.SendMessage方法的具体用法?C# IUser.SendMessage怎么用?C# IUser.SendMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IUser
的用法示例。
在下文中一共展示了IUser.SendMessage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UserCommand
/// <summary>
/// Performs a command on behalf of a user.
/// </summary>
/// <param name="user">The user performing the command.</param>
/// <param name="command">The command name.</param>
/// <param name="args">Any command arguments.</param>
public void UserCommand(IUser user, string command, string[] args)
{
if (user.PriviledgeLevel == PriviledgeLevel.Mod)
{
foreach (string key in ModCommands.Keys)
{
if (command.Equals(key, StringComparison.InvariantCultureIgnoreCase))
{
string response = ModCommands[key](user, args);
if (response != String.Empty)
{
if (user is LocalUser)
{
DisplayMessage(response);
}
else
{
user.SendMessage(response);
}
}
if (StatusChanged != null)
StatusChanged(this, new StatusChangedEventArgs());
return;
}
}
}
if (user.PriviledgeLevel == PriviledgeLevel.Standard || user.PriviledgeLevel == PriviledgeLevel.Mod)
{
foreach (string key in StandardCommands.Keys)
{
if (command.Equals(key, StringComparison.InvariantCultureIgnoreCase))
{
string response = StandardCommands[key](user, args);
if (response != String.Empty)
{
if (user is LocalUser)
{
DisplayMessage(response);
}
else
{
user.SendMessage(response);
}
}
if (StatusChanged != null)
StatusChanged(this, new StatusChangedEventArgs());
return;
}
}
}
}