Esempio n. 1
0
        private void Initialize()
        {
            ntsFormats = new List <DataFormat>();
            tsFormats  = new List <DataFormat>();

            int readCursor = 0;

            byte[] bytes = dataChunk.ChunkBytes;
            while (readCursor < bytes.Length)
            {
                string ioType = ChunkReader.BytesToString(bytes, readCursor, DataFormat.IOTypeCodeSize);
                readCursor += DataFormat.IOTypeCodeSize;
                string dimension = ChunkReader.BytesToString(bytes, readCursor, DataFormat.DimensionCodeSize);
                readCursor += DataFormat.DimensionCodeSize;
                string name     = ChunkReader.NullTerminatedBytesToString(bytes, readCursor, ref readCursor);
                string elemType = ChunkReader.BytesToString(bytes, readCursor, DataFormat.ElementTypeCodeSize);
                readCursor += DataFormat.ElementTypeCodeSize;

                long[] length = new long[4];
                for (int iLength = 0; iLength < 4; ++iLength)
                {
                    length[iLength] = ChunkReader.BigEndianBytesToInt64(bytes, readCursor);
                    readCursor     += DataFormat.LengthSize;
                }

                DataFormat fmt = CreateDataFormat(ioType, dimension, name, elemType, length);
                if (fmt.IsTimeSeries)
                {
                    fmt.FormatIndex = tsFormats.Count;
                    tsFormats.Add(fmt);
                }
                else
                {
                    fmt.FormatIndex = ntsFormats.Count;
                    ntsFormats.Add(fmt);
                }
            }
        }
Esempio n. 2
0
 static public void Parse(Chunk chunk, out string v)
 {
     v = ChunkReader.BytesToString(chunk.ChunkBytes);
 }