本文整理汇总了C#中IrcDotNet.IrcRegistrationInfo类的典型用法代码示例。如果您正苦于以下问题:C# IrcRegistrationInfo类的具体用法?C# IrcRegistrationInfo怎么用?C# IrcRegistrationInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IrcRegistrationInfo类属于IrcDotNet命名空间,在下文中一共展示了IrcRegistrationInfo类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Connect
public void Connect(string serverString, IrcRegistrationInfo registrationInfo)
{
_logger.Info("[BALLOUBOT] Attempting to connect");
using (var registeredEvent = new ManualResetEventSlim(false))
{
using (var connectedEvent = new ManualResetEventSlim(false))
{
Client.Connected += (sender, args) => connectedEvent.Set();
Client.Registered += (sender, args) => registeredEvent.Set();
Client.Connect(serverString, false, registrationInfo);
if (!connectedEvent.Wait(1000))
{
Client.Dispose();
throw new Exception("[BALLOUBOT] Could not connect.");
}
}
if (!registeredEvent.Wait(10000))
{
Client.Dispose();
throw new Exception("[BALLOUBOT] Could not register.");
}
}
IsConnected = true;
_logger.Info("[BALLOUBOT] Connected and Registered.");
}
开发者ID:TedCrocker,项目名称:BallouBot,代码行数:28,代码来源:Connection.cs
示例2: Connect
/// <inheritdoc cref="Connect(string, int, bool, IrcRegistrationInfo)"/>
/// <summary>
/// Connects to a server using the specified URL and user information.
/// </summary>
public void Connect(Uri url, IrcRegistrationInfo registrationInfo)
{
CheckDisposed();
if (registrationInfo == null)
throw new ArgumentNullException("registrationInfo");
// Check URL scheme and decide whether to use SSL.
bool useSsl;
if (url.Scheme == "irc")
useSsl = false;
else if (url.Scheme == "ircs")
useSsl = true;
else
throw new ArgumentException(string.Format(Properties.Resources.MessageInvalidUrlScheme,
url.Scheme), "url");
Connect(url.Host, url.Port == -1 ? DefaultPort : url.Port, useSsl, registrationInfo);
}
开发者ID:w0rd-driven,项目名称:ircdotnet,代码行数:23,代码来源:DefaultIrcClient.cs
示例3: HandleClientConnected
protected override void HandleClientConnected(IrcRegistrationInfo regInfo)
{
DebugUtilities.WriteEvent(string.Format("Connected to server at '{0}'.",
((IPEndPoint)this.socket.RemoteEndPoint).Address));
base.HandleClientConnected(regInfo);
}
开发者ID:w0rd-driven,项目名称:ircdotnet,代码行数:7,代码来源:DefaultIrcClient.cs
示例4: CheckRegistrationInfo
protected void CheckRegistrationInfo(IrcRegistrationInfo registrationInfo, string registrationInfoParamName)
{
// Check that given registration info is valid.
if (registrationInfo is IrcUserRegistrationInfo)
{
if (registrationInfo.NickName == null ||
((IrcUserRegistrationInfo)registrationInfo).UserName == null)
throw new ArgumentException(ResourceLoader.GetForCurrentView("IrcDotNet/Resources").GetString("MessageInvalidUserRegistrationInfo"),
registrationInfoParamName);
}
else if (registrationInfo is IrcServiceRegistrationInfo)
{
if (registrationInfo.NickName == null ||
((IrcServiceRegistrationInfo)registrationInfo).Description == null)
throw new ArgumentException(ResourceLoader.GetForCurrentView("IrcDotNet/Resources").GetString("MessageInvalidServiceRegistrationInfo"),
registrationInfoParamName);
}
else
{
throw new ArgumentException(ResourceLoader.GetForCurrentView("IrcDotNet/Resources").GetString("MessageInvalidRegistrationInfoObject"),
registrationInfoParamName);
}
}
开发者ID:charla-n,项目名称:BIRC,代码行数:23,代码来源:IrcClient.cs
示例5: Connect
/// <summary>
/// Connects asynchronously to the specified server.
/// </summary>
/// <param name="remoteEndPoint">The network endpoint (IP address and port) of the server to which to connect.
/// </param>
/// <param name="useSsl"><see langword="true"/> to connect to the server via SSL; <see langword="false"/>,
/// otherwise</param>
/// <param name="registrationInfo">The information used for registering the client.
/// The type of the object may be either <see cref="IrcUserRegistrationInfo"/> or
/// <see cref="IrcServiceRegistrationInfo"/>.</param>
/// <exception cref="ArgumentNullException"><paramref name="registrationInfo"/> is <see langword="null"/>.
/// </exception>
/// <exception cref="ArgumentException"><paramref name="registrationInfo"/> does not specify valid registration
/// information.</exception>
/// <exception cref="ObjectDisposedException">The current instance has already been disposed.</exception>
public void Connect(EndPoint remoteEndPoint, bool useSsl, IrcRegistrationInfo registrationInfo)
{
Connect(registrationInfo);
// Connect socket to remote host.
ConnectAsync(remoteEndPoint, Tuple.Create(useSsl, string.Empty, registrationInfo));
HandleClientConnecting();
}
开发者ID:charla-n,项目名称:BIRC,代码行数:23,代码来源:StandardIrcClient.cs
示例6: Connect
protected void Connect(IrcRegistrationInfo registrationInfo)
{
CheckDisposed();
if (registrationInfo == null)
throw new ArgumentNullException("registrationInfo");
CheckRegistrationInfo(registrationInfo, "registrationInfo");
ResetState();
}
开发者ID:txdv,项目名称:ircdotnet,代码行数:10,代码来源:IrcClient.cs
示例7: CheckRegistrationInfo
protected void CheckRegistrationInfo(IrcRegistrationInfo registrationInfo, string registrationInfoParamName)
{
// Check that given registration info is valid.
if (registrationInfo is IrcUserRegistrationInfo)
{
if (registrationInfo.NickName == null ||
((IrcUserRegistrationInfo)registrationInfo).UserName == null)
throw new ArgumentException(Properties.Resources.MessageInvalidUserRegistrationInfo,
registrationInfoParamName);
}
else if (registrationInfo is IrcServiceRegistrationInfo)
{
if (registrationInfo.NickName == null ||
((IrcServiceRegistrationInfo)registrationInfo).Description == null)
throw new ArgumentException(Properties.Resources.MessageInvalidServiceRegistrationInfo,
registrationInfoParamName);
}
else
{
throw new ArgumentException(Properties.Resources.MessageInvalidRegistrationInfoObject,
registrationInfoParamName);
}
}
开发者ID:txdv,项目名称:ircdotnet,代码行数:23,代码来源:IrcClient.cs
示例8: HandleClientConnected
protected virtual void HandleClientConnected(IrcRegistrationInfo regInfo)
{
if (regInfo.Password != null)
// Authenticate with server using password.
SendMessagePassword(regInfo.Password);
// Check if client is registering as service or normal user.
if (regInfo is IrcServiceRegistrationInfo)
{
// Register client as service.
var serviceRegInfo = (IrcServiceRegistrationInfo)regInfo;
SendMessageService(serviceRegInfo.NickName, serviceRegInfo.Distribution,
serviceRegInfo.Description);
this.localUser = new IrcLocalUser(serviceRegInfo.NickName, serviceRegInfo.Distribution,
serviceRegInfo.Description);
}
else
{
// Register client as normal user.
var userRegInfo = (IrcUserRegistrationInfo)regInfo;
SendMessageNick(userRegInfo.NickName);
SendMessageUser(userRegInfo.UserName, GetNumericUserMode(userRegInfo.UserModes),
userRegInfo.RealName);
this.localUser = new IrcLocalUser(userRegInfo.NickName, userRegInfo.UserName, userRegInfo.RealName,
userRegInfo.UserModes);
}
this.localUser.Client = this;
// Add local user to list of known users.
lock (((ICollection)this.usersReadOnly).SyncRoot)
this.users.Add(this.localUser);
OnConnected(new EventArgs());
}
开发者ID:txdv,项目名称:ircdotnet,代码行数:36,代码来源:IrcClient.cs
示例9: Connect
/// <inheritdoc cref="Connect(EndPoint, bool, IrcRegistrationInfo)"/>
/// <param name="hostName">The name of the remote host.</param>
/// <param name="port">The port number of the remote host.</param>
public void Connect(string hostName, int port, bool useSsl, IrcRegistrationInfo registrationInfo)
{
CheckDisposed();
if (registrationInfo == null)
throw new ArgumentNullException("registrationInfo");
IPHostEntry host;
host = Dns.GetHostEntry(hostName);
Debug.Assert(host.AddressList.Length > 0);
foreach (IPAddress ad in host.AddressList) {
Console.WriteLine(ad.ToString());
}
Connect(host.AddressList[0], port, useSsl, registrationInfo);
}
开发者ID:Sebioff,项目名称:ParkitectTwitchIntegration,代码行数:21,代码来源:StandardIrcClient.cs
示例10: HandleClientConnected
private void HandleClientConnected(IrcRegistrationInfo regInfo)
{
Logger.WriteLine("Connected to server at '{0}'.", TraceEventType.Verbose,((IPEndPoint)this.socket.RemoteEndPoint).Address);
if (regInfo.Password != null)
// Authenticate with server using password.
SendMessagePassword(regInfo.Password);
// Check if client is registering as service or normal user.
if (regInfo is IrcServiceRegistrationInfo)
{
// Register client as service.
var serviceRegInfo = (IrcServiceRegistrationInfo)regInfo;
SendMessageService(serviceRegInfo.NickName, serviceRegInfo.Distribution,
serviceRegInfo.Description);
this.localUser = new IrcLocalUser(serviceRegInfo.NickName, serviceRegInfo.Distribution,
serviceRegInfo.Description);
}
else
{
// Register client as normal user.
var userRegInfo = (IrcUserRegistrationInfo)regInfo;
SendMessageNick(userRegInfo.NickName);
SendMessageUser(userRegInfo.UserName, GetNumericUserMode(userRegInfo.UserModes),
userRegInfo.RealName);
this.localUser = new IrcLocalUser(userRegInfo.NickName, userRegInfo.UserName, userRegInfo.RealName,
userRegInfo.UserModes);
}
this.localUser.Client = this;
// Add local user to list of known users.
lock (((ICollection)this.usersReadOnly).SyncRoot)
this.users.Add(this.localUser);
OnConnected(new EventArgs());
}
开发者ID:carriercomm,项目名称:TwitchIrc,代码行数:38,代码来源:IrcClient.cs
示例11: Connect
protected void Connect(string server, IrcRegistrationInfo registrationInfo)
{
var client = new IrcClient();
client.FloodPreventer = new IrcStandardFloodPreventer(4, 2000);
client.Connected += IrcClient_Connected;
client.Disconnected += IrcClient_Disconnected;
client.Registered += IrcClient_Registered;
client.PingReceived += IrcClient_PingReceived;
client.NetworkInformationReceived += IrcClient_OnNetworkInformationReceived;
client.RawMessageReceived += IrcClient_OnRawMessageReceived;
client.RawMessageSent += IrcClient_OnRawMessageSent;
clientCount++;
// Wait until connection has succeeded or timed out.
using (var connectedEvent = new ManualResetEventSlim(false)) {
client.Connected += (sender2, e2) => connectedEvent.Set();
client.Connect(server, false, registrationInfo);
// client.Id = clientCount++;
if (!connectedEvent.Wait(10000)) {
client.Dispose();
Console.WriteLine("Connection to '{0}' timed out.", server);
return;
}
}
// Add new client to collection
this.allClients.Add(client);
Console.Out.WriteLine("Now connected to '{0}'.", server);
}
开发者ID:quiznilo,项目名称:Zerobot,代码行数:29,代码来源:IrcBot.cs
示例12: Connect
/// <summary>
/// </summary>
/// <param name="server">
/// </param>
/// <param name="registrationInfo">
/// </param>
protected void Connect(string server, IrcRegistrationInfo registrationInfo)
{
// Create new IRC client and connect to given server.
var client = new IrcClient();
client.FloodPreventer = new IrcStandardFloodPreventer(4, 2000);
client.Connected += this.IrcClient_Connected;
client.Disconnected += this.IrcClient_Disconnected;
client.Registered += this.IrcClient_Registered;
client.ProtocolError += this.IrcClient_ProtocolError;
client.ChannelListReceived += this.client_ChannelListReceived;
// Wait until connection has succeeded or timed out.
using (var connectedEvent = new ManualResetEventSlim(false))
{
client.Connected += (sender2, e2) => connectedEvent.Set();
client.Connect(server, false, registrationInfo);
if (!connectedEvent.Wait(10000))
{
client.Dispose();
ConsoleUtilities.WriteError("Connection to '{0}' timed out.", server);
return;
}
}
// Add new client to collection.
this.allClients.Add(client);
Console.Out.WriteLine("Now connected to '{0}'.", server);
}
开发者ID:gordonc64,项目名称:CellAO-NightPredator,代码行数:35,代码来源:IrcBot.cs
示例13: Connect
public void Connect(string server, IrcRegistrationInfo registrationInfo)
{
// Create new IRC client and connect to given server.
var client = new StandardIrcClient();
client.FloodPreventer = new IrcStandardFloodPreventer(2, 5000);
client.Connected += IrcClient_Connected;
client.Disconnected += IrcClient_Disconnected;
client.Registered += IrcClient_Registered;
// Wait until connection has succeeded or timed out.
using (var connectedEvent = new ManualResetEventSlim(false))
{
client.Connected += (sender2, e2) => connectedEvent.Set();
client.Connect(server, false, registrationInfo);
if (!connectedEvent.Wait(50000))
{
client.Dispose();
return;
}
}
// Add new client to collection.
this.allClients.Add(client);
Console.Out.WriteLine("Now connected to '{0}'.", server);
}
开发者ID:Kolpa,项目名称:DeathmicChatbot,代码行数:26,代码来源:IrcBot.cs
注:本文中的IrcDotNet.IrcRegistrationInfo类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论