edk2toollib/windows/policy/firmware_policy.py
def FromFileStream(cls, fs: BinaryIO, fsOffset: int = None):
        """if fsOffset is not specified, stream fs position is at beginning of struct"""
        if fsOffset:
            fs.seek(fsOffset)
        else:
            fsOffset = fs.tell()
        valueType = PolicyValueType.FromFileStream(fs=fs, fsOffset=fsOffset)

        if valueType.Get() is PolicyValueType.POLICY_VALUE_TYPE_STRING:
            value = PolicyString.FromFileStream(fs=fs)
        elif valueType.Get() is PolicyValueType.POLICY_VALUE_TYPE_DWORD:
            value = struct.unpack('<I', fs.read(4))[0]
        elif valueType.Get() is PolicyValueType.POLICY_VALUE_TYPE_QWORD:
            value = struct.unpack('<Q', fs.read(8))[0]
        else:
            value = 'Value Type not supported'
            if STRICT:
                raise Exception(value)
        return cls(valueType=valueType, value=value)
if fsOffset is not specified, stream fs position is at beginning of struct
if fsOffset is not specified, stream fs position is at beginning of struct
if fsOffset is not specified stream fs position is at beginning of struct
def FromFileStream(cls, fs: BinaryIO, fsOffset: int = None):
        if fsOffset:
            fs.seek(fsOffset)
        else:
            fsOffset = fs.tell()
        valueType = PolicyValueType.FromFileStream(fs=fs, fsOffset=fsOffset)
        if valueType.Get() is PolicyValueType.POLICY_VALUE_TYPE_STRING:
            value = PolicyString.FromFileStream(fs=fs)
        elif valueType.Get() is PolicyValueType.POLICY_VALUE_TYPE_DWORD:
            value = struct.unpack('<I', fs.read(4))[0]
        elif valueType.Get() is PolicyValueType.POLICY_VALUE_TYPE_QWORD:
            value = struct.unpack('<Q', fs.read(8))[0]
        else:
            value = 'Value Type not supported'
            if STRICT:
                raise Exception(value)
        return cls(valueType=valueType, value=value)
def FromFileStream ( cls , fs : BinaryIO , fsOffset : int = None ) : if fsOffset : fs . seek ( fsOffset ) else : fsOffset = fs . tell ( ) valueType = PolicyValueType . FromFileStream ( fs = fs , fsOffset = fsOffset ) if valueType . Get ( ) is PolicyValueType . POLICY_VALUE_TYPE_STRING : value = PolicyString . FromFileStream ( fs = fs ) elif valueType . Get ( ) is PolicyValueType . POLICY_VALUE_TYPE_DWORD : value = struct . unpack ( '<I' , fs . read ( 4 ) ) [ 0 ] elif valueType . Get ( ) is PolicyValueType . POLICY_VALUE_TYPE_QWORD : value = struct . unpack ( '<Q' , fs . read ( 8 ) ) [ 0 ] else : value = 'Value Type not supported' if STRICT : raise Exception ( value ) return cls ( valueType = valueType , value = value )
if fsOffset is not specified, stream fs position is at beginning of struct
if fsOffset is not specified stream fs position is at beginning of struct
"""if fsOffset is not specified, stream fs position is at beginning of struct"""
cls
fs
BinaryIO
fsOffset
int