Ejemplo n.º 1
0
            public Result(SearchResultCollection parent, byte[] fileHash, long fileSize, byte[] id, string fileName, RIndexedHashtable<string, string> metaData, string comment, byte rating, bool isSearchDBResult, DateTime date)
            {
                if (parent == null)
                    throw new ArgumentNullException("parent");
                if (fileHash == null)
                    throw new ArgumentNullException("fileHash");
                if (fileHash.Length != 64)
                    throw new ArgumentException();
                if (fileSize < 0)
                    throw new ArgumentOutOfRangeException("fileSize");
                if (id == null)
                    throw new ArgumentNullException("id");
                if (id.Length != 48)
                    throw new ArgumentException();
                if (fileName == null)
                    throw new ArgumentNullException("fileName");
                if (metaData == null)
                    throw new ArgumentNullException("metaData");
                if (comment == null)
                    throw new ArgumentNullException("comment");
                if (rating > 3)
                    throw new ArgumentNullException("rating");

                m_Sources = new SearchResultSourceCollection(parent);
                m_MetaData = new SearchResultMetaDataCollection(parent);
                m_FileHash = fileHash;
                m_FileHashString = Core.ByteArrayToString(m_FileHash);
                m_FileSize = fileSize;
                m_FileSizeString = Core.LengthToString(m_FileSize);
                //2009-01-25 Nochbaer
                m_IsSearchDBResult = isSearchDBResult;
                //2009-01-29 Nochbaer
                m_Date = date;

                AddSource(id, fileName, metaData, comment, rating);
            }
                public Source(SearchResultSourceCollection sources, byte[] id, string fileName, RIndexedHashtable<string, string> metaData, string comment, byte rating)
                {
                    if (sources == null)
                        throw new ArgumentNullException("sources");
                    if (id == null)
                        throw new ArgumentNullException("id");
                    if (id.Length != 48)
                        throw new ArgumentException();
                    if (fileName == null)
                        throw new ArgumentNullException("fileName");
                    if (metaData == null)
                        throw new ArgumentNullException("metaData");
                    if (comment == null)
                        throw new ArgumentNullException("comment");
                    if (rating > 3)
                        throw new ArgumentOutOfRangeException("rating");

                    m_MetaData = new SearchResultSourceMetaDataCollection(sources, metaData);
                    m_ID = id;
                    m_IDString = Core.ByteArrayToString(m_ID);
                    m_FileName = fileName;
                    m_Comment = comment;
                    m_Rating = rating;
                }