Пример #1
0
 public InputDataProperties(RecordDescription rd)
 {
     InitializeComponent();
     textBoxRecordID.Text          = rd.signalID;
     textBoxSamplingFrequency.Text = Convert.ToString(rd.samplingFrequency);
     textBoxNumberSamples.Text     = Convert.ToString(rd.numberOfSamples);
     textBoxNumberChannels.Text    = Convert.ToString(rd.numberOfChannels);
     for (int i = 1; i <= rd.channels.Count; i++)
     {
         comboBoxChannel.Items.Add(i.ToString());
     }
     comboBoxChannel.SelectedIndex = 0;
 }
Пример #2
0
        public bool prepareBinaryInfo(String filename)
        {
            String headerFile = filename.Remove(filename.Length - 3) + "hea";

            try
            {
                using (TextReader header = File.OpenText(headerFile))
                {
                    string   tempLine = header.ReadLine();
                    string[] tempInfo = tempLine.Split(' ');

                    recDescription                   = new RecordDescription();
                    recDescription.channels          = new List <List <int> >();
                    recDescription.signalID          = tempInfo[0];
                    recDescription.numberOfChannels  = Convert.ToInt16(tempInfo[1]);
                    recDescription.samplingFrequency = Convert.ToDecimal(tempInfo[2]);
                    recDescription.numberOfSamples   = Convert.ToInt64(tempInfo[3]);
                    while (!tempLine.Contains("#"))
                    {
                        tempLine = header.ReadLine();
                        if (tempLine.Contains("#"))
                        {
                            break;
                        }
                        tempInfo = tempLine.Split(' ');
                        recDescription.channels.Add(new List <int>());
                        for (int i = 1; i < tempInfo.Length - 1; i++)
                        {
                            recDescription.channels[recDescription.channels.Count - 1].Add(Convert.ToInt32(tempInfo[i]));
                        }
                        ;
                    }
                }
            }catch (Exception e1) {
                MessageBox.Show("Error reding record's header file!");
                return(false);
            }
            return(true);
        }