mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-25 06:29:27 +00:00
Removed AutotypeParser as this is now handled by an NSString Cateogriy in KeePassKit
This commit is contained in:
@@ -11,12 +11,7 @@
|
||||
#import "KPKAutotype.h"
|
||||
#import "KPKEntry.h"
|
||||
#import "KPKWindowAssociation.h"
|
||||
|
||||
@interface MPAutotypeContext ()
|
||||
|
||||
@property (nonatomic, assign) BOOL isCommand;
|
||||
|
||||
@end
|
||||
#import "NSString+Commands.h"
|
||||
|
||||
@implementation MPAutotypeContext
|
||||
|
||||
@@ -32,41 +27,9 @@
|
||||
|
||||
- (instancetype)initWithEntry:(KPKEntry *)entry andSequence:(NSString *)sequence {
|
||||
self = [super init];
|
||||
/*
|
||||
Parse the sequence to determine a possible Value?
|
||||
DELAY <seconds>
|
||||
TAB <repeat>
|
||||
VKEY <code>
|
||||
*/
|
||||
if(self) {
|
||||
if(entry == nil || sequence == nil) {
|
||||
self = nil;
|
||||
}
|
||||
else {
|
||||
self.entry = entry;
|
||||
NSError *error;
|
||||
NSRegularExpression *regexp = [[NSRegularExpression alloc] initWithPattern:@"\\{([a-z]+)?([0-9]*)\\}" options:NSRegularExpressionCaseInsensitive error:&error];
|
||||
if(regexp) {
|
||||
[regexp enumerateMatchesInString:sequence options:0 range:NSMakeRange(0, [sequence length]) usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) {
|
||||
NSRange commandRange = [result rangeAtIndex:1];
|
||||
NSRange valueRange = [result rangeAtIndex:2];
|
||||
if(commandRange.location != NSNotFound && commandRange.length != 0) {
|
||||
self.command = [sequence substringWithRange:commandRange];
|
||||
self.isCommand = YES;
|
||||
}
|
||||
if(valueRange.location != NSNotFound && valueRange.length != 0) {
|
||||
self.value = [[sequence substringWithRange:valueRange] integerValue];
|
||||
}
|
||||
else {
|
||||
self.value = NSNotFound;
|
||||
}
|
||||
}];
|
||||
}
|
||||
else {
|
||||
NSLog(@"Error while trying to parse Autotype sequence: %@", [error localizedDescription]);
|
||||
}
|
||||
|
||||
}
|
||||
_command = [[sequence normalizedCommand] copy];
|
||||
_entry = entry;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user