History

GSF.ServiceProcess: Added functionality to remove all filters using the Filter command in the remoting console.

StephenCWills committed 9 years ago

Commit 2a210191 parent 21644791 file · +27 −8Browse files

Showing the changes to Source/Libraries/GSF.ServiceProcess (1 of 1 file). Show all

Unified · Split

Source/Libraries/GSF.ServiceProcess/ServiceHelper.cs+27−8
@@ -435,6 +435,16 @@ namespace GSF.ServiceProcess · 434 unmodified lines
435435 {
436436 int index = filterID;
437437
438+ // Determine whether to remove all filters
439+ if (index < 0)
440+ {
441+ m_filter.TypeInclusionFilters.Clear();
442+ m_filter.TypeExclusionFilters.Clear();
443+ m_filter.PatternInclusionFilters.Clear();
444+ m_filter.PatternExclusionFilters.Clear();
445+ return;
446+ }
447+
438448 // Attempt to remove a filter from the list of type inclusion filters
439449 if (index < m_filter.TypeInclusionFilters.Count)
440450 {
@@ -4096,7 +4106,7 @@ namespace GSF.ServiceProcess · 3655 unmodified lines
40964106 helpMessage.AppendLine();
40974107 helpMessage.Append(" -Exclude <FilterDefinition> |");
40984108 helpMessage.AppendLine();
4099− helpMessage.Append(" -Remove <ID> } ... ]");
4109+ helpMessage.Append(" -Remove { <ID> | All } } ... ]");
41004110 helpMessage.AppendLine();
41014111 helpMessage.AppendLine();
41024112 helpMessage.Append(" Filter -?");
@@ -4121,7 +4131,7 @@ namespace GSF.ServiceProcess · 18 unmodified lines
41214131 helpMessage.Append("Defines a filter matching messages to be suppressed");
41224132 helpMessage.AppendLine();
41234133 helpMessage.Append(" -Remove".PadRight(20));
4124− helpMessage.Append("Removes a filter");
4134+ helpMessage.Append("Removes filters");
41254135 helpMessage.AppendLine();
41264136 helpMessage.Append(" -?".PadRight(20));
41274137 helpMessage.Append("Displays this help message");
@@ -4158,13 +4168,22 @@ namespace GSF.ServiceProcess · 30 unmodified lines
41584168 if (i + 1 >= args.Length)
41594169 throw new FormatException("Malformed expression - Missing ID argument in 'Filter -Remove <ID>' command. Type 'Filter -?' to get help with this command.");
41604170
4161− // Check for parsing errors in the filter ID
4162− if (!int.TryParse(args[i + 1], out filterID))
4163− throw new FormatException("Malformed expression - ID argument supplied to 'Filter -Remove <ID>' must be an integer. Type 'Filter -?' to get help with this command.");
4171+ if (args[i + 1].Equals("All", StringComparison.OrdinalIgnoreCase))
4172+ {
4173+ // Add a negative number to the list of IDs to remove
4174+ // to indicate that all IDs need to be removed
4175+ removalIDs.Add(-1);
4176+ }
4177+ else
4178+ {
4179+ // Check for parsing errors in the filter ID
4180+ if (!int.TryParse(args[i + 1], out filterID))
4181+ throw new FormatException("Malformed expression - ID argument supplied to 'Filter -Remove <ID>' must be an integer. Type 'Filter -?' to get help with this command.");
41644182
4165− // Add the ID to the list of filter IDs to be removed from the client's filter
4166− if (i + 1 < args.Length && int.TryParse(args[i + 1], out filterID))
4167− removalIDs.Add(filterID);
4183+ // Add the ID to the list of filter IDs to be removed from the client's filter
4184+ if (i + 1 < args.Length)
4185+ removalIDs.Add(filterID);
4186+ }
41684187
41694188 i += 2;
41704189 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t