Example #1
0
 private FilterResult RunBlockHashFilter(string fileSha1, int phoneId, List<BlockHashFilter.UnfilterdBlockResult> storedBlocks)
 {
     FilterResult filterResult = null;
     try
     {
         write("Starting block hash filtering");
         DateTime dt = DateTime.Now;
         BlockHashFilter bhf = new BlockHashFilter(this.filePath, HashLoader.HashLoader.DefaultBlockSize,
             HashLoader.HashLoader.DefaultSlideAmount, fileSha1, true, storedBlocks);
     #if _USESQLSERVER_
             filterResult = bhf.Filter(phoneId);
     #else
         SQLiteConnection sql = DatabaseAccess.OpenSql(true);
         try
         {
             filterResult = bhf.Filter(phoneId, sql, true);
         }
         finally
         {
             sql.Close();
             sql.Dispose();
         }
     #endif
         TimeSpan ts = DateTime.Now.Subtract(dt);
         write("Time elapsed for block hash filtering: {0}", ts.ToString("c"));
         long nBytes = filterResult.FilteredBytesCount + filterResult.UnfilteredBytesCount;
         write("Filtered {0} out of {1} bytes: {2:0.00###}", filterResult.FilteredBytesCount,
               nBytes, (nBytes - filterResult.UnfilteredBytesCount) / (double)nBytes);
     }
     catch (ThreadAbortException)
     {
         return null;
     }
     catch (Exception ex)
     {
         DisplayExceptionMessages(ex, "Block Hash Filter");
         return null;
     }
     return filterResult;
 }
 public FilterResult RunBlockHashFilter()
 {
     var filter = new BlockHashFilter(_inputFile, _blockSize, _slideAmount, _memoryId, _noFilter);
     return filter.Filter(_phoneId);
 }