Example #1
0
        public void SendHashSet()
        {
            #if VERBOSE
            CKernel.LogClient.AddLog("SendHashSet",m_ID);
            #endif
            CElement element=(CElement)CKernel.FilesList[m_UpFileHash];
            if (element==null) return;
            MemoryStream responsePacket=new MemoryStream();
            CHashSetResponse hashSetResponse=new CHashSetResponse(responsePacket,element.File);

            if (connection!=null)
            {
                connection.SendPacket(responsePacket);
            }
        }
Example #2
0
        public void ProcessHashSet(byte[] packet)
        {
            #if VERBOSE
            CKernel.LogClient.AddLog("ProcessHashSet",m_ID);
            #endif
            if (DownFileHash==null) return;

            Debug.WriteLine("HashSet received,file "+m_DownloadElement.File.FileName+" client "+m_UserName);

            CHashSetResponse hashSetResponse;

            if (m_DownloadElement.File.HashSetNeeded())
            {
                hashSetResponse=new CHashSetResponse(new MemoryStream(packet),ref m_DownloadElement.File);
            }
            else
            {
                Debug.WriteLine("File already has hash");
            }

            m_DownloadState=Protocol.DownloadState.OnQueue;

            if (!m_DownloadElement.File.HashSetNeeded())
            {
            #if VERBOSE
                CKernel.LogClient.AddLog("ProcessHashSet-start download",m_ID);
            #endif
                MemoryStream responsePacket=new MemoryStream();
                CStartDownload startDownload=new CStartDownload(responsePacket,DownFileHash);
                if (connection!=null)
                {
                    connection.SendPacket(responsePacket);
                }
            }
        }