示例#1
0
        public void WriteSegment(long offset, Reader.Segment leadin)
        {
            _writer.BaseStream.Seek(offset, SeekOrigin.Begin);
            _writer.Write(Encoding.ASCII.GetBytes(leadin.Identifier), 0, 4);
            Int32 tableOfContentsMask = 0;

            if (leadin.TableOfContents.ContainsNewObjects)
            {
                tableOfContentsMask |= 1 << 2;
            }
            if (leadin.TableOfContents.HasDaqMxData)
            {
                tableOfContentsMask |= 1 << 7;
            }
            if (leadin.TableOfContents.HasMetaData)
            {
                tableOfContentsMask |= 1 << 1;
            }
            if (leadin.TableOfContents.HasRawData)
            {
                tableOfContentsMask |= 1 << 3;
            }
            if (leadin.TableOfContents.NumbersAreBigEndian)
            {
                tableOfContentsMask |= 1 << 6;
            }
            if (leadin.TableOfContents.RawDataIsInterleaved)
            {
                tableOfContentsMask |= 1 << 5;
            }
            _writer.Write(tableOfContentsMask);
            _writer.Write(leadin.Version);
            _writer.Write((Int64)leadin.NextSegmentOffset);
            _writer.Write((Int64)leadin.RawDataOffset);
        }
示例#2
0
        public WriteSegment(Stream stream)
        {
            _writer = new Writer(stream);

            //default header
            Header                             = new Reader.Segment();
            Header.Identifier                  = "TDSm";
            Header.Version                     = 4713;
            Header.TableOfContents             = new Reader.TableOfContents();
            Header.TableOfContents.HasMetaData = true; //it would be rather odd with a TDMS file with no meta data. (Then there would be no raw data either)
            Header.NextSegmentOffset           = -1;   //no more segments
            Header.RawDataOffset               = 0;    //for now

            MetaData = new List <Reader.Metadata>();
        }