예제 #1
0
        /// <summary>
        /// load a stream (maybe from a file) into this snapshot.
        /// </summary>
        /// <param name="r"></param>
        public void load(System.IO.Stream r)
        {
            XmlSerializer s      = new XmlSerializer(typeof(Revision));
            Revision      rev    = null;
            string        branch = null;
            MemoryStream  strm;

            _branches.insert(branch);

            do
            {
                strm = _readBytes(r);
                if (strm != null)
                {
                    rev = s.Deserialize(strm) as Revision;

                    if (rev != null)
                    {
                        _addRevision(rev);
                    }
                }
            }       while(strm != null);

            r.Close();
        }
예제 #2
0
        /// <summary>
        /// save the current status of this snapshot out to a stream (file?)
        /// </summary>
        /// <param name="w"></param>
        public void save(System.IO.Stream w)
        {
            /* create the snapshot */
            XmlSerializer s = new XmlSerializer(typeof(Revision));

            RevisionIdx.iterator it = this._changesetIdx.begin();
            for (; it != this._changesetIdx.end(); ++it)
            {
                s.Serialize(w, it.value());
                w.Write(MAGIC_BYTES, 0, MAGIC_BYTES.Length);
            }

            w.Flush();
            w.Close();
        }