Beispiel #1
0
        // Churn through the byte stream just to extract the XML
        internal static string ReadNextSurrogateXml(GZipStream stream, UnicodeEncoding encoder)
        {
            var temp = new byte[16];

            if (stream.Read(temp, 0, 16) <= 0)
            {
                return(null);
            }
            var    guid      = new Guid(temp);
            string className = encoder.GetString(stream.ReadBytes(stream.ReadInt()));

            byte[] xmldata = stream.ReadBytes(stream.ReadInt());
            long   id      = stream.ReadLong();

            return(UnicodeEncoding.UTF8.GetString(xmldata));
        }
        /// <summary>
        /// returns null if there are no more CmObejtcSurroages on the stream.
        /// </summary>
        internal CmObjectSurrogate GetNextCmObjectSurrogate(GZipStream stream)
        {
            var temp = new byte[16];

            if (stream.Read(temp, 0, 16) <= 0)
            {
                return(null);
            }
            var    cmObjectId = CmObjectId.FromGuid(new Guid(temp), m_identityMap);
            string className  = m_unicodeEncoding.GetString(stream.ReadBytes(stream.ReadInt()));

            byte[] xmldata = stream.ReadBytes(stream.ReadInt());

            long id = stream.ReadLong();

            var ret = new CmObjectSurrogate(m_cache, cmObjectId, className, xmldata);

            m_mapId.Add(ret.Id, id);

            return(ret);
        }