protected void ReadHeaderInfo()
        {
            Debug.Assert(FileHandle != null, DataFileConsts.DataFileIsNotOpen);
            FileInfo = null;
            // ReSharper disable PossibleNullReferenceException
            FileInfo.StrictChecking = StrictChecking;
            // ReSharper restore PossibleNullReferenceException
            EdfFileInfoRaw tmpFileInfo = new EdfFileInfoRaw();

            if (FileSize < 255)
            {
                tmpFileInfo.Version           = string.Empty;
                tmpFileInfo.Patient           = string.Empty;
                tmpFileInfo.Recording         = string.Empty;
                tmpFileInfo.StartDate         = string.Empty;
                tmpFileInfo.StartTime         = string.Empty;
                tmpFileInfo.HeaderBytes       = string.Empty;
                tmpFileInfo.Reserved          = string.Empty;
                tmpFileInfo.NrDataRecords     = string.Empty;
                tmpFileInfo.SampleRecDuration = string.Empty;
                tmpFileInfo.NrSignals         = string.Empty;
            }
            else
            {
                lock (FileAccess)
                {
                    FileHandle.Seek(0, SeekOrigin.Begin);
                    tmpFileInfo.Version           = ReadStringField(8);
                    tmpFileInfo.Patient           = ReadStringField(80);
                    tmpFileInfo.Recording         = ReadStringField(80);
                    tmpFileInfo.StartDate         = ReadStringField(8);
                    tmpFileInfo.StartTime         = ReadStringField(8);
                    tmpFileInfo.HeaderBytes       = ReadStringField(8);
                    tmpFileInfo.Reserved          = ReadStringField(44);
                    tmpFileInfo.NrDataRecords     = ReadStringField(8);
                    tmpFileInfo.SampleRecDuration = ReadStringField(8);
                    tmpFileInfo.NrSignals         = ReadStringField(4);
                }
            }
            FileInfo.FileInfoRecord = tmpFileInfo;
            if (FileInfo.FieldValid[(int)EdfFileInfoBase.Field.NrSignals])
            {
                FileInfo.DataExists = (FileSize > (FileInfo.NrSignals + 1) * 256);
            }
            else
            {
                FileInfo.DataExists = false;
            }
        }
        /// <summary>
        /// Copies the information from sourceInfo
        /// </summary>
        /// <param name="sourceInfo">The source info.</param>
        /// <param name="allFields">if set to <c>true</c> all fields are copied; otherwise the fields NrSignal, HeaderBytes and NrDataRecords are ignored.</param>
        public void CopyFrom(EdfFileInfoRaw sourceInfo, bool allFields = false)
        {
            EdfFileInfoRaw tmpInfo = sourceInfo.Clone() as EdfFileInfoRaw;

            if (tmpInfo == null)
            {
                throw new EdfException("Unable to clone file info.");
            }
            if (!allFields)
            {
                tmpInfo.NrSignals     = NrSignals.ToString();
                tmpInfo.HeaderBytes   = HeaderBytes.ToString();
                tmpInfo.NrDataRecords = NrDataRecords.ToString();
            }
            FileInfoRecord = tmpInfo;
            Modified       = true;
        }
 /// <summary>
 /// Copies the information from sourceInfo
 /// </summary>
 /// <param name="sourceInfo">The source info.</param>
 /// <param name="allFields">if set to <c>true</c> all fields are copied; otherwise the fields NrSignal, HeaderBytes and NrDataRecords are ignored.</param>
 public void CopyFrom(EdfFileInfoRaw sourceInfo, bool allFields = false)
 {
     EdfFileInfoRaw tmpInfo = sourceInfo.Clone() as EdfFileInfoRaw;
       if (tmpInfo == null)
     throw new EdfException("Unable to clone file info.");
       if (!allFields)
       {
     tmpInfo.NrSignals = NrSignals.ToString();
     tmpInfo.HeaderBytes = HeaderBytes.ToString();
     tmpInfo.NrDataRecords = NrDataRecords.ToString();
       }
       FileInfoRecord = tmpInfo;
       Modified = true;
 }
 protected void ReadHeaderInfo()
 {
     Debug.Assert(FileHandle != null, DataFileConsts.DataFileIsNotOpen);
       FileInfo = null;
       // ReSharper disable PossibleNullReferenceException
       FileInfo.StrictChecking = StrictChecking;
       // ReSharper restore PossibleNullReferenceException
       EdfFileInfoRaw tmpFileInfo = new EdfFileInfoRaw();
       if (FileSize < 255)
       {
     tmpFileInfo.Version = string.Empty;
     tmpFileInfo.Patient = string.Empty;
     tmpFileInfo.Recording = string.Empty;
     tmpFileInfo.StartDate = string.Empty;
     tmpFileInfo.StartTime = string.Empty;
     tmpFileInfo.HeaderBytes = string.Empty;
     tmpFileInfo.Reserved = string.Empty;
     tmpFileInfo.NrDataRecords = string.Empty;
     tmpFileInfo.SampleRecDuration = string.Empty;
     tmpFileInfo.NrSignals = string.Empty;
       }
       else
       {
     lock (FileAccess)
     {
       FileHandle.Seek(0, SeekOrigin.Begin);
       tmpFileInfo.Version = ReadStringField(8);
       tmpFileInfo.Patient = ReadStringField(80);
       tmpFileInfo.Recording = ReadStringField(80);
       tmpFileInfo.StartDate = ReadStringField(8);
       tmpFileInfo.StartTime = ReadStringField(8);
       tmpFileInfo.HeaderBytes = ReadStringField(8);
       tmpFileInfo.Reserved = ReadStringField(44);
       tmpFileInfo.NrDataRecords = ReadStringField(8);
       tmpFileInfo.SampleRecDuration = ReadStringField(8);
       tmpFileInfo.NrSignals = ReadStringField(4);
     }
       }
       FileInfo.FileInfoRecord = tmpFileInfo;
       if (FileInfo.FieldValid[(int)EdfFileInfoBase.Field.NrSignals])
     FileInfo.DataExists = (FileSize > (FileInfo.NrSignals + 1) * 256);
       else
     FileInfo.DataExists = false;
 }