Пример #1
0
        /// <summary>
        /// Creates a new instance from a given binary content.
        /// </summary>
        /// <param name="content">The binary content.</param>
        /// <returns>The new instance.</returns>
        public override Value Deserialize(byte[] content)
        {
            var sp = new SubPlotValue();

            using (var ds = Deserializer.Create(content))
            {
                sp.Title   = ds.GetString();
                sp.Rows    = ds.GetInt();
                sp.Columns = ds.GetInt();
                var length = ds.GetInt();

                for (var i = 0; i < length; i++)
                {
                    var subplot = new SubPlot();
                    subplot.Row        = ds.GetInt();
                    subplot.RowSpan    = ds.GetInt();
                    subplot.Column     = ds.GetInt();
                    subplot.ColumnSpan = ds.GetInt();
                    var name = ds.GetString();
                    subplot.Plot = (PlotValue)Value.Deserialize(name, ds.GetBytes());
                    sp.subplots.Add(subplot);
                }
            }

            return(sp);
        }
Пример #2
0
        /// <summary>
        /// Creates a new instance from a given binary content.
        /// </summary>
        /// <param name="content">The binary content.</param>
        /// <returns>The new instance.</returns>
        public override Value Deserialize(byte[] content)
        {
            var sp = new SubPlotValue();

            using (var ds = Deserializer.Create(content))
            {
                sp.Title = ds.GetString();
                sp.Rows = ds.GetInt();
                sp.Columns = ds.GetInt();
                var length = ds.GetInt();

                for (var i = 0; i < length; i++)
                {
                    var subplot = new SubPlot();
                    subplot.Row = ds.GetInt();
                    subplot.RowSpan = ds.GetInt();
                    subplot.Column = ds.GetInt();
                    subplot.ColumnSpan = ds.GetInt();
                    var name = ds.GetString();
                    subplot.Plot = (PlotValue)Value.Deserialize(name, ds.GetBytes());
                    sp.subplots.Add(subplot);
                }
            }

            return sp;
        }