[RombaSharp] Fix Lookup implementation

This commit is contained in:
Matt Nadareski
2018-02-09 21:15:13 -08:00
parent 506723c725
commit 6598e1bef9
2 changed files with 23 additions and 20 deletions

View File

@@ -610,14 +610,11 @@ namespace RombaSharp
/// <param name="inputs">List of input strings representing hashes to check for</param>
/// <param name="size">Size to limit hash by, -1 otherwise</param>
/// <param name="outdat">Output directory</param>
/// TODO: Verify implementation
private static void InitLookup(
List<string> inputs,
long size,
string outdat)
{
Globals.Logger.Error("This feature is not yet implemented: lookup");
// First, try to figure out what type of hash each is by length and clean it
List<string> crc = new List<string>();
List<string> md5 = new List<string>();
@@ -662,7 +659,13 @@ namespace RombaSharp
SqliteDataReader sldr = slc.ExecuteReader();
if (sldr.HasRows)
{
Globals.Logger.User("For hash '{0}' there were {1} matches in the database", input, sldr.RecordsAffected);
int count = 0;
while (sldr.Read())
{
count++;
}
Globals.Logger.User("For hash '{0}' there were {1} matches in the database", input, count);
}
else
{
@@ -679,7 +682,13 @@ namespace RombaSharp
SqliteDataReader sldr = slc.ExecuteReader();
if (sldr.HasRows)
{
Globals.Logger.User("For hash '{0}' there were {1} matches in the database", input, sldr.RecordsAffected);
int count = 0;
while (sldr.Read())
{
count++;
}
Globals.Logger.User("For hash '{0}' there were {1} matches in the database", input, count);
}
else
{
@@ -696,7 +705,13 @@ namespace RombaSharp
SqliteDataReader sldr = slc.ExecuteReader();
if (sldr.HasRows)
{
Globals.Logger.User("For hash '{0}' there were {1} matches in the database", input, sldr.RecordsAffected);
int count = 0;
while (sldr.Read())
{
count++;
}
Globals.Logger.User("For hash '{0}' there were {1} matches in the database", input, count);
}
else
{

View File

@@ -165,22 +165,10 @@ namespace RombaSharp
// Verify that the current flag is proper for the feature
if (!_help[feature].ValidateInput(args[i]))
{
// Special cases for files
List<string> temp = new List<string>();
temp.Add(args[i]);
if (!File.Exists(args[i])
&& !Directory.Exists(args[i])
&& GetValidDats(temp).Count == 0)
{
Globals.Logger.Error("Invalid input detected: {0}", args[i]);
_help.OutputIndividualFeature(feature);
Globals.Logger.Close();
return;
}
}
// Everything else is treated as a generic input
inputs.Add(args[i]);
}
}
// Now loop through all inputs
Dictionary<string, Feature> features = _help.GetEnabledFeatures();