Example #1
0
        public void ToWriter(DataFrames.DataWriter writer, DataFrames.DataKey root, Utils.Logger logger)
        {
            MemoryStream stm = new MemoryStream();
            DataWriter   w   = new DataWriter(stm);

            foreach (DataNode node in root.SubNodes)
            {
                node.ToWriter(w);
            }

            byte[] data = stm.ToArray();

            logger.LogVerbose("Writing length field of {0} bytes", data.Length);

            if ((data.Length % Config.Stride) != 0)
            {
                logger.LogWarning("Data length of {0} is not a multiple of stride {1}", data.Length, Config.Stride);
            }

            WriteLength(writer, (ulong)(data.Length - Config.Adjustment) / Config.Stride, logger);
            writer.Write(stm.ToArray());
        }