本文整理汇总了C#中IrcClient.OnNickChanged方法的典型用法代码示例。如果您正苦于以下问题:C# IrcClient.OnNickChanged方法的具体用法?C# IrcClient.OnNickChanged怎么用?C# IrcClient.OnNickChanged使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IrcClient
的用法示例。
在下文中一共展示了IrcClient.OnNickChanged方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleNick
public static void HandleNick(IrcClient client, IrcMessage message)
{
var user = client.Users.Get(message.Prefix);
var oldNick = user.Nick;
user.Nick = message.Parameters[0];
client.OnNickChanged(new NickChangedEventArgs
{
User = user,
OldNick = oldNick,
NewNick = message.Parameters[0]
});
}
示例2: HandleNick
public static void HandleNick(IrcClient client, IrcMessage message)
{
var ircUser = new IrcUser(message.Prefix);
var oldNick = ircUser.Nick;
var users = client
.Channels
.SelectMany(c => c.Users.Where(u => u.Nick.Equals(ircUser.Nick, StringComparison.OrdinalIgnoreCase)));
foreach (var user in users)
{
if (user != null)
{
user.Nick = message.Parameters[0];
}
}
if (client.User.Nick.Equals(ircUser.Nick, System.StringComparison.OrdinalIgnoreCase))
{
client.User.Nick = message.Parameters[0];
}
client.OnNickChanged(new NickChangedEventArgs
{
User = ircUser,
OldNick = oldNick,
NewNick = message.Parameters[0]
});
}