Example #1
0
 public override void LoadDataFile(string strFileToLoad)
 {
     StreamReader reader = null;
     string[] strArray;
     FrameData data = new FrameData();
     bool flag = true;
     this.Cursor = Cursors.WaitCursor;
     if (base.OnMessageToLog != null)
     {
         base.OnMessageToLog("Loading data file [" + strFileToLoad + "]");
     }
     try
     {
         reader = new StreamReader(strFileToLoad);
     }
     catch (Exception exception)
     {
         if (base.OnMessageToLog != null)
         {
             base.OnMessageToLog("Error opening the selected file :" + exception.Message);
         }
         MessageBox.Show("Error opening the selected file :" + exception.Message);
         flag = false;
     }
     if (flag)
     {
         try
         {
             bool flag2 = false;
             strArray = reader.ReadLine().Split(new char[] { '\t' }, 13);
             if (((strArray.Length == 13) && (strArray[0] == "Timestamp")) && (strArray[11] == "Pressure"))
             {
                 flag2 = true;
             }
             if (!flag2)
             {
                 if (base.OnMessageToLog != null)
                 {
                     base.OnMessageToLog("Unkwnon file format [" + strFileToLoad + "]");
                 }
                 flag = false;
             }
         }
         catch
         {
             if (base.OnMessageToLog != null)
             {
                 base.OnMessageToLog("Unkwnon header file format [" + strFileToLoad + "] ");
             }
             flag = false;
         }
     }
     if (flag)
     {
         try
         {
             string str;
             while ((str = reader.ReadLine()) != null)
             {
                 strArray = str.Split(new char[] { '\t' }, 13);
                 if (strArray.Length == 13)
                 {
                     data.TimeStamp = Convert.ToUInt32(strArray[0]);
                     data.Accelometer.X = Convert.ToInt16(strArray[1]);
                     data.Accelometer.Y = Convert.ToInt16(strArray[2]);
                     data.Accelometer.Z = Convert.ToInt16(strArray[3]);
                     data.Gyroscope.X = Convert.ToInt16(strArray[4]);
                     data.Gyroscope.Y1 = Convert.ToInt16(strArray[5]);
                     data.Gyroscope.Y2 = Convert.ToInt16(strArray[6]);
                     data.Gyroscope.Z = Convert.ToInt16(strArray[7]);
                     data.Magnetic.X = Convert.ToInt16(strArray[8]);
                     data.Magnetic.Y = Convert.ToInt16(strArray[9]);
                     data.Magnetic.Z = Convert.ToInt16(strArray[10]);
                     data.Pressure = Convert.ToUInt16(strArray[11]);
                     data.Temperature = Convert.ToInt16(strArray[12]);
                     this.AddDataObject(data);
                 }
             }
         }
         catch (Exception exception2)
         {
             if (base.OnMessageToLog != null)
             {
                 base.OnMessageToLog("Error reading line " + exception2.Message);
             }
             flag = false;
         }
     }
     if (flag)
     {
         this.ThereAreDataNotSaved = false;
         if (base.OnMessageToLog != null)
         {
             base.OnMessageToLog("Loaded data file [" + strFileToLoad + "]");
         }
     }
     reader.Close();
     this.Cursor = Cursors.Default;
 }
Example #2
0
 public int GetSample(ref FrameData data)
 {
     return INEMO_SDK_GetSample(ref data);
 }
Example #3
0
 private static extern int INEMO_SDK_GetSample(ref FrameData pFrame);
Example #4
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     FrameData data = new FrameData();
     bool flag = false;
     if (base.DeviceConnected)
     {
         while (sdkCom.GetSample(ref data) == 0)
         {
             UpdateInfoToolbar(data.TimeStamp);
             if (base.OnDataReceived != null)
             {
                 flag = !base.OnDataReceived(data);
             }
             if (flag || ((toolStripComboBox2.SelectedIndex == 0) && (data.TimeStamp == (TimeStampDelta * (NumSamples - 1)))))
             {
                 toolStripButton13.PerformClick();
             }
         }
     }
 }