diff --git a/DPCIManager.xcodeproj/project.pbxproj b/DPCIManager.xcodeproj/project.pbxproj index e991d1f..44eb9b1 100644 --- a/DPCIManager.xcodeproj/project.pbxproj +++ b/DPCIManager.xcodeproj/project.pbxproj @@ -407,7 +407,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; CURRENT_MARKETING_VERSION = 2.0; - CURRENT_PROJECT_VERSION = 311; + CURRENT_PROJECT_VERSION = 315; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -457,7 +457,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = YES; CURRENT_MARKETING_VERSION = 2.0; - CURRENT_PROJECT_VERSION = 311; + CURRENT_PROJECT_VERSION = 315; DEBUG_INFORMATION_FORMAT = dwarf; DEPLOYMENT_POSTPROCESSING = YES; ENABLE_STRICT_OBJC_MSGSEND = YES; diff --git a/DPCIManager/AppDelegate.h b/DPCIManager/AppDelegate.h index e500051..9e3ff67 100644 --- a/DPCIManager/AppDelegate.h +++ b/DPCIManager/AppDelegate.h @@ -42,6 +42,7 @@ typedef struct { -(IBAction)rebuild:(id)sender; -(IBAction)install:(id)sender; -(IBAction)fetchvBIOS:(id)sender; +-(IBAction)savePCIInfo:(id)sender; -(void)logTask:(NSData *)data; @end diff --git a/DPCIManager/AppDelegate.m b/DPCIManager/AppDelegate.m index 4bbd226..8343320 100644 --- a/DPCIManager/AppDelegate.m +++ b/DPCIManager/AppDelegate.m @@ -223,6 +223,25 @@ -(IBAction)fetchvBIOS:(id)sender{ IOObjectRelease(service); } } + +-(IBAction)savePCIInfo:(id)sender{ + NSArray *devices = [pciDevice readIDs]; + NSMutableString *deviceList = NSMutableString.string; + for (pciDevice *device in [devices sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) { return [obj1 bdf] - [obj2 bdf]; }]){ + [deviceList appendString:device.lspciString]; + [deviceList appendString:@"\n"]; + } + // Save info + NSSavePanel *sp = NSSavePanel.savePanel; + [sp setDirectoryURL:[NSURL URLWithString:[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject]]]; + [sp setAllowedFileTypes:@[@"txt"]]; + [sp beginSheetModalForWindow:NSApp.mainWindow completionHandler:^(NSInteger result){ + if(result == NSFileHandlingPanelOKButton){ + [sp orderOut:self]; + [deviceList writeToURL:sp.URL atomically:YES encoding:NSUTF8StringEncoding error:nil]; + } + }]; +} #pragma mark Logging -(void)readLog:(NSData *)data{ [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] enumerateLinesUsingBlock:^(NSString *line, BOOL *stop){ diff --git a/DPCIManager/en.lproj/MainMenu.xib b/DPCIManager/en.lproj/MainMenu.xib index 4f74dbe..a942798 100644 --- a/DPCIManager/en.lproj/MainMenu.xib +++ b/DPCIManager/en.lproj/MainMenu.xib @@ -1,8 +1,8 @@ - + - + @@ -94,7 +94,7 @@ - + @@ -1057,7 +1057,7 @@ - + @@ -1205,7 +1205,7 @@ - + @@ -1330,12 +1330,12 @@ - - - - - - + + + + + +