Deserialize() public method

Converts a set of bytes to a new instance.
public Deserialize ( byte content ) : Value
content byte The binary representation.
return Value
Exemplo n.º 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 p3 = new Plot3DValue();

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

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

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

                        points.Add(new PointTriple
                        {
                            X = x,
                            Y = y,
                            Z = z
                        });
                    }

                    p3.AddSeries(points);
                }
            }

            return(p3);
        }
Exemplo n.º 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 p3 = new Plot3DValue();

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

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

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

                        points.Add(new PointTriple
                        {
                            X = x,
                            Y = y,
                            Z = z
                        });
                    }

                    p3.AddSeries(points);
                }
            }

            return p3;
        }