Пример #1
0
        /// <summary>
        /// Reads the data.
        /// </summary>
        /// <param name="graph">The graph.</param>
        /// <param name="additionalInfo">The additional information.</param>
        internal void ReadData(IFastBinarySerializable graph, object additionalInfo)
        {
            var lastActiveObject = CurrentActiveObjectStates;

            CurrentActiveObjectStates = new ActiveObjectStates();

            Read(FLengthBuffer, 0, FLengthBuffer.Length);
            CurrentActiveObjectStates.GraphSize       = BitConverter.ToInt32(FLengthBuffer, 0);
            CurrentActiveObjectStates.StartOfGraphPos = (int)BaseStream.Position;

            graph.ReadData(this, additionalInfo);

            var remainingSize = GetActiveObjectRemainingSize();

            if (remainingSize > 0)
            {
                BaseStream.Seek(remainingSize, SeekOrigin.Current);
            }

            CurrentActiveObjectStates = lastActiveObject;
        }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FastBinaryReader"/> class.
 /// </summary>
 /// <param name="input">The input.</param>
 public FastBinaryReader(Stream input) : base(input)
 {
     Tag = null;
     CurrentActiveObjectStates = new ActiveObjectStates();
     FLengthBuffer             = new byte[Marshal.SizeOf(typeof(int))];
 }