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