private bool HasPadding() { VTPropertyType vt = (VTPropertyType)((ushort)this.VTType & 0x00FF); switch (vt) { case VTPropertyType.VT_LPSTR: if (this.IsVariant) { return(false); } if (dim == PropertyDimensions.IsVector) { return(false); } break; case VTPropertyType.VT_VARIANT_VECTOR: if (dim == PropertyDimensions.IsVector) { return(false); } break; default: return(true); } return(true); }
public override object ReadScalarValue(System.IO.BinaryReader br) { VTPropertyType vType = (VTPropertyType)br.ReadUInt16(); br.ReadUInt16(); // Ushort Padding ITypedPropertyValue p = PropertyFactory.Instance.NewProperty(vType, codePage, true); p.Read(br); return(p); }
public OLEProperty NewProperty(VTPropertyType vtPropertyType, uint propertyIdentifier, string propertyName = null) { //throw new NotImplementedException("API Unstable - Work in progress - Milestone 2.3.0.0"); var op = new OLEProperty(this) { VTType = vtPropertyType, PropertyIdentifier = propertyIdentifier }; return(op); }
private PropertyDimensions CheckPropertyDimensions(VTPropertyType vtType) { if ((((ushort)vtType) & 0x1000) != 0) { return(PropertyDimensions.IsVector); } else if ((((ushort)vtType) & 0x2000) != 0) { return(PropertyDimensions.IsArray); } else { return(PropertyDimensions.IsScalar); } }
public ITypedPropertyValue NewProperty(VTPropertyType vType, PropertyContext ctx) { ITypedPropertyValue pr = null; switch (vType) { case VTPropertyType.VT_I2: pr = new VT_I2_Property(vType); break; case VTPropertyType.VT_I4: pr = new VT_I4_Property(vType); break; case VTPropertyType.VT_R4: pr = new VT_R4_Property(vType); break; case VTPropertyType.VT_LPSTR: pr = new VT_LPSTR_Property(vType, ctx.CodePage); break; case VTPropertyType.VT_FILETIME: pr = new VT_FILETIME_Property(vType); break; case VTPropertyType.VT_DECIMAL: pr = new VT_DECIMAL_Property(vType); break; case VTPropertyType.VT_BOOL: pr = new VT_BOOL_Property(vType); break; case VTPropertyType.VT_VECTOR_HEADER: pr = new VT_VectorHeader(vType); break; case VTPropertyType.VT_EMPTY: pr = new VT_EMPTY_Property(vType); break; default: throw new Exception("Unrecognized property type"); } return(pr); }
public void LoadContext(int propertySetOffset, BinaryReader br) { var currPos = br.BaseStream.Position; PropertyContext = new PropertyContext(); var codePageOffset = (int)(propertySetOffset + PropertyIdentifierAndOffsets.Where(pio => pio.PropertyIdentifier == 1).First().Offset); br.BaseStream.Seek(codePageOffset, SeekOrigin.Begin); VTPropertyType vType = (VTPropertyType)br.ReadUInt16(); br.ReadUInt16(); // Ushort Padding PropertyContext.CodePage = (int)(ushort)br.ReadInt16(); br.BaseStream.Position = currPos; }
private IProperty ReadProperty(uint propertyIdentifier, int codePage, BinaryReader br) { if (propertyIdentifier != 0) { VTPropertyType vType = (VTPropertyType)br.ReadUInt16(); br.ReadUInt16(); // Ushort Padding ITypedPropertyValue pr = PropertyFactory.Instance.NewProperty(vType, codePage); pr.Read(br); return(pr); } else { IDictionaryProperty dictionaryProperty = new DictionaryProperty(codePage); dictionaryProperty.Read(br); return(dictionaryProperty); } }
public VT_VariantVector(VTPropertyType vType, int codePage, bool isVariant) : base(vType, isVariant) { this.codePage = codePage; }
public VT_BLOB_Property(VTPropertyType vType, bool isVariant) : base(vType, isVariant) { }
public VT_DECIMAL_Property(VTPropertyType vType, bool isVariant) : base(vType, isVariant) { }
public VT_FILETIME_Property(VTPropertyType vType, bool isVariant) : base(vType, isVariant) { }
public VT_BOOL_Property(VTPropertyType vType) : base(vType) { }
public List <ITypedPropertyValue> ReadProperty(PropertyIdentifiersSummaryInfo propertyIdentifier, BinaryReader br) { List <ITypedPropertyValue> res = new List <ITypedPropertyValue>(); bool isVariant = false; PropertyDimensions dim = PropertyDimensions.IsScalar; UInt16 pVal = br.ReadUInt16(); VTPropertyType vType = (VTPropertyType)(pVal & 0x00FF); if ((pVal & 0x1000) != 0) { dim = PropertyDimensions.IsVector; } else if ((pVal & 0x2000) != 0) { dim = PropertyDimensions.IsArray; } isVariant = ((pVal & 0x00FF) == 0x000C); br.ReadUInt16(); // Ushort Padding switch (dim) { case PropertyDimensions.IsVector: ITypedPropertyValue vectorHeader = factory.NewProperty(VTPropertyType.VT_VECTOR_HEADER, ctx); vectorHeader.Read(br); uint nItems = (uint)vectorHeader.PropertyValue; for (int i = 0; i < nItems; i++) { VTPropertyType vTypeItem = VTPropertyType.VT_EMPTY; if (isVariant) { UInt16 pValItem = br.ReadUInt16(); vTypeItem = (VTPropertyType)(pValItem & 0x00FF); br.ReadUInt16(); // Ushort Padding } else { vTypeItem = vType; } var p = factory.NewProperty(vTypeItem, ctx); p.Read(br); res.Add(p); } break; default: //Scalar property ITypedPropertyValue pr = factory.NewProperty(vType, ctx); pr.Read(br); if (propertyIdentifier == PropertyIdentifiersSummaryInfo.CodePageString) { this.ctx.CodePage = (short)pr.PropertyValue; } res.Add(pr); break; } return(res); }
public TypedPropertyValue(VTPropertyType vtType) { this._VTType = vtType; }
public TypedPropertyValue(VTPropertyType vtType, bool isVariant = false) { this._VTType = vtType; dim = CheckPropertyDimensions(vtType); this.isVariant = isVariant; }
public VT_FILETIME_Property(VTPropertyType vType) : base(vType) { }
public VT_I2_Property(VTPropertyType vType) : base(vType) { }
public VT_EMPTY_Property(VTPropertyType vType) : base(vType) { }
public VT_VectorHeader(VTPropertyType vType) : base(vType) { }
public TypedPropertyValue(VTPropertyType vtType, bool isVariant = false) { VTType = vtType; PropertyDimensions = CheckPropertyDimensions(vtType); IsVariant = isVariant; }
public VT_LPSTR_Property(VTPropertyType vType, int codePage) : base(vType) { this.codePage = codePage; }
public VT_LPWSTR_Property(VTPropertyType vType, int codePage, bool isVariant) : base(vType, isVariant) { this.codePage = codePage; }
public VT_DECIMAL_Property(VTPropertyType vType) : base(vType) { }
public ITypedPropertyValue NewProperty(VTPropertyType vType, int codePage, bool isVariant = false) { ITypedPropertyValue pr = null; switch ((VTPropertyType)((ushort)vType & 0x00FF)) { case VTPropertyType.VT_I1: pr = new VT_I1_Property(vType, isVariant); break; case VTPropertyType.VT_I2: pr = new VT_I2_Property(vType, isVariant); break; case VTPropertyType.VT_I4: pr = new VT_I4_Property(vType, isVariant); break; case VTPropertyType.VT_R4: pr = new VT_R4_Property(vType, isVariant); break; case VTPropertyType.VT_R8: pr = new VT_R8_Property(vType, isVariant); break; case VTPropertyType.VT_CY: pr = new VT_CY_Property(vType, isVariant); break; case VTPropertyType.VT_DATE: pr = new VT_DATE_Property(vType, isVariant); break; case VTPropertyType.VT_INT: pr = new VT_INT_Property(vType, isVariant); break; case VTPropertyType.VT_UINT: pr = new VT_UINT_Property(vType, isVariant); break; case VTPropertyType.VT_UI1: pr = new VT_UI1_Property(vType, isVariant); break; case VTPropertyType.VT_UI2: pr = new VT_UI2_Property(vType, isVariant); break; case VTPropertyType.VT_UI4: pr = new VT_UI4_Property(vType, isVariant); break; case VTPropertyType.VT_UI8: pr = new VT_UI8_Property(vType, isVariant); break; case VTPropertyType.VT_BSTR: case VTPropertyType.VT_LPSTR: pr = new VT_LPSTR_Property(vType, codePage, isVariant); break; case VTPropertyType.VT_LPWSTR: pr = new VT_LPWSTR_Property(vType, codePage, isVariant); break; case VTPropertyType.VT_FILETIME: pr = new VT_FILETIME_Property(vType, isVariant); break; case VTPropertyType.VT_DECIMAL: pr = new VT_DECIMAL_Property(vType, isVariant); break; case VTPropertyType.VT_BOOL: pr = new VT_BOOL_Property(vType, isVariant); break; case VTPropertyType.VT_EMPTY: pr = new VT_EMPTY_Property(vType, isVariant); break; case VTPropertyType.VT_VARIANT_VECTOR: pr = new VT_VariantVector(vType, codePage, isVariant); break; case VTPropertyType.VT_CF: pr = new VT_CF_Property(vType, isVariant); break; case VTPropertyType.VT_BLOB_OBJECT: case VTPropertyType.VT_BLOB: pr = new VT_BLOB_Property(vType, isVariant); break; default: throw new Exception("Unrecognized property type"); } return(pr); }
public VT_DATE_Property(VTPropertyType vType) : base(vType) { }