예제 #1
0
파일: Search.cs 프로젝트: biuken/eAnt
        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)));
            }
        }
예제 #2
0
        internal static void NewFileFound(CFileFound file, int SearchIndex)
        {
            InterfaceSearchedFile searchFile = new InterfaceSearchedFile();

            searchFile = InterfaceGateway[0].FileFountToInterfaceFileFound(file);

            for (int i = 0; i <= InterfaceGateway.Length - 1; i++)
            {
                if (CKernel.InterfaceGateway[i] != null)
                {
                    InterfaceGateway[i].NewFileFound(searchFile, SearchIndex);
                }
            }
        }