Esempio n. 1
0
 /// <summary>
 /// Constructor, sets up bot ircclient and dccclient, so that users can register event handlers.
 /// </summary>
 public SimpleIRC()
 {
     NewIP       = "";
     NewPort     = 0;
     NewUsername = "";
     NewPassword = "";
     NewChannels = "";
     IrcClient   = new IrcClient();
     DccClient   = new DCCClient();
 }
Esempio n. 2
0
 //Overload Constructor - safe way to get variables
 public IrcConnect(string IP, int Port, string Username, string Password, string Channel, SimpleIRC sirc)
 {
     newIP = IP;
     newPort = Port;
     newUsername = Username;
     newPassword = Password;
     newChannel = Channel;
     simpleirc = sirc;
     isConnectionEstablised = false;
     dcc = new DCCClient(simpleirc, this);
 }
Esempio n. 3
0
 //Overload Constructor - safe way to get variables
 public IrcConnect(string IP, int Port, string Username, string Password, string Channel, SimpleIRC sirc)
 {
     newIP                  = IP;
     newPort                = Port;
     newUsername            = Username;
     newPassword            = Password;
     newChannel             = Channel;
     simpleirc              = sirc;
     isConnectionEstablised = false;
     dcc = new DCCClient(simpleirc, this);
 }
Esempio n. 4
0
 /// <summary>
 /// Constructor, sets up bot ircclient and dccclient, so that users can register event handlers.
 /// </summary>
 public SimpleIRC()
 {
     _newIP       = "";
     _newPort     = 0;
     _newUsername = "";
     _newPassword = "";
     _newChannels = "";
     _downloadDir = "";
     IrcClient    = new IrcClient();
     DccClient    = new DCCClient();
 }
Esempio n. 5
0
 /// <summary>
 /// Constructor, sets up bot ircclient and dccclient, so that users can register event handlers.
 /// </summary>
 public SimpleIRC(int maxConcurrentDownloads)
 {
     NewIP       = "";
     NewPort     = 0;
     NewUsername = "";
     NewPassword = "";
     NewChannels = "";
     IrcClient   = new IrcClient();
     DccClient   = new DCCClient
     {
         MaxConcurrentDownloads = maxConcurrentDownloads
     };
 }
Esempio n. 6
0
 /// <summary>
 /// Event for download updates, containging information about the following
 /// DccString : unparsed dccstring received from server, handy for debugging purposes
 /// FileName : file that is currently being downloaded
 /// FileSize : size of file that is currently being downloaded
 /// Ip : server address where file originates from
 /// Port : port of server where file originates from
 /// Pack : original pack that the user requested
 /// Bot : original bot where the user requested a pack (file) from
 /// BytesPerSecond : current download speed in bytes p/s
 /// KBytesPerSecond : current download speed in kbytes p/s
 /// MBytesPerSecond : current download speed in mbytes p/s
 /// Status : current download status, for example: (WAITING, DOWNLOADING, FAILED, ABORTED, etc)
 /// Progress : percentage downloaded (0-100%) (is int!)
 /// </summary>
 /// <param name="currentClient"></param>
 public DCCEventArgs(DCCClient currentClient)
 {
     DccString       = currentClient.NewDccString;
     FileName        = currentClient.NewFileName;
     FileSize        = currentClient.NewFileSize;
     Ip              = currentClient.NewIp;
     Port            = currentClient.NewPortNum;
     Pack            = currentClient.PackNum;
     Bot             = currentClient.BotName;
     BytesPerSecond  = currentClient.BytesPerSecond;
     KBytesPerSecond = currentClient.KBytesPerSecond;
     MBytesPerSecond = currentClient.MBytesPerSecond;
     Status          = currentClient.Status;
     Progress        = currentClient.Progress;
     FilePath        = currentClient.CurrentFilePath;
 }
Esempio n. 7
0
        /// <summary>
        /// Sets up the information needed for the client to start a connection to the irc server. Sends a warning to the debug message event if ports are out of the standard specified ports for IRC.
        /// </summary>
        /// <param name="ip">Server address, possibly works with dns addresses (irc.xxx.x), but ip addresses works just fine (of type string)</param>
        /// <param name="username">Username the client wants to use, of type string</param>
        /// <param name="channels">Channel(s) the client wants to connect to, possible to connect to multiple channels at once by seperating each channel with a ',' (Example: #chan1,#chan2), of type string</param>
        /// <param name="dccClient">DCC Client, for downloading using the DCC protocol</param>
        /// <param name="downloadDirectory">Download Directory, used by the DCC CLient to store files in the specified directory, if left empty, it will create a "Download" directory within the same folder where this library resides</param>
        /// <param name="port">Port, optional parameter, where default = 0 (Automatic port selection), is port of the server you want to connect to, of type int</param>
        /// <param name="password">Password, optional parameter, where default value is "", can be used to connect to a password protected server.</param>
        /// <param name="timeout">Timeout, optional parameter, where default value is 3000 milliseconds, the maximum time before a server needs to answer, otherwise errors are thrown.</param>
        /// <param name="enableSSL">Timeout, optional parameter, where default value is 3000 milliseconds, the maximum time before a server needs to answer, otherwise errors are thrown.</param>
        public void SetConnectionInformation(string ip, string username, string channels,
                                             DCCClient dccClient, string downloadDirectory, int port = 0, string password = "", int timeout = 3000, bool enableSSL = true)
        {
            _newIp                  = ip;
            _NewPort                = port;
            _NewUsername            = username;
            _newPassword            = password;
            _NewChannelss           = channels;
            _isConnectionEstablised = false;
            _IsClientRunning        = false;
            _timeOut                = timeout;
            _downloadDirectory      = downloadDirectory;
            _dccClient              = dccClient;
            _enableSSL              = enableSSL;

            if (_enableSSL)
            {
                if (port == 0)
                {
                    _NewPort = 6697;
                }
                else if (port != 6697)
                {
                    OnDebugMessage?.Invoke(this, new IrcDebugMessageEventArgs("PORT: " + port.ToString() + " IS NOT COMMONLY USED FOR TLS/SSL CONNECTIONS, PREFER TO USE 6697 FOR SSL!", "SETUP WARNING"));
                }
            }
            else
            {
                if (port == 0)
                {
                    _NewPort = 6667;
                }
                else if (port < 6665 && port > 6669)
                {
                    OnDebugMessage?.Invoke(this, new IrcDebugMessageEventArgs("PORT: " + port.ToString() + " IS NOT COMMONLY USED FOR NON TLS/SSL CONNECTIONS, PREFER TO USE PORTS BETWEEN 6665 & 6669!", "SETUP WARNING"));
                }
            }
        }
Esempio n. 8
0
 /// <summary>
 /// Constructor, sets up bot ircclient and dccclient, so that users can register event handlers.
 /// </summary>
 public SimpleIRC()
 {
     IrcClient = new IrcClient();
     DccClient = new DCCClient();
 }