Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified Resources/de.lproj/Localizable.strings
Binary file not shown.
Binary file modified Resources/en.lproj/Localizable.strings
Binary file not shown.
25 changes: 19 additions & 6 deletions Source/MonitorEvidenceSource.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

@implementation MonitorEvidenceSource

#define ANY_ADDITIONAL_MONITOR_SERIAL @"any-additional-monitor"

- (id)init
{
if (!(self = [super init]))
Expand Down Expand Up @@ -113,12 +115,16 @@ - (BOOL)doesRuleMatch:(NSDictionary *)rule
NSEnumerator *en = [monitors objectEnumerator];
NSDictionary *mon;
NSString *serial = [rule valueForKey:@"parameter"];
while ((mon = [en nextObject])) {
if ([[mon valueForKey:@"serial"] isEqualToString:serial]) {
match = YES;
break;
}
}
if ((1 < [monitors count]) && [serial isEqualToString:ANY_ADDITIONAL_MONITOR_SERIAL]) {
match = YES;
} else {
while ((mon = [en nextObject])) {
if ([[mon valueForKey:@"serial"] isEqualToString:serial]) {
match = YES;
break;
}
}
}
[lock unlock];

return match;
Expand All @@ -135,6 +141,13 @@ - (NSArray *)getSuggestions

[lock lock];
NSEnumerator *en = [monitors objectEnumerator];

// add any monitor by default
[arr addObject:[NSDictionary dictionaryWithObjectsAndKeys:
@"Monitor", @"type",
ANY_ADDITIONAL_MONITOR_SERIAL, @"parameter",
NSLocalizedString(@"Any additional monitor", @"In getSuggestions"), @"description", nil]];

NSDictionary *mon;
while ((mon = [en nextObject])) {
NSString *name = [mon valueForKey:@"name"];
Expand Down