Deserialize() public method

Converts a set of bytes to a new instance.
public Deserialize ( byte content ) : Value
content byte The binary representation.
return Value
        /// <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 sp = new SurfacePlotValue();

            using (var ds = Deserializer.Create(content))
            {
                sp.Deserialize(ds);
                sp.IsMesh       = ds.GetBoolean();
                sp.ColorPalette = (ColorPalettes)ds.GetInt();
                sp.data.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();

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

            return(sp);
        }
Ejemplo 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 sp = new SurfacePlotValue();

            using (var ds = Deserializer.Create(content))
            {
                sp.Deserialize(ds);
                sp.IsMesh = ds.GetBoolean();
                sp.ColorPalette = (ColorPalettes)ds.GetInt();
                sp.data.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();

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

            return sp;
        }