C# Класс IrcShark.Chatting.Irc.IrcClient

Manages a simple irc connection on a low raw level.
With an instance of IrcClient, you can connect to an irc server and receive many events defined by the standard irc protocol. The messages received are automatically parsed to IrcLine objects to be easier accessible. After connection was established, you should call ReceiveLine to get the lines from the server.
Наследование: IDisposable
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
Connect ( ) : void

Connects to the irc server addressed by ServerAddress.

Dispose ( ) : void

Disposes the object.

IrcClient ( ) : System

Initializes a new instance of the IrcClient class without any address to connect to.

Join ( string chanName ) : void

Joins a given channel on the irc server.

The given chanName should follow the given Standard of the IrcClient. The IrcClient will wait for the acknowledge of the server.

Part ( string chanName ) : void

Parts a given channel on the irc server.

The chanName should follow the given Standard of the IrcClient. The IrcClient will wait for the acknowledge of the server.

Quit ( ) : void

Quits the IRC Connection without a Message.

Quit ( string quitMsg ) : void

Quits the IRC connection with a Message.

ReadLine ( ) : IrcLine

Reads a new line from the server.

This method blocks the calling thread until a new line was received from server. Only use this method, if you want to bypass the automatically raised events and kine handling. If you want to have this features use IrcClient.ReceiveLine instead.

ReceiveLine ( ) : void

Reads the next line, raise all events and handle it if needed.

This method does the same as IrcClient.ReadLine does but additionally raise all events of the line. If the line is a PING line, it is handled and automatically answered by an according PONG.

SendLine ( string line ) : void

Sends a raw irc line to the irc server.

You can send anything you want. The text is send as is. There is no checking or something.

SendMessage ( string message, string receiver ) : void

Sends a message to a channel or nick (in a query).

SendNotice ( string message, string receiver ) : void

Sends a message to a channel, nick (directly).

Защищенные методы

Метод Описание
OnError ( string msg ) : void

Fires the Error event.

OnError ( string msg, Exception ex ) : void

Fires the Error event.

OnLineReceived ( IrcLine line ) : void

Fires the LineReceived event.

OnOnConnect ( ) : bool

Fires the OnConnect event.

OnOnLogin ( ) : void

Fires the OnLogin event.

Приватные методы

Метод Описание
HandleLine ( LineReceivedEventArgs e ) : void

Handles a line received from server.

Описание методов

Connect() публичный Метод

Connects to the irc server addressed by ServerAddress.
public Connect ( ) : void
Результат void

Dispose() публичный Метод

Disposes the object.
public Dispose ( ) : void
Результат void

IrcClient() публичный Метод

Initializes a new instance of the IrcClient class without any address to connect to.
public IrcClient ( ) : System
Результат System

Join() публичный Метод

Joins a given channel on the irc server.
The given chanName should follow the given Standard of the IrcClient. The IrcClient will wait for the acknowledge of the server.
public Join ( string chanName ) : void
chanName string The channel name the client should join.
Результат void

OnError() защищенный Метод

Fires the Error event.
protected OnError ( string msg ) : void
msg string The message for the error.
Результат void

OnError() защищенный Метод

Fires the Error event.
protected OnError ( string msg, Exception ex ) : void
msg string The message for the error.
ex System.Exception The exception that occured.
Результат void

OnLineReceived() защищенный Метод

Fires the LineReceived event.
protected OnLineReceived ( IrcLine line ) : void
line IrcLine The line that was received.
Результат void

OnOnConnect() защищенный Метод

Fires the OnConnect event.
protected OnOnConnect ( ) : bool
Результат bool

OnOnLogin() защищенный Метод

Fires the OnLogin event.
protected OnOnLogin ( ) : void
Результат void

Part() публичный Метод

Parts a given channel on the irc server.
The chanName should follow the given Standard of the IrcClient. The IrcClient will wait for the acknowledge of the server.
public Part ( string chanName ) : void
chanName string The channel name the client should join.
Результат void

Quit() публичный Метод

Quits the IRC Connection without a Message.
public Quit ( ) : void
Результат void

Quit() публичный Метод

Quits the IRC connection with a Message.
public Quit ( string quitMsg ) : void
quitMsg string The message to use when quitting.
Результат void

ReadLine() публичный Метод

Reads a new line from the server.
This method blocks the calling thread until a new line was received from server. Only use this method, if you want to bypass the automatically raised events and kine handling. If you want to have this features use IrcClient.ReceiveLine instead.
public ReadLine ( ) : IrcLine
Результат IrcLine

ReceiveLine() публичный Метод

Reads the next line, raise all events and handle it if needed.
This method does the same as IrcClient.ReadLine does but additionally raise all events of the line. If the line is a PING line, it is handled and automatically answered by an according PONG.
public ReceiveLine ( ) : void
Результат void

SendLine() публичный Метод

Sends a raw irc line to the irc server.
You can send anything you want. The text is send as is. There is no checking or something.
public SendLine ( string line ) : void
line string The raw line to send.
Результат void

SendMessage() публичный Метод

Sends a message to a channel or nick (in a query).
public SendMessage ( string message, string receiver ) : void
message string The message to send.
receiver string The receiver (a channel or a nick).
Результат void

SendNotice() публичный Метод

Sends a message to a channel, nick (directly).
public SendNotice ( string message, string receiver ) : void
message string The message to send.
receiver string The receiver (a channel or a nick).
Результат void