[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="inputs">List of input strings representing hashes to check for</param>
/// <param name="size">Size to limit hash by, -1 otherwise</param> /// <param name="size">Size to limit hash by, -1 otherwise</param>
/// <param name="outdat">Output directory</param> /// <param name="outdat">Output directory</param>
/// TODO: Verify implementation
private static void InitLookup( private static void InitLookup(
List<string> inputs, List<string> inputs,
long size, long size,
string outdat) 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 // First, try to figure out what type of hash each is by length and clean it
List<string> crc = new List<string>(); List<string> crc = new List<string>();
List<string> md5 = new List<string>(); List<string> md5 = new List<string>();
@@ -662,7 +659,13 @@ namespace RombaSharp
SqliteDataReader sldr = slc.ExecuteReader(); SqliteDataReader sldr = slc.ExecuteReader();
if (sldr.HasRows) 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 else
{ {
@@ -679,7 +682,13 @@ namespace RombaSharp
SqliteDataReader sldr = slc.ExecuteReader(); SqliteDataReader sldr = slc.ExecuteReader();
if (sldr.HasRows) 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 else
{ {
@@ -696,7 +705,13 @@ namespace RombaSharp
SqliteDataReader sldr = slc.ExecuteReader(); SqliteDataReader sldr = slc.ExecuteReader();
if (sldr.HasRows) 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 else
{ {

View File

@@ -165,21 +165,9 @@ namespace RombaSharp
// Verify that the current flag is proper for the feature // Verify that the current flag is proper for the feature
if (!_help[feature].ValidateInput(args[i])) if (!_help[feature].ValidateInput(args[i]))
{ {
// Special cases for files // Everything else is treated as a generic input
List<string> temp = new List<string>(); inputs.Add(args[i]);
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;
}
} }
inputs.Add(args[i]);
} }
// Now loop through all inputs // Now loop through all inputs