Exemple #1
0
        /// <summary>
        /// Create a new server, each server must belong to a servergroup
        /// </summary>
        /// <param name="hostname">Hostname of the server</param>
        /// <param name="port">Port of the server</param>
        /// <param name="noconnections">No. of connections</param>
        /// <param name="requireslogin">Requires login</param>
        /// <param name="username">If login is required, username</param>
        /// <param name="password">If login is required, password</param>
        public Server(string hostname, int port, int noconnections, bool requireslogin, string username, string password, bool needsgroup, bool usessl)
        {
            m_Enabled = true;

            m_Hostname = hostname;
            m_Port     = port;

            m_RequiresLogin = requireslogin;
            m_Username      = username;
            m_Password      = password;

            m_NeedsGroup = needsgroup;
            m_UseSSL     = usessl;

            m_NoConnections = noconnections;
            m_Connections   = new ArrayList();

            m_DownloadQueue = new ArrayQueue();

            m_StatusItem = new System.Windows.Forms.ListViewItem();

            while (m_StatusItem.SubItems.Count < Global.ServerListCols)
            {
                m_StatusItem.SubItems.Add("");
            }
            m_StatusItem.Tag = this;

            OnFailedSegmentHandler = new OnFailedSegmentDelegate(FailedSegmentHandler);

            for (int i = 0; i < noconnections; i++)
            {
                Connection connection = new Connection(i + 1, hostname, Port, RequiresLogin, Username, Password, m_UseSSL);
                connection.Server           = this;
                connection.OnFailedSegment += OnFailedSegmentHandler;
                m_Connections.Add(connection);
            }

            m_Connected = false;
        }
Exemple #2
0
        /// <summary>
        /// Create a new server, each server must belong to a servergroup
        /// </summary>
        /// <param name="hostname">Hostname of the server</param>
        /// <param name="port">Port of the server</param>
        /// <param name="noconnections">No. of connections</param>
        /// <param name="requireslogin">Requires login</param>
        /// <param name="username">If login is required, username</param>
        /// <param name="password">If login is required, password</param>
        public Server( string hostname, int port, int noconnections, bool requireslogin, string username, string password, bool needsgroup, bool usessl)
        {
            m_Enabled = true;

            m_Hostname = hostname;
            m_Port = port;

            m_RequiresLogin = requireslogin;
            m_Username = username;
            m_Password = password;

            m_NeedsGroup = needsgroup;
            m_UseSSL = usessl;

            m_NoConnections = noconnections;
            m_Connections = new ArrayList();

            m_DownloadQueue = new ArrayQueue();

            m_StatusItem = new System.Windows.Forms.ListViewItem();

            while(m_StatusItem.SubItems.Count < Global.ServerListCols)
                m_StatusItem.SubItems.Add("");
            m_StatusItem.Tag = this;

            OnFailedSegmentHandler = new OnFailedSegmentDelegate(FailedSegmentHandler);

            for( int i = 0; i < noconnections; i ++)
            {
                Connection connection = new Connection(i+1, hostname, Port, RequiresLogin, Username, Password, m_UseSSL);
                connection.Server = this;
                connection.OnFailedSegment += OnFailedSegmentHandler;
                m_Connections.Add( connection);
            }

            m_Connected = false;
        }