Glad you found a solution.
I'd still like to see some of the offending "false positive" files to be able to have a look.
In the meanwhile, and a bit of a tangent, but still relevant, I'd change your txt
function to :
private bool txt(string file, string q)
{
string contents = "";
using (TextReader read = new StreamReader(file))
{
contents = read.ReadToEnd();
}
return contents.ToLower().Contains(q);
}
Cleaner that way.
Edit :
Well, the reason they return true is because those files do contain the string "Test" in them, Specifically: [CCP_TEST RMCCPSearchValidateProductIDSetODBCFoldersAllocateRegistrySpaceNOT] in the MSI
and [OnUpda teSt ring] in the dll
. So, the String.Contains()
is working properly.
So, back to filtering what you're searching for. Either give a list of known text endings, or let the user choose what he wants.
Some other things you might want to consider is only searching for exact words, so test
won't be true in the case of OnUpdateString
:)