示例#1
0
        public BDFHeader readHeader()
        {
            BDFFile   file   = new BDFFile(fileName);
            BDFHeader header = null;

            try
            {
                header = file.Header;
            }
            catch (BDFHeaderReadException e)
            {
                Exception ex = e as Exception;
                Console.WriteLine();
                while (ex != null)
                {
                    Console.WriteLine(ex.Message);
                    ex = ex.InnerException;
                }
                Console.WriteLine();
                return(null);
            }
            return(BDFHeader.Copy(header));
        }
        private void patchHeader(BDFHeader header)
        {
            this.header = BDFHeader.Copy(header);
            this.header.StartDateTime = beginTime;
            this.header.RecordCount   = -1;
            samplesPerDataRecord      = 0;
            for (int i = 0; i < header.ChannelCount; i++)
            {
                samplesPerDataRecord += header.ChannelHeaders[i].SamplesPerDataRecord;
            }

            patchBytes(new byte[1] {
                255
            });
            patchStr("BIOSEMI", 7);
            patchStr(this.header.LocalSubject, 80);
            patchStr(this.header.LocalRecording, 80);
            patchDateTime(this.header.StartDateTime);
            patchStrInt(this.header.HeaderByteCount, 8);
            patchStr(this.header.DataFormat, 44);
            patchStrInt(this.header.RecordCount, 8);
            patchStrInt(this.header.SecondsPerDataRecord, 8);
            patchStrInt(this.header.ChannelCount, 4);
            int channelCount = this.header.ChannelCount;

            for (int i = 0; i < channelCount; i++)
            {
                patchStr(this.header.ChannelHeaders[i].Label, 16);
            }

            for (int i = 0; i < channelCount; i++)
            {
                patchStr(this.header.ChannelHeaders[i].TransuderType, 80);
            }

            for (int i = 0; i < channelCount; i++)
            {
                patchStr(this.header.ChannelHeaders[i].Dimension, 8);
            }

            for (int i = 0; i < channelCount; i++)
            {
                patchStrInt(this.header.ChannelHeaders[i].MinValue, 8);
            }

            for (int i = 0; i < channelCount; i++)
            {
                patchStrInt(this.header.ChannelHeaders[i].MaxValue, 8);
            }

            for (int i = 0; i < channelCount; i++)
            {
                patchStrInt(this.header.ChannelHeaders[i].DigitalMin, 8);
            }

            for (int i = 0; i < channelCount; i++)
            {
                patchStrInt(this.header.ChannelHeaders[i].DigitalMax, 8);
            }

            for (int i = 0; i < channelCount; i++)
            {
                patchStr(this.header.ChannelHeaders[i].Prefiltered, 80);
            }

            for (int i = 0; i < channelCount; i++)
            {
                patchStrInt(this.header.ChannelHeaders[i].SamplesPerDataRecord, 8);
            }

            for (int i = 0; i < channelCount; i++)
            {
                patchStr("reserved", 32);
            }
        }