/// <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); }
public SubPlotValue Function(ScalarValue rows, ScalarValue columns) { var r = rows.GetIntegerOrThrowException("rows", Name); var c = columns.GetIntegerOrThrowException("columns", Name); var subplot = new SubPlotValue(); subplot.Rows = r; subplot.Columns = c; return(subplot); }
/// <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; }