3
edits
Dhcmrlchtdj (talk | contribs) (Added some quick and dirty code to parse .DS_Store files) |
Dhcmrlchtdj (talk | contribs) (Minor change to parsing code for Leopard compatibility) |
||
| Line 66: | Line 66: | ||
#define kDSTypeShort 'shor' // SInt16 (4 bytes, but highest two are always zero) | #define kDSTypeShort 'shor' // SInt16 (4 bytes, but highest two are always zero) | ||
#define kDSTypeLong 'long' // SInt32 (4 bytes) | #define kDSTypeLong 'long' // SInt32 (4 bytes) | ||
#define kDSTypeOSType 'type' // OSType (4 bytes) | |||
#define kDSTypeUnicodeString 'ustr' // UTF-16 encoded string (4-byte length follows type code) | #define kDSTypeUnicodeString 'ustr' // UTF-16 encoded string (4-byte length follows type code) | ||
#define kDSTypeBlob 'blob' // arbitrary structure (4-byte length follows type code) | #define kDSTypeBlob 'blob' // arbitrary structure (4-byte length follows type code) | ||
| Line 86: | Line 87: | ||
#define kDSTagComment 'cmmt' // ustr | #define kDSTagComment 'cmmt' // ustr | ||
#define kDSTagClippingRect 'clip' // blob -- 8 bytes | #define kDSTagClippingRect 'clip' // blob -- 8 bytes | ||
#define kDSTagViewStyle 'vstl' // type -- 4 bytes | |||
// background types | // background types | ||
| Line 106: | Line 108: | ||
#define kDSLabelPositionBottom 'botm' | #define kDSLabelPositionBottom 'botm' | ||
#define kDSLabelPositionRight 'rght' | #define kDSLabelPositionRight 'rght' | ||
// view styles (Leopard) -- possible values for kDSTagViewStyle | |||
#define kDSViewStyleIcons 'icnv' | |||
#define kDSViewStyleList 'Nlsv' | |||
#define kDSViewStyleColumns 'clmv' | |||
#define kDSViewStyleCoverFlow 'Flwv' | |||
#pragma options align=mac68k | #pragma options align=mac68k | ||
| Line 245: | Line 254: | ||
{ | { | ||
DSBackground background = *(const DSBackground *)dataPtr; | DSBackground background = *(const DSBackground *)dataPtr; | ||
const char * typeName = 0; | |||
background.mBackgroundType = flip_long(background.mBackgroundType); | background.mBackgroundType = flip_long(background.mBackgroundType); | ||
switch(background.mBackgroundType) | switch(background.mBackgroundType) | ||
{ | { | ||
case kDSBackgroundDefault: | case kDSBackgroundDefault: typeName = "default"; break; | ||
case kDSBackgroundColor: typeName = "color"; break; | |||
case kDSBackgroundPicture: typeName = "picture"; break; | |||
} | |||
if(typeName) | |||
{ | |||
printf("(type = %s)", typeName); | |||
} | } | ||
} | } | ||
| Line 334: | Line 335: | ||
flip_rect(&clippingRect); | flip_rect(&clippingRect); | ||
print_rect("(clipping_rect = %s)", &clippingRect); | print_rect("(clipping_rect = %s)", &clippingRect); | ||
break; | |||
} | |||
case kDSTagViewStyle: | |||
{ | |||
if(type == kDSTypeOSType) | |||
{ | |||
uint32_t viewStyle = flip_long(*(const uint32_t*)dataPtr); | |||
const char * styleName = 0; | |||
switch(viewStyle) | |||
{ | |||
case kDSViewStyleIcons: styleName = "icons"; break; | |||
case kDSViewStyleList: styleName = "list"; break; | |||
case kDSViewStyleColumns: styleName = "columns"; break; | |||
case kDSViewStyleCoverFlow: styleName = "Cover Flow"; break; | |||
} | |||
if(styleName) | |||
{ | |||
printf("(view style = %s)", styleName); | |||
} | |||
} | |||
break; | break; | ||
} | } | ||
| Line 407: | Line 431: | ||
case kDSTypeShort: | case kDSTypeShort: | ||
case kDSTypeLong: | case kDSTypeLong: | ||
case kDSTypeOSType: | |||
{ | { | ||
dataSize = 4; | dataSize = 4; | ||
edits