예제 #1
0
 public void SaveChanges()
 {
     if (m_node != null)
     {
         m_node.SaveChanges();
     }
 }
        /// <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);
        }