예제 #1
0
파일: Client.cs 프로젝트: elnomade/hathi
 private void InitializeClient(ushort in_Port,uint in_IP,uint in_ServerIP,ushort in_ServerPort,byte[] in_DownFileHash)
 {
     m_Port=in_Port;
     m_strIP=in_IP.ToString();
     m_ID=in_IP;
     m_ServerIP=in_ServerIP;
     m_ServerPort=in_ServerPort;
     m_ClientFileName="";
     m_LastDownloadRequest=DateTime.MinValue;
     m_LastSourcesRequest=DateTime.MinValue;
     m_SourceExchangeVersion=1;
     m_DownloadTries=0;
     m_Software=(byte)Protocol.Client.Unknown;
     if (in_DownFileHash!=null)
     {
     DownFileHash=in_DownFileHash;
     }
     else
     {
     DownFileHash=null;
     }
     m_DownloadState=Protocol.DownloadState.None;
     m_UploadState=Protocol.UploadState.None;
     m_UploadBlocks=new ArrayList();
     m_UploadDataPackets=new ArrayList();
     m_DownloadBlocks=new ArrayList();
     m_UploadElement=null;
     m_ConexionTries=0;
     #if DEBUG
     IPAddress DirectionIP=new IPAddress(in_IP);
     m_UserName=DirectionIP.ToString()+":"+Convert.ToString(m_Port);
     #else
     m_UserName="******";
     #endif
     m_DownloadSpeeds=new ArrayList();
     m_UploadSpeeds=new ArrayList();
     m_LastChunkRequested=-1;
     m_SentComment=false;
     m_AskingUDP=true;
     m_SharedFilesRequested=false;
     m_CallBackTime=DateTime.MinValue;
     m_FriendLevel=Types.Constants.FriendLevel.NoFriend;
     m_FirstMessage=true;
     m_IsSpammer=false;
     m_IsPartner=false;
     m_PartnerAllowed=false;
     m_SupportsPartner=false;
     m_BadPartnerTime=DateTime.MinValue;
     m_PartnerStartedTime=DateTime.MinValue;
 }
예제 #2
0
파일: ClientsList.cs 프로젝트: biuken/eAnt
        public CClient AddClient(uint IP, ushort port, uint ServerIP, byte[] HashClient, ushort ServerPort, byte[] FileHashDescarga, Constants.FriendLevel friendLevel)
        {
            CClient client = GetClient(IP, port, ServerIP, HashClient);

            if (client == null)
            {
                client = new CClient(port, IP, ServerIP, ServerPort, FileHashDescarga);
                client.FriendStatus = friendLevel;

                if (m_LastConnection < DateTime.Now - new TimeSpan(0, Protocol.MinClientReask, 0))
                {
                    m_LastConnection           = DateTime.Now - new TimeSpan(0, 0, Protocol.MinClientReask - 1, 59, 700);
                    client.LastDownloadRequest = DateTime.Now - new TimeSpan(0, Protocol.MinClientReask, 0);
                }
                else
                {
                    m_LastConnection          += new TimeSpan(0, 0, 0, 0, 300);
                    client.LastDownloadRequest = m_LastConnection;
                }
                m_List.Add(client);
            }
            else
            {
                if (!client.IsFriend)
                {
                    client.FriendStatus = friendLevel;
                }
                else
                {
                    CKernel.FriendsList.Add(IP, port, ServerIP, HashClient, ServerPort, "", client.UserName, client.Software, client.Version);
                }
            };

            return(client);
        }
예제 #3
0
파일: Client.cs 프로젝트: elnomade/hathi
 public CClient(CConnection in_connection)
 {
     connection=in_connection;
     m_UploadBlocks=new ArrayList();
     m_UploadDataPackets=new ArrayList();
     m_DownloadBlocks=new ArrayList();
     m_DownloadState=Protocol.DownloadState.None;
     m_UploadState=Protocol.UploadState.None;
     m_UploadElement=null;
     m_LastSourcesRequest=DateTime.MinValue;
     m_DownloadTries=0;
     m_ClientFileName="";
     m_Software=(byte)Protocol.Client.Unknown;
     m_DownloadSpeeds=new ArrayList();
     m_UploadSpeeds=new ArrayList();
     m_SentComment=false;
     m_LastChunkRequested=-1;
     m_AskingUDP=true;
     m_SharedFilesRequested=false;
     m_CallBackTime=DateTime.MinValue;
     m_FriendLevel=Types.Constants.FriendLevel.NoFriend;
     m_FirstMessage=true;
     m_IsSpammer=false;
     m_IsPartner=false;
     m_PartnerAllowed=false;
     m_SupportsPartner=false;
     m_BadPartnerTime=DateTime.MinValue;
     m_PartnerStartedTime=DateTime.MinValue;
 }