Example #1
0
        /// <Summary>
        /// Encodes the ExtendedProperties in the ISF stream.
        /// </Summary>
#else
        /// <Summary>
        /// Encodes the ExtendedProperties in the ISF stream.
        /// </Summary>
#endif
        private static void PersistExtendedProperties(DrawingAttributes da, Stream stream, GuidList guidList, ref uint cbData, ref BinaryWriter bw, byte compressionAlgorithm, bool fTag)
        {
            // Now save the extended properties
            ExtendedPropertyCollection epcClone = da.CopyPropertyData();

            //walk from the back removing EPs that are uses for DrawingAttributes
            for (int x = epcClone.Count - 1; x >= 0; x--)
            {
                //
                // look for StylusTipTransform while we're at it and turn it into a string
                // for serialization
                //
                if (epcClone[x].Id == KnownIds.StylusTipTransform)
                {
                    Matrix matrix       = (Matrix)epcClone[x].Value;
                    string matrixString = matrix.ToString(System.Globalization.CultureInfo.InvariantCulture);
                    epcClone[x].Value = matrixString;
                    continue;
                }

                if (DrawingAttributes.RemoveIdFromExtendedProperties(epcClone[x].Id))
                {
                    epcClone.Remove(epcClone[x].Id);
                }
            }

            cbData += ExtendedPropertySerializer.EncodeAsISF(epcClone, stream, guidList, compressionAlgorithm, fTag);
        }