Example #1
0
        public void AddFileFound(byte[] Hash, string name, uint size, uint avaibility, string codec, string length, uint bitrate, bool complete, uint ip, ushort port)
        {
            try
            {
                string strHash = CKernel.HashToString(Hash);

                m_sources += avaibility;
                if (ContainsKey(strHash))
                {
                    CFileFound fileFound = (CFileFound)this[strHash];
                    fileFound.UpdateFile(avaibility, name, codec, length, bitrate, complete, ip, port);
                    CKernel.SearchFileModified(fileFound, (int)CKernel.Searchs.GetKey(CKernel.Searchs.IndexOfValue(this)));
                }
                else
                {
                    CFileFound fileFound = new CFileFound(strHash, name, size, avaibility, codec, length, bitrate, complete, ip, port);
                    Add(strHash, fileFound);
                    CKernel.NewFileFound(fileFound, (int)CKernel.Searchs.GetKey(CKernel.Searchs.IndexOfValue(this)));
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine("Search error");
                Debug.WriteLine(e.ToString());
                CKernel.SearchEnded((int)CKernel.Searchs.GetKey(CKernel.Searchs.IndexOfValue(this)));
            }
        }