28#if OO_OXP_VERIFIER_ENABLED
34static NSString *
const kStageName =
@"Checking equipment.plist";
37@interface OOCheckEquipmentPListVerifierStage (OOPrivate)
39- (void)runCheckWithEquipment:(NSArray *)equipmentPList;
56 fileScanner = [[
self verifier] fileScannerStage];
57 return [fileScanner
fileExists:@"equipment.plist"
67 NSArray *equipmentPList =
nil;
69 fileScanner = [[
self verifier] fileScannerStage];
71 equipmentPList = [fileScanner
plistNamed:@"equipment.plist"
76 if (equipmentPList ==
nil)
return;
79 if (![equipmentPList isKindOfClass:[NSArray
class]])
81 OOLog(
@"verifyOXP.equipmentPList.notArray",
@"%@",
@"***** ERROR: equipment.plist is not an array.");
86 [
self runCheckWithEquipment:equipmentPList];
92@implementation OOCheckEquipmentPListVerifierStage (OOPrivate)
94- (void)runCheckWithEquipment:(NSArray *)equipmentPList
96 NSEnumerator *entryEnum =
nil;
98 unsigned entryIndex = 0;
100 NSString *name =
nil;
101 NSString *entryDesc =
nil;
103 for (entryEnum = [equipmentPList objectEnumerator]; (entry = [entryEnum nextObject]); )
108 if (![entry isKindOfClass:[NSArray
class]])
110 OOLog(
@"verifyOXP.equipmentPList.entryNotArray",
@"***** ERROR: equipment.plist entry %u of equipment.plist is not an array.", entryIndex);
114 elemCount = [entry count];
120 if (name !=
nil) entryDesc = [NSString stringWithFormat:@"%u (\"%@\")", entryIndex, name];
121 else entryDesc = [NSString stringWithFormat:@"%u", entryIndex];
126 OOLog(
@"verifyOXP.equipmentPList.badEntrySize",
@"***** ERROR: equipment.plist entry %@ has too few elements (%lu, should be 5 or 6).", entryDesc, elemCount);
131 OOLog(
@"verifyOXP.equipmentPList.badEntrySize",
@"----- WARNING: equipment.plist entry %@ has too many elements (%lu, should be 5 or 6).", entryDesc, elemCount);
140 OOLog(
@"verifyOXP.equipmentPList.badElementType",
@"***** ERROR: tech level for entry %@ of equipment.plist is not a positive integer.", entryDesc);
144 OOLog(
@"verifyOXP.equipmentPList.badElementType",
@"***** ERROR: price for entry %@ of equipment.plist is not a positive integer.", entryDesc);
148 OOLog(
@"verifyOXP.equipmentPList.badElementType",
@"***** ERROR: short description for entry %@ of equipment.plist is not a string.", entryDesc);
152 OOLog(
@"verifyOXP.equipmentPList.badElementType",
@"***** ERROR: key for entry %@ of equipment.plist is not a string.", entryDesc);
156 OOLog(
@"verifyOXP.equipmentPList.badElementType",
@"***** ERROR: long description for entry %@ of equipment.plist is not a string.", entryDesc);
163 OOLog(
@"verifyOXP.equipmentPList.badElementType",
@"***** ERROR: equipment.plist entry %@'s extra information dictionary is not a dictionary.", entryDesc);
static NSString *const kStageName
static NSString *const kStageName
#define OOLog(class, format,...)
@ EQUIPMENT_SHORT_DESC_INDEX
@ EQUIPMENT_LONG_DESC_INDEX
@ EQUIPMENT_TECH_LEVEL_INDEX
@ EQUIPMENT_EXTRA_INFO_INDEX
id plistNamed:inFolder:referencedFrom:checkBuiltIn:(NSString *file,[inFolder] NSString *folder,[referencedFrom] NSString *context,[checkBuiltIn] BOOL checkBuiltIn)
BOOL fileExists:inFolder:referencedFrom:checkBuiltIn:(NSString *file,[inFolder] NSString *folder,[referencedFrom] NSString *context,[checkBuiltIn] BOOL checkBuiltIn)