我正在尝试编写一些编辑二进制plist文件的脚本。 plist描述了DVD studio pro文件中包含的对象。看起来DVD studio pro中的文本框在plist中编码为base64数据,用于描述文本字符串及其格式。我似乎无法弄清楚如何理解这些数据。理想情况下,我希望能够更改文本字符串,但不能更改格式。以下似乎描述了一个文本框,上面写着“菜单标题”。有两个字符串,一个字符串称为“字典”,另一个字符串称为“字符串”;两者都是CFData。有什么想法我可以解析这个或将其转换为我可以直接编辑的格式?我一直在玩可可,但是没有运气。
<dict>
<key>Dictionary</key>
<data>
BAtzdHJlYW10
eXBlZIHoA4QB
QISEhAxOU0Rp
Y3Rpb25hcnkA
hIQITlNPYmpl
Y3QAhYQBaQaS
hISECE5TU3Ry
aW5nAZSEASsG
TlNGb250hpKE
hIQGTlNGb250
HpSVJIQFWzM2
Y10GAAAAGgAA
AP/+TAB1AGMA
aQBkAGEARwBy
AGEAbgBkAGUA
AACEAWYVhAFj
AJsBmwCbAIaS
hJaXB05TQ29s
b3KGkoSEhAdO
U0NvbG9yAJSb
AYQEZmZmZoPz
8nI/g/Dvbz+D
7OtrPwGGkoSW
lwtOU0V4cGFu
c2lvboaShISE
CE5TTnVtYmVy
AISEB05TVmFs
dWUAlIQBKoSa
moNHx9c9hpKE
lpcNTlNPYmxp
cXVlbmVzc4aS
hJ6ghIQBZKEA
hpKElpcQTlNQ
YXJhZ3JhcGhT
dHlsZYaShISE
EE5TUGFyYWdy
YXBoU3R5bGUA
lIQEQ0NAUwAA
hQCGkoSWlxFO
U0JhY2tncm91
bmRDb2xvcoaS
hJubA4QCZmYA
AIaG
</data>
<key>String</key>
<data>
BAtzdHJlYW10
eXBlZIHoA4QB
QISEhBJOU0F0
dHJpYnV0ZWRT
dHJpbmcAhIQI
TlNPYmplY3QA
hZKEhIQITlNT
dHJpbmcBlIQB
Kw9OZW51IFRp
dGxlIEhlcmWG
hAJpSQEPkoSE
hAxOU0RpY3Rp
b25hcnkAlIQB
aQWShJaWDU5T
T2JsaXF1ZW5l
c3OGkoSEhAhO
U051bWJlcgCE
hAdOU1ZhbHVl
AJSEASqEhAFk
nQCGkoSWlgtO
U0V4cGFuc2lv
boaShJuchIQB
Zp6DR8fXPYaS
hJaWEE5TUGFy
YWdyYXBoU3R5
bGWGkoSEhBBO
U1BhcmFncmFw
aFN0eWxlAJSE
BENDQFMAAIUA
hpKElpYGTlNG
b250hpKEhIQG
TlNGb250HpSZ
JIQFWzM2Y10G
AAAAGgAAAP/+
TAB1AGMAaQBk
AGEARwByAGEA
bgBkAGUAAACe
FYQBYwCjAaMA
owCGkoSWlgdO
U0NvbG9yhpKE
hIQHTlNDb2xv
cgCUowGEBGZm
ZmaD8/JyP4Pw
728/g+zraz8B
hoaG
</data>
</dict>
答案 0 :(得分:2)
这是一个base64编码的NSArchiver存档。您需要先解码base64,然后使用[NSUnarchiver unarchiveObjectWithData:]
。上面的“Dictionary”条目在解码后看起来像这样(在Python语法中,因为我使用了pyObjC):
{
NSBackgroundColor = "NSCalibratedWhiteColorSpace 0 0";
NSColor = "NSCalibratedRGBColorSpace 0.94902 0.937255 0.921569 1";
NSExpansion = "0.1053606";
NSFont = "\"LucidaGrande 21.00 pt. P [] (0x103110b60) fobj=0x103110c30, spc=6.64\"";
NSObliqueness = 0;
NSParagraphStyle = "Alignment 0, LineSpacing 0, ParagraphSpacing 0, ParagraphSpacingBefore 0, HeadIndent 0, TailIndent 0, FirstLineHeadIndent 0, LineHeight 0/0, LineHeightMultiple 0, LineBreakMode 0, Tabs (\n 28L,\n 56L,\n 84L,\n 112L,\n 140L,\n 168L,\n 196L,\n 224L,\n 252L,\n 280L,\n 308L,\n 336L\n), DefaultTabInterval 0, Blocks (null), Lists (null), BaseWritingDirection -1, HyphenationFactor 0, TighteningFactor 0.05, HeaderLevel 0";
}