1 | //␊ |
2 | // ChameleonPrefPane␊ |
3 | //␊ |
4 | // test utility for the chameleon preference pane ␊ |
5 | //␊ |
6 | // Created by Rekursor on 11-11-12.␊ |
7 | //␊ |
8 | ␊ |
9 | #import <Foundation/Foundation.h>␊ |
10 | #import "PartitionInfoElement.h"␊ |
11 | #import "PartitionInfoManager.h"␊ |
12 | #import "SmbiosExtractor.h"␊ |
13 | #import "ShellProcess.h"␊ |
14 | ␊ |
15 | void testDiskInfoWith(NSString * bsd)␊ |
16 | {␊ |
17 | ␉PartitionInfoElement* di = [[PartitionInfoElement alloc] initWithBSDName: bsd];␊ |
18 | ␉␊ |
19 | ␉if ([di isValid] && [di.vUUID length] >0)␊ |
20 | ␉{␊ |
21 | #if 0␊ |
22 | ␉␉NSLog(@"bsdName %@", [di bsdName] );␊ |
23 | ␉␉NSLog(@"deviceProtocol %@", [ di devProtocol] );␊ |
24 | ␉␉NSLog(@"volumeName %@", [di vName]);␊ |
25 | ␉␉NSLog(@"volumeKind %@", [di vKind]);␊ |
26 | ␉␉NSLog(@"deviceInternal %i", (int) [ di devInternal] );␊ |
27 | ␉␉NSLog(@"volumeUUID %@", [di vUUID]);␊ |
28 | ␉␉NSLog(@"mediaPath %@", [di mediaPath]);␊ |
29 | ␉␉NSLog(@"mediaRemovable %i", (int) [di mediaRemovable]);␊ |
30 | ␉␉␊ |
31 | ␉␉NSLog(@"\n");␊ |
32 | ␊ |
33 | #else␊ |
34 | ␉␉int i = 0;␊ |
35 | ␉␉for (NSString* o in di.descDict)␊ |
36 | ␉␉{␊ |
37 | ␉␉ id value = [di.descDict objectForKey: o];␊ |
38 | ␉␉ if (value == nil) value = @"<nil>";␊ |
39 | ␉␉ NSLog(@"Key: %@, Value: %@", o, value );␊ |
40 | ␉␉ i++;␊ |
41 | ␉␉}␊ |
42 | #endif␊ |
43 | ␉}␊ |
44 | ␊ |
45 | ␉[di release];␊ |
46 | }␊ |
47 | ␊ |
48 | int main (int argc, const char * argv[]) ␊ |
49 | {␊ |
50 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];␊ |
51 | ␉␊ |
52 | ␉SmbiosExtractor* smbe = [[SmbiosExtractor alloc] init];␊ |
53 | ␉[smbe save:@"/tmp/chmIOreg.plist"];␊ |
54 | ␉NSLog(@"SMBIOS = \n%@", smbe); ␊ |
55 | ␉␊ |
56 | #if 1␊ |
57 | ␉NSArray* arr = [PartitionInfoElement createBSDPartitionList];␊ |
58 | ␉NSLog(@"List of existing bsd disk partitions:\n %@", arr);␊ |
59 | ␉␊ |
60 | ␉for (PartitionInfoElement* part in [PartsInfoMgr parts]) ␊ |
61 | ␉␉NSLog(@"PartionBootable = %i\n%@", (int) [part isBootable], part);␊ |
62 | /*␊ |
63 | ␉[PartsInfoMgr hideParts: @"\"Macintosh HD\" hd(0,3)"];␊ |
64 | ␉[PartsInfoMgr hideParts: @"disk0s2 hd(0,2) "];␊ |
65 | ␉[PartsInfoMgr hideParts: @"BOOTCAMP \"Macintosh HD\""];␊ |
66 | ␉[PartsInfoMgr hideParts: @"3E9C6A92-3737-4C0F-9003-20B2482D61FB"];␊ |
67 | */␊ |
68 | ␉[PartsInfoMgr renameParts: @"hd(0,2) \"Test\""];␊ |
69 | ␉[PartsInfoMgr renameParts: @"hd(0,3) Fantastic"];␊ |
70 | ␉[PartsInfoMgr renameParts: @"hd(0,4) \"A BC\"; hd(0,2) DEF"];␊ |
71 | ␉␊ |
72 | #else␊ |
73 | ␉testDiskInfoWith(@"disk0s2");␉␊ |
74 | ␉testDiskInfoWith(@"disk0s3");␉␊ |
75 | #endif␊ |
76 | ␊ |
77 | ␉[pool drain];␊ |
78 | return 0;␊ |
79 | }␊ |
80 | |