Deserialize() public method

Converts a set of bytes to a new instance.
public Deserialize ( byte content ) : Value
content byte The binary representation.
return Value
Beispiel #1
0
        /// <summary>
        /// Converts a set of bytes to a new instance.
        /// </summary>
        /// <param name="content">The binary representation.</param>
        /// <returns>The new instance.</returns>
        public override Value Deserialize(byte[] content)
        {
            var p2 = new Plot2DValue();

            using (var ds = Deserializer.Create(content))
            {
                p2.Deserialize(ds);
                p2.IsLogX = ds.GetBoolean();
                p2.IsLogY = ds.GetBoolean();
                var length = ds.GetInt();

                for (var i = 0; i < length; i++)
                {
                    var points = new Points <PointPair>();
                    points.Deserialize(ds);
                    var count = ds.GetInt();

                    for (int j = 0; j < count; j++)
                    {
                        var x = ds.GetDouble();
                        var y = ds.GetDouble();

                        points.Add(new PointPair
                        {
                            X = x,
                            Y = y
                        });
                    }

                    p2.AddSeries(points);
                }
            }

            return(p2);
        }
Beispiel #2
0
        /// <summary>
        /// Converts a set of bytes to a new instance.
        /// </summary>
        /// <param name="content">The binary representation.</param>
        /// <returns>The new instance.</returns>
        public override Value Deserialize(byte[] content)
        {
            var p2 = new Plot2DValue();

            using (var ds = Deserializer.Create(content))
            {
                p2.Deserialize(ds);
                p2.IsLogX = ds.GetBoolean();
                p2.IsLogY = ds.GetBoolean();
                var length = ds.GetInt();

                for (var i = 0; i < length; i++)
                {
                    var points = new Points<PointPair>();
                    points.Deserialize(ds);
                    var count = ds.GetInt();

                    for (int j = 0; j < count; j++)
                    {
                        var x = ds.GetDouble();
                        var y = ds.GetDouble();

                        points.Add(new PointPair
                        {
                            X = x,
                            Y = y
                        });
                    }

                    p2.AddSeries(points);
                }
            }

            return p2;
        }