Пример #1
0
        /// <summary>
        /// Copies the given PropertyItem.
        /// </summary>
        /// <param name="pi">The PropertyItem to clone.</param>
        /// <returns>A copy of the given PropertyItem.</returns>
        public static PropertyItem ClonePropertyItem(PropertyItem pi)
        {
            byte[] valueClone;

            if (pi.Value == null)
            {
                valueClone = new byte[0];
            }
            else
            {
                valueClone = (byte[])pi.Value.Clone();
            }

            PropertyItem2 pi2 = new PropertyItem2(pi.Id, pi.Len, pi.Type, valueClone);

            return(pi2.ToPropertyItem());
        }
Пример #2
0
        /// <summary>
        /// Creates a new, zero-filled PropertyItem.
        /// </summary>
        /// <returns>A PropertyItem that is zero-filled.</returns>
        public static PropertyItem CreatePropertyItem()
        {
            PropertyItem2 pi2 = new PropertyItem2(0, 0, 0, new byte[0]);

            return(pi2.ToPropertyItem());
        }
Пример #3
0
        /// <summary>
        /// Deserializes a PropertyItem from a string previously returned from SerializePropertyItem.
        /// </summary>
        /// <param name="piBlob">The string data to deserialize.</param>
        /// <returns>A PropertyItem instance.</returns>
        /// <remarks>
        /// Note to implementors: The format for the serialized data is intentionally opaque for programmatic users
        /// of this class. However, since this data goes into .PDN files, it must be carefully maintained. See
        /// the PropertyItem2 class for details.
        /// </remarks>
        public static PropertyItem DeserializePropertyItem(string piBlob)
        {
            PropertyItem2 pi2 = PropertyItem2.FromBlob(piBlob);

            return(pi2.ToPropertyItem());
        }