Showing the changes to Source/Libraries/GSF.ServiceProcess (1 of 1 file). Show all
Unified · Split
| @@ -435,6 +435,16 @@ namespace GSF.ServiceProcess · 434 unmodified lines | ||
| 435 | 435 | { |
| 436 | 436 | int index = filterID; |
| 437 | 437 | |
| 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 | + | |
| 438 | 448 | // Attempt to remove a filter from the list of type inclusion filters |
| 439 | 449 | if (index < m_filter.TypeInclusionFilters.Count) |
| 440 | 450 | { |
| @@ -4096,7 +4106,7 @@ namespace GSF.ServiceProcess · 3655 unmodified lines | ||
| 4096 | 4106 | helpMessage.AppendLine(); |
| 4097 | 4107 | helpMessage.Append(" -Exclude <FilterDefinition> |"); |
| 4098 | 4108 | helpMessage.AppendLine(); |
| 4099 | − helpMessage.Append(" -Remove <ID> } ... ]"); | |
| 4109 | + helpMessage.Append(" -Remove { <ID> | All } } ... ]"); | |
| 4100 | 4110 | helpMessage.AppendLine(); |
| 4101 | 4111 | helpMessage.AppendLine(); |
| 4102 | 4112 | helpMessage.Append(" Filter -?"); |
| @@ -4121,7 +4131,7 @@ namespace GSF.ServiceProcess · 18 unmodified lines | ||
| 4121 | 4131 | helpMessage.Append("Defines a filter matching messages to be suppressed"); |
| 4122 | 4132 | helpMessage.AppendLine(); |
| 4123 | 4133 | helpMessage.Append(" -Remove".PadRight(20)); |
| 4124 | − helpMessage.Append("Removes a filter"); | |
| 4134 | + helpMessage.Append("Removes filters"); | |
| 4125 | 4135 | helpMessage.AppendLine(); |
| 4126 | 4136 | helpMessage.Append(" -?".PadRight(20)); |
| 4127 | 4137 | helpMessage.Append("Displays this help message"); |
| @@ -4158,13 +4168,22 @@ namespace GSF.ServiceProcess · 30 unmodified lines | ||
| 4158 | 4168 | if (i + 1 >= args.Length) |
| 4159 | 4169 | throw new FormatException("Malformed expression - Missing ID argument in 'Filter -Remove <ID>' command. Type 'Filter -?' to get help with this command."); |
| 4160 | 4170 | |
| 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."); | |
| 4164 | 4182 | |
| 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 | + } | |
| 4168 | 4187 | |
| 4169 | 4188 | i += 2; |
| 4170 | 4189 | } |