public ushort wPropIdx; // The Property ID of this named property is calculated by adding 0x8000 to wPropIndex public NameID(PropertyLongID propertyLongID, ushort propertySetGuidIndexHint, ushort propertyIndex) { dwPropertyID = (uint)propertyLongID; IdentifierType = false; wGuid = propertySetGuidIndexHint; wPropIdx = propertyIndex; }
/// <returns>short PropertyID used to store the property</returns> public PropertyID AddToMap(PropertyLongID propertyLongID, Guid propertySetGuid) { PSTNode node = m_file.GetNode((uint)InternalNodeName.NID_NAME_TO_ID_MAP); int wGuid = GetPropertySetGuidIndexHint(propertySetGuid); if (wGuid == -1) { wGuid = 3 + AddPropertySetGuid(node, propertySetGuid); } byte[] oldBuffer = node.PC.GetBytesProperty(PropertyID.PidTagNameidStreamEntry); int propertyIndex = oldBuffer.Length / 8; NameID nameID = new NameID(propertyLongID, (ushort)wGuid, (ushort)propertyIndex); byte[] newBuffer = new byte[oldBuffer.Length + 8]; Array.Copy(oldBuffer, newBuffer, oldBuffer.Length); nameID.WriteBytes(newBuffer, oldBuffer.Length); node.PC.SetBytesProperty(PropertyID.PidTagNameidStreamEntry, newBuffer); AddPropertyToHashBucket(node, nameID); node.SaveChanges(); PropertyID propertyID = (PropertyID)(nameID.PropertyShortID); m_map.Add(new PropertyName(propertyLongID, propertySetGuid), (ushort)propertyID); return(propertyID); }
public void FillMap() { m_map = new Dictionary <PropertyName, ushort>(); PSTNode node = m_file.GetNode((uint)InternalNodeName.NID_NAME_TO_ID_MAP); byte[] buffer = node.PC.GetBytesProperty(PropertyID.PidTagNameidStreamEntry); if (buffer.Length % 8 > 0) { throw new InvalidPropertyException("Invalid NameidStreamEntry"); } for (int index = 0; index < buffer.Length; index += 8) { NameID nameID = new NameID(buffer, index); if (!nameID.IsStringIdentifier) { ushort propertyShortID = nameID.PropertyShortID; PropertyLongID propertyLongID = (PropertyLongID)nameID.dwPropertyID; Guid propertySetGuid = GetPropertySetGuid(nameID.wGuid); m_map.Add(new PropertyName(propertyLongID, propertySetGuid), propertyShortID); } } }
public PropertyName(PropertyLongID propertyLongID, Guid propertySetGuid) { PropertyLongID = propertyLongID; PropertySetGuid = propertySetGuid; }