Chameleon Applications

Chameleon Applications Svn Source Tree

Root/trunk/ChameleonPrefPane/test_util/test_util.mm

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
14void testDiskInfoWith(NSString * bsd)
15{
16PartitionInfoElement* di = [[PartitionInfoElement alloc] initWithBSDName: bsd];
17
18if ([di isValid] && [di.vUUID length] >0)
19{
20#if 0
21NSLog(@"bsdName %@", [di bsdName] );
22NSLog(@"deviceProtocol %@", [ di devProtocol] );
23NSLog(@"volumeName %@", [di vName]);
24NSLog(@"volumeKind %@", [di vKind]);
25NSLog(@"deviceInternal %i", (int) [ di devInternal] );
26NSLog(@"volumeUUID %@", [di vUUID]);
27NSLog(@"mediaPath %@", [di mediaPath]);
28NSLog(@"mediaRemovable %i", (int) [di mediaRemovable]);
29
30NSLog(@"\n");
31
32#else
33int i = 0;
34for (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
47int main (int argc, const char * argv[])
48{
49 NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
50
51#if 1
52NSArray* arr = [PartitionInfoElement createBSDPartitionList];
53NSLog(@"List of existing bsd disk partitions:\n %@", arr);
54
55for (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
65testDiskInfoWith(@"disk0s2");
66testDiskInfoWith(@"disk0s3");
67#endif
68
69[pool drain];
70 return 0;
71}
72

Archive Download this file

Revision: 341