Example #1
0
def parseVorbisComment(parent):
    yield PascalString32(parent, 'vendor', charset="UTF-8")
    yield UInt32(parent, 'count')
    for index in xrange(parent["count"].value):
        yield PascalString32(parent, 'metadata[]', charset="UTF-8")
    if parent.current_size != parent.size:
        yield UInt8(parent, "framing_flag")
Example #2
0
 def createFields(self):
     yield PascalString32(self, "name", "Name", strip="\0", charset="UTF-8")
     yield UInt32(self, "flags", "Flags")
     yield PascalString32(self,
                          "data",
                          "Data",
                          strip=" \0",
                          charset="UTF-8")
Example #3
0
    def createFields(self):
        # Header
        yield UInt16(self, "version", "Version (=1)")
        yield Bytes(self, "endian", 2, "Endian (\\xfe\\xff for little endian)")
        yield UInt8(self, "os_version")
        yield UInt8(self, "os_revision")
        yield Enum(UInt16(self, "os"), OS_NAME)
        yield Int32(self, "unused", "(=-1)")
        yield GUID(self, "clsid")

        # User type
        yield PascalString32(self, "user_type", strip="\0")

        # Clipboard format
        if self["os"].value == OS_MAC:
            yield Int32(self, "unused[]", "(=-2)")
            yield String(self, "clipboard_format", 4)
        else:
            yield PascalString32(self, "clipboard_format", strip="\0")
        if self._current_size // 8 == self.datasize:
            return

        # -- OLE 2.01 ---

        # Program ID
        yield PascalString32(self, "prog_id", strip="\0")

        if self["os"].value != OS_MAC:
            # Magic number
            yield textHandler(
                UInt32(self, "magic", "Magic number (0x71B239F4)"),
                hexadecimal)

            # Unicode version
            yield PascalStringWin32(self, "user_type_unicode", strip="\0")
            yield PascalStringWin32(self,
                                    "clipboard_format_unicode",
                                    strip="\0")
            yield PascalStringWin32(self, "prog_id_unicode", strip="\0")

        # _current_size because current_size returns _current_max_size
        size = self.datasize - (self._current_size // 8)
        if size:
            yield NullBytes(self, "end_padding", size)

        if self.datasize < self.size // 8:
            yield RawBytes(self, "slack_space",
                           (self.size // 8) - self.datasize)
Example #4
0
 def createFields(self):
     yield UInt32(self, "width", "Channel width")
     yield UInt32(self, "height", "Channel height")
     yield PascalString32(self, "name", "Channel name", strip="\0", charset="UTF-8")
     yield from readProperties(self)
     yield UInt32(self, "hierarchy_ofs", "Hierarchy offset")
     yield XcfHierarchy(self, "hierarchy", "Hierarchy")
Example #5
0
    def createFields(self):
        yield UInt32(self, "width", "Layer width in pixels")
        yield UInt32(self, "height", "Layer height in pixels")
        yield Enum(UInt32(self, "type", "Layer type"), XcfFile.IMAGE_TYPE_NAME)
        yield PascalString32(self, "name", "Layer name", strip="\0", charset="UTF-8")
        for prop in readProperties(self):
            yield prop

        # --
        # TODO: Hack for Gimp 1.2 files
        # --

        yield UInt32(self, "hierarchy_ofs", "Hierarchy offset")
        yield UInt32(self, "mask_ofs", "Layer mask offset")
        padding = self.seekByte(self["hierarchy_ofs"].value, relative=False)
        if padding is not None:
            yield padding
        yield XcfHierarchy(self, "hierarchy", "Hierarchy")
Example #6
0
 def createFields(self):
     yield TimestampMac32(self, "timestamp")
     yield PascalString32(self, "text")
Example #7
0
 def createFields(self):
     yield UInt32(self, "unknown[]")
     yield PascalString32(self, "data")