Пример #1
0
        public void Add(SubFingerprintHash hash, SubFingerprintLookupEntry lookupEntry)
        {
            int index = -1;

            if (!trackToNumber.TryGetValue(lookupEntry.AudioTrack, out index))
            {
                index = trackToNumber.Count;
                trackToNumber.Add(lookupEntry.AudioTrack, index);
                numberToTrack.Add(index, lookupEntry.AudioTrack);
            }

            if (index == -1)
            {
                throw new Exception("something's wrong - this should not happen!!");
            }

            var dto = new DTO {
                Hash               = hash.Value,
                TrackNumber        = index,
                TrackPositionIndex = lookupEntry.Index
            };

            insertBuffer.Add(dto);

            if (insertBuffer.Count == 1000)
            {
                InsertBuffered();
            }

            //db.Insert();
        }
 public void Add(SubFingerprintHash hash, SubFingerprintLookupEntry lookupEntry)
 {
     if (!lookupTable.ContainsKey(hash))
     {
         lookupTable.Add(hash, new List <SubFingerprintLookupEntry>());
     }
     lookupTable[hash].Add(lookupEntry);
 }
        public List <SubFingerprintLookupEntry> GetValues(SubFingerprintHash hash)
        {
            List <SubFingerprintLookupEntry> returnValue;

            if (lookupTable.TryGetValue(hash, out returnValue))
            {
                return(returnValue);
            }
            else
            {
                return(new List <SubFingerprintLookupEntry>());
            }
        }
Пример #4
0
        public List <SubFingerprintLookupEntry> GetValues(SubFingerprintHash hash)
        {
            if (insertBuffer.Count > 0)
            {
                InsertBuffered();
            }

            //var start = DateTime.Now;
            IEnumerable <DTO> result = db.Query <DTO>("select * from DTO where Hash = ?", hash.Value);
            List <SubFingerprintLookupEntry> lookupEntries = new List <SubFingerprintLookupEntry>();

            foreach (DTO dto in result)
            {
                lookupEntries.Add(new SubFingerprintLookupEntry(numberToTrack[dto.TrackNumber], dto.TrackPositionIndex));
            }
            //Debug.WriteLine("GetLookupEntries duration: " + (DateTime.Now - start));
            return(lookupEntries);
        }
Пример #5
0
 public SubFingerprint(int index, SubFingerprintHash hash, bool variation)
 {
     Index       = index;
     Hash        = hash;
     IsVariation = variation;
 }
Пример #6
0
 public List <SubFingerprintLookupEntry> GetValues(SubFingerprintHash hash)
 {
     return(lookupTable[hash]);
 }