fixed #713: History host filter error

This commit is contained in:
Jaex 2015-06-01 08:19:01 +03:00
parent 27f42f153f
commit 44e391d333
2 changed files with 30 additions and 20 deletions

View file

@ -112,36 +112,46 @@ private HistoryItem[] ApplyFilters(HistoryItem[] historyItems)
{
string type = cbTypeFilterSelection.Text;
result = result.Where(x => x.Type == type);
if (!string.IsNullOrEmpty(type))
{
result = result.Where(x => !string.IsNullOrEmpty(x.Type) && x.Type == type);
}
}
if (cbHostFilter.Checked)
{
string host = txtHostFilter.Text;
result = result.Where(x => x.Host.IndexOf(host, StringComparison.InvariantCultureIgnoreCase) >= 0);
if (!string.IsNullOrEmpty(host))
{
result = result.Where(x => !string.IsNullOrEmpty(x.Host) && x.Host.IndexOf(host, StringComparison.InvariantCultureIgnoreCase) >= 0);
}
}
string filenameFilter = txtFilenameFilter.Text;
if (cbFilenameFilter.Checked && !string.IsNullOrEmpty(filenameFilter))
if (cbFilenameFilter.Checked)
{
StringComparison rule = GetStringRule();
string filenameFilter = txtFilenameFilter.Text;
if (cbFilenameFilterMethod.SelectedIndex == 0) // Contains
if (!string.IsNullOrEmpty(filenameFilter))
{
result = result.Where(x => x.Filename.IndexOf(filenameFilter, rule) >= 0);
}
else if (cbFilenameFilterMethod.SelectedIndex == 1) // Starts with
{
result = result.Where(x => x.Filename.StartsWith(filenameFilter, rule));
}
else if (cbFilenameFilterMethod.SelectedIndex == 2) // Ends with
{
result = result.Where(x => x.Filename.EndsWith(filenameFilter, rule));
}
else if (cbFilenameFilterMethod.SelectedIndex == 3) // Exact match
{
result = result.Where(x => x.Filename.Equals(filenameFilter, rule));
StringComparison rule = GetStringRule();
if (cbFilenameFilterMethod.SelectedIndex == 0) // Contains
{
result = result.Where(x => x.Filename.IndexOf(filenameFilter, rule) >= 0);
}
else if (cbFilenameFilterMethod.SelectedIndex == 1) // Starts with
{
result = result.Where(x => x.Filename.StartsWith(filenameFilter, rule));
}
else if (cbFilenameFilterMethod.SelectedIndex == 2) // Ends with
{
result = result.Where(x => x.Filename.EndsWith(filenameFilter, rule));
}
else if (cbFilenameFilterMethod.SelectedIndex == 3) // Exact match
{
result = result.Where(x => x.Filename.Equals(filenameFilter, rule));
}
}
}

View file

@ -73,6 +73,6 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
RESX_AutoCreateNewLanguageFiles = True
RESX_AutoCreateNewLanguageFiles = False
EndGlobalSection
EndGlobal