Exemple #1
0
        public void Assign(object source)
        {
            EdfSignalInfoBase edfSignalInfoBase = source as EdfSignalInfoBase;

            if (edfSignalInfoBase == null)
            {
                throw new ArgumentException("Value is not an EdfSignalInfoBase object.", "source");
            }
            DoAssign(edfSignalInfoBase);
        }
Exemple #2
0
 protected virtual void DoAssign(EdfSignalInfoBase source)
 {
     if (ReadOnly)
     {
         throw new InvalidOperationException(EdfConstants.FileIsReadOnly);
     }
     StrictChecking    = source.StrictChecking;
     DecimalSeparator  = source.DecimalSeparator;
     ThousandSeparator = source.ThousandSeparator;
     DigiMax           = source.DigiMax;
     DigiMin           = source.DigiMin;
     NrSamples         = source.NrSamples;
     PhysiDim          = source.PhysiDim;
     PhysiMax          = source.PhysiMax;
     PhysiMin          = source.PhysiMin;
     PreFilter         = source.PreFilter;
     Reserved          = source.Reserved;
     SignalLabel       = source.SignalLabel;
     TransducerType    = source.TransducerType;
     for (int i = 0; i < FieldValid.Length; i++)
     {
         FieldValid[i] = source.FieldValid[i];
     }
 }
        protected virtual void ReadSignalInfo()
        {
            Debug.Assert(FileHandle != null, DataFileConsts.DataFileIsNotOpen);
            SignalInfo.Clear();
            int dummy;

            if (FileInfo.FieldValid[(int)EdfFileInfoBase.Field.NrSignals] ||
                int.TryParse(FileInfo.EdfFileInfoRaw.NrSignals.Trim(), out dummy))
            {
                List <EdfSignalInfoRaw> tmpSignalInfo = new List <EdfSignalInfoRaw>();
                for (int i = 0; i < FileInfo.NrSignals; i++)
                {
                    EdfSignalInfoBase newSignalDef = CreateSignalInfo();
                    newSignalDef.StrictChecking = StrictChecking;
                    SignalInfo.Add(newSignalDef);
                    tmpSignalInfo.Add(new EdfSignalInfoRaw());
                }
                if (FileSize >= (FileInfo.NrSignals + 1) * 256)
                {
                    lock (FileAccess)
                    {
                        FileHandle.Seek(256, SeekOrigin.Begin);
                        for (int i = 0; i < FileInfo.NrSignals; i++)
                        {
                            tmpSignalInfo[i].SignalLabel = ReadStringField(16);
                        }
                        for (int i = 0; i < FileInfo.NrSignals; i++)
                        {
                            tmpSignalInfo[i].TransducerType = ReadStringField(80);
                        }
                        for (int i = 0; i < FileInfo.NrSignals; i++)
                        {
                            tmpSignalInfo[i].PhysiDim = ReadStringField(8);
                        }
                        for (int i = 0; i < FileInfo.NrSignals; i++)
                        {
                            tmpSignalInfo[i].PhysiMin = ReadStringField(8);
                        }
                        for (int i = 0; i < FileInfo.NrSignals; i++)
                        {
                            tmpSignalInfo[i].PhysiMax = ReadStringField(8);
                        }
                        for (int i = 0; i < FileInfo.NrSignals; i++)
                        {
                            tmpSignalInfo[i].DigiMin = ReadStringField(8);
                        }
                        for (int i = 0; i < FileInfo.NrSignals; i++)
                        {
                            tmpSignalInfo[i].DigiMax = ReadStringField(8);
                        }
                        for (int i = 0; i < FileInfo.NrSignals; i++)
                        {
                            tmpSignalInfo[i].PreFilter = ReadStringField(80);
                        }
                        for (int i = 0; i < FileInfo.NrSignals; i++)
                        {
                            tmpSignalInfo[i].NrSamples = ReadStringField(8);
                        }
                        for (int i = 0; i < FileInfo.NrSignals; i++)
                        {
                            tmpSignalInfo[i].Reserved = ReadStringField(32);
                        }
                    }
                    for (int i = 0; i < FileInfo.NrSignals; i++)
                    {
                        SignalInfo[i].SignalInfoRecord = tmpSignalInfo[i];
                        SignalInfo[i].DataExists       = FileInfo.DataExists;
                    }
                }
                CalculateDataBlockSize();
            }
        }
 protected virtual void DoAssign(EdfSignalInfoBase source)
 {
     if (ReadOnly)
     throw new InvalidOperationException(EdfConstants.FileIsReadOnly);
       StrictChecking = source.StrictChecking;
       DecimalSeparator = source.DecimalSeparator;
       ThousandSeparator = source.ThousandSeparator;
       DigiMax = source.DigiMax;
       DigiMin = source.DigiMin;
       NrSamples = source.NrSamples;
       PhysiDim = source.PhysiDim;
       PhysiMax = source.PhysiMax;
       PhysiMin = source.PhysiMin;
       PreFilter = source.PreFilter;
       Reserved = source.Reserved;
       SignalLabel = source.SignalLabel;
       TransducerType = source.TransducerType;
       for (int i = 0; i < FieldValid.Length; i++)
     FieldValid[i] = source.FieldValid[i];
 }