Exemple #1
0
 private void frmFileReplay_FormClosing(object sender, FormClosingEventArgs e)
 {
     this._playState = _playStates.QUIT;
 }
Exemple #2
0
 private void frmFileReplayToolPlay_Click(object sender, EventArgs e)
 {
     if (this._logFileName != string.Empty)
     {
         this._lastPlayState = this._playState;
         this._playState = _playStates.PLAY;
         this.Text = "Play: " + this._logFileName;
         if (this._lastPlayState == _playStates.IDLE)
         {
             this.comm.WriteApp("User marker: Start playing " + this._logFileName);
         }
         this.frmFileReplayTrackBar.Enabled = false;
     }
     else
     {
         MessageBox.Show("No file open", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand);
     }
 }
Exemple #3
0
 private void frmFileReplayToolStop_Click(object sender, EventArgs e)
 {
     this._playState = _playStates.IDLE;
     this.comm.Log.CloseFile();
     this.comm.File_ResetProtocol();
     this.Text = "Stop: " + this._logFileName;
     this.frmFileReplayTrackBar.Enabled = true;
 }
Exemple #4
0
 private void frmFileReplayToolForward_Click(object sender, EventArgs e)
 {
     this._lastPlayState = this._playState;
     this._playState = _playStates.FORWARD;
     if (this._playState != this._lastPlayState)
     {
         this.comm.WriteApp("User marker: Go forward to next epoch");
     }
     this.Text = "Forward: " + this._logFileName;
     this.frmFileReplayTrackBar.Enabled = false;
 }
Exemple #5
0
 private void frmFileReplayToolPause_Click(object sender, EventArgs e)
 {
     this._lastPlayState = this._playState;
     this._playState = _playStates.PAUSE;
     this.Text = "Pause: " + this._logFileName;
     this.frmFileReplayTrackBar.Enabled = true;
 }
Exemple #6
0
 private void frmFileReplayCloseToolStripMenuItem_Click(object sender, EventArgs e)
 {
     this._playState = _playStates.IDLE;
     if (this._fileHdlr != null)
     {
         this._fileHdlr.Close();
     }
     this._fileHdlr = null;
     this._logFileName = string.Empty;
     this.Text = "Idle";
     this.frmFileReplayOpenToolStripMenuItem.Enabled = true;
 }
Exemple #7
0
 private void frmFileReplayOpenToolStripMenuItem_Click(object sender, EventArgs e)
 {
     OpenFileDialog dialog = new OpenFileDialog();
     dialog.Title = "Specify log file name:";
     dialog.InitialDirectory = @"..\..\logs\";
     dialog.Filter = "GP2 (*.gp2)|*.gp2|GPS (*.gps)|*.gps|All files (*.*)|*.*";
     dialog.FilterIndex = 1;
     dialog.CheckPathExists = false;
     dialog.CheckFileExists = false;
     if (dialog.ShowDialog() != DialogResult.OK)
     {
         return;
     }
     this._logFileName = dialog.FileName;
     this.Text = "Open: " + this._logFileName;
     this._fileHdlr = new LargeFileHandler(this._logFileName);
     this._totalFileSize = this._fileHdlr.Length;
     this.frmFileReplayTrackBar.Value = 0;
     this.frmFileReplayTrackBar.Maximum = 100;
     this.frmFileReplayTrackBar.Minimum = 0;
     this._playState = _playStates.IDLE;
     this._lastPlayState = this._playState;
     this.comm.MessageProtocol = this.cboProtocols.SelectedItem.ToString();
     string[] strArray = this._logFileName.Split(new char[] { '.' });
     if (strArray.Length != 2)
     {
         return;
     }
     string str = strArray[1].ToUpper();
     if (str != null)
     {
         if (!(str == "GP2") && !(str == "GPX"))
         {
             if (str == "GPS")
             {
                 this._viewType = CommonClass.TransmissionType.GPS;
                 this._fileType = CommonClass.TransmissionType.GPS;
                 goto Label_01A1;
             }
             if (str == "TXT")
             {
                 this._viewType = CommonClass.TransmissionType.Text;
                 this._fileType = CommonClass.TransmissionType.Text;
                 goto Label_01A1;
             }
             if (str == "BIN")
             {
                 this._viewType = CommonClass.TransmissionType.Hex;
                 this._fileType = CommonClass.TransmissionType.Hex;
                 goto Label_01A1;
             }
         }
         else
         {
             this._viewType = CommonClass.TransmissionType.GP2;
             this._fileType = CommonClass.TransmissionType.GP2;
             goto Label_01A1;
         }
     }
     this._viewType = CommonClass.TransmissionType.Hex;
     this._fileType = CommonClass.TransmissionType.Hex;
     Label_01A1:
     this._processFileLog = strArray[0] + ".par";
     this.frmFileReplayOpenToolStripMenuItem.Enabled = false;
 }
Exemple #8
0
        private void parseFile()
        {
            EventHandler method = null;
            EventHandler handler2 = null;
            EventHandler handler3 = null;
            EventHandler handler4 = null;
            EventHandler handler5 = null;
            EventHandler handler6 = null;
            EventHandler handler7 = null;
            EventHandler handler8 = null;
            CommonUtilsClass class2 = new CommonUtilsClass();
            string timeStamp = string.Empty;
            int millisecondsTimeout = 500;
            bool flag = false;
            Label_002C:
            try
            {
                switch (this._playState)
                {
                    case _playStates.IDLE:
                        millisecondsTimeout = 500;
                        this._fileIndex = 0L;
                        if (method == null)
                        {
                            method = delegate {
                                this.frmFileReplayTrackBar.Enabled = true;
                            };
                        }
                        this.frmFileReplayTrackBar.Invoke(method);
                        goto Label_080E;

                    case _playStates.PLAY:
                        millisecondsTimeout = this.speedDelay;
                        class2.viewPause = false;
                        if (handler3 == null)
                        {
                            handler3 = delegate {
                                this.frmFileReplayTrackBar.Enabled = false;
                            };
                        }
                        this.frmFileReplayTrackBar.Invoke(handler3);
                        if (this._fileHdlr != null)
                        {
                            string csvString = this._fileHdlr[this._fileIndex];
                            try
                            {
                                string str4;
                                if (csvString == "EOF")
                                {
                                    if (MessageBox.Show("End of file reached! -- Rewind?", "Information", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
                                    {
                                        this._fileIndex = 0L;
                                        this.comm.WriteApp("User marker: Rewind and retart");
                                    }
                                    else
                                    {
                                        this._playState = _playStates.IDLE;
                                        if (handler4 == null)
                                        {
                                            handler4 = delegate {
                                                this.Text = "Stop: " + this._logFileName;
                                            };
                                        }
                                        base.Invoke(handler4);
                                    }
                                    if (handler5 == null)
                                    {
                                        handler5 = delegate {
                                            this.frmFileReplayTrackBar.Value = this.frmFileReplayTrackBar.Maximum;
                                        };
                                    }
                                    this.frmFileReplayTrackBar.Invoke(handler5);
                                    goto Label_080E;
                                }
                                string inputString = string.Empty;
                                bool flag2 = false;
                                CommonClass.MessageType normal = CommonClass.MessageType.Normal;
                                csvString = csvString.TrimEnd(new char[] { '\n' });
                                csvString = csvString.TrimEnd(new char[] { '\r' });
                                switch (this._fileType)
                                {
                                    case CommonClass.TransmissionType.Text:
                                        inputString = csvString;
                                        normal = CommonClass.MessageType.Incoming;
                                        timeStamp = string.Empty;
                                        goto Label_04F9;

                                    case CommonClass.TransmissionType.GP2:
                                    {
                                        csvString = csvString.ToUpper();
                                        if (!csvString.Contains("A0 A2"))
                                        {
                                            goto Label_0280;
                                        }
                                        int index = csvString.IndexOf("A0 A2");
                                        int num3 = csvString.IndexOf("(");
                                        inputString = csvString.Substring(index);
                                        str4 = csvString.Substring(num3 + 1, 1);
                                        if (!(str4 == "0"))
                                        {
                                            break;
                                        }
                                        normal = CommonClass.MessageType.Incoming;
                                        goto Label_04F9;
                                    }
                                    case CommonClass.TransmissionType.GPS:
                                    {
                                        inputString = csvString;
                                        normal = CommonClass.MessageType.Normal;
                                        csvString = csvString.Replace(" ", "");
                                        string messageProtocol = this.comm.MessageProtocol;
                                        if (this.comm.MessageProtocol == "OSP")
                                        {
                                            messageProtocol = "SSB";
                                        }
                                        if (csvString.StartsWith("2,"))
                                        {
                                            this.comm.getSatellitesDataForGUIFromCSV(2, 0, messageProtocol, csvString);
                                        }
                                        else if (csvString.StartsWith("4,"))
                                        {
                                            this.comm.getSatellitesDataForGUIFromCSV(4, 0, messageProtocol, csvString);
                                        }
                                        else if (csvString.StartsWith("41,"))
                                        {
                                            this.comm.getSatellitesDataForGUIFromCSV(0x29, 0, messageProtocol, csvString);
                                        }
                                        else
                                        {
                                            if (!csvString.StartsWith("225,"))
                                            {
                                                goto Label_04A1;
                                            }
                                            if (!csvString.StartsWith("225,00"))
                                            {
                                                goto Label_03D1;
                                            }
                                            if (!clsGlobal.IsMarketingUser() && (csvString.Length > 1))
                                            {
                                                string str6 = string.Empty;
                                                for (int i = 6; i < csvString.Length; i += 2)
                                                {
                                                    byte num5 = (byte) int.Parse(csvString.Substring(i, 2), NumberStyles.HexNumber);
                                                    num5 = (byte) (num5 ^ 0xff);
                                                    str6 = str6 + Convert.ToChar(num5);
                                                }
                                                inputString = str6;
                                            }
                                        }
                                        goto Label_04F9;
                                    }
                                    default:
                                        inputString = csvString;
                                        normal = CommonClass.MessageType.Normal;
                                        timeStamp = string.Empty;
                                        goto Label_04F9;
                                }
                                switch (str4)
                                {
                                    case "1":
                                    case "2":
                                        normal = CommonClass.MessageType.Incoming;
                                        break;
                                }
                                goto Label_04F9;
                            Label_0280:
                                inputString = csvString;
                                goto Label_04F9;
                            Label_03D1:
                                if (csvString.StartsWith("225,6"))
                                {
                                    this.GetTTFFFromCSV(csvString);
                                    if (!this.comm.AutoReplyCtrl.AutoReplyParams.AutoReply && (this._ttffDisplay != null))
                                    {
                                        ReceiverReset resetCtrl = this.comm.RxCtrl.ResetCtrl;
                                        resetCtrl.ResetCount++;
                                        this._ttffDisplay.updateTTFFNow();
                                    }
                                }
                                else if (csvString.StartsWith("225,7"))
                                {
                                    this.GetTTFFFromCSV(csvString);
                                    if (this.comm.AutoReplyCtrl.AutoReplyParams.AutoReply && (this._ttffDisplay != null))
                                    {
                                        ReceiverReset reset2 = this.comm.RxCtrl.ResetCtrl;
                                        reset2.ResetCount++;
                                        this._ttffDisplay.updateTTFFNow();
                                    }
                                }
                                goto Label_04F9;
                            Label_04A1:
                                if (csvString.StartsWith("69,"))
                                {
                                    this.comm.AutoReplyCtrl.AutoReplyParams.AutoReply = true;
                                    if (csvString.StartsWith("69,1"))
                                    {
                                        this.getOSPPosition(csvString);
                                    }
                                }
                            Label_04F9:
                                flag2 = this.comm.File_DataReceived(normal, inputString, this._isMatchRegularExpression, this._regMatchString, timeStamp);
                                this.rtbDisplayProccess();
                                if (flag2)
                                {
                                    this._count++;
                                    if ((this._lastPlayState != _playStates.FORWARD) && (this._lastPlayState != _playStates.BACKWARD))
                                    {
                                        if (handler6 == null)
                                        {
                                            handler6 = delegate {
                                                this.frmFileReplayOccurrence.Text = "Match: " + this._count.ToString() + " found";
                                            };
                                        }
                                        this.frmFileReplayOccurrence.Invoke(handler6);
                                    }
                                    this._playState = _playStates.PAUSE;
                                }
                                this._fileIndex = this._fileHdlr.Index + 1L;
                                if (this._totalFileSize != 0L)
                                {
                                    int processPercentage = (int) ((((double) this._fileHdlr.Index) / ((double) this._totalFileSize)) * 100.0);
                                    this.frmFileReplayTrackBar.Invoke((MethodInvoker)delegate
                                    {
                                        this.frmFileReplayTrackBar.Value = processPercentage;
                                    });
                                }
                                if (this.comm._isEpochMessage)
                                {
                                    this.comm._isEpochMessage = false;
                                    if (this._lastPlayState != _playStates.BACKWARD)
                                    {
                                        if (this._epochList.Count >= 100)
                                        {
                                            this._epochList.RemoveAt(0);
                                        }
                                        if (!this._epochList.Contains(this._fileIndex - 1L))
                                        {
                                            this._epochList.Add(this._fileIndex - 1L);
                                            this._epochIndex = this._epochList.Count - 1;
                                        }
                                    }
                                }
                            }
                            catch (Exception exception)
                            {
                                if (this._playState != _playStates.QUIT)
                                {
                                    MessageBox.Show(string.Format("Error: {0}\n{1}", exception.Message, csvString), "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                                    this._fileIndex = this._fileHdlr.Index + 1L;
                                }
                            }
                        }
                        goto Label_080E;

                    case _playStates.PAUSE:
                        millisecondsTimeout = 500;
                        if (handler2 == null)
                        {
                            handler2 = delegate {
                                this.frmFileReplayTrackBar.Enabled = true;
                            };
                        }
                        this.frmFileReplayTrackBar.Invoke(handler2);
                        goto Label_080E;

                    case _playStates.FORWARD:
                        if (handler7 == null)
                        {
                            handler7 = delegate {
                                this.frmFileReplayTrackBar.Enabled = false;
                            };
                        }
                        this.frmFileReplayTrackBar.Invoke(handler7);
                        this.comm._isCheckEpoch = true;
                        this._lastPlayState = this._playState;
                        this._playState = _playStates.PLAY;
                        this._epochIndex++;
                        if (this._epochIndex > (this._epochList.Count - 1))
                        {
                            this._epochIndex = this._epochList.Count - 1;
                            if (this._epochIndex < 0)
                            {
                                this._epochIndex = 0;
                            }
                        }
                        goto Label_080E;

                    case _playStates.BACKWARD:
                        if (handler8 == null)
                        {
                            handler8 = delegate {
                                this.frmFileReplayTrackBar.Enabled = false;
                            };
                        }
                        this.frmFileReplayTrackBar.Invoke(handler8);
                        this.comm._isCheckEpoch = true;
                        this._lastPlayState = this._playState;
                        if (this._epochIndex < 1)
                        {
                            MessageBox.Show("Reached end of backward list", "Warning");
                            this._epochIndex = 0;
                            this._playState = _playStates.PAUSE;
                        }
                        else
                        {
                            this._fileIndex = this._epochList[this._epochIndex - 1];
                            this._epochIndex--;
                            this._playState = _playStates.PLAY;
                        }
                        goto Label_080E;

                    case _playStates.QUIT:
                        flag = true;
                        goto Label_080E;
                }
                millisecondsTimeout = this.speedDelay;
            }
            catch (Exception exception2)
            {
                if (this._playState != _playStates.QUIT)
                {
                    MessageBox.Show(string.Format("Error: frmFileReplay: parseFile() {0}", exception2.ToString()), "ERROR", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Hand);
                    this._fileIndex = this._fileHdlr.Index + 1L;
                }
            }
            Label_080E:
            if (flag)
            {
                return;
            }
            Thread.Sleep(millisecondsTimeout);
            goto Label_002C;
        }
Exemple #9
0
 protected override void OnClosed(EventArgs e)
 {
     this._playState = _playStates.QUIT;
     m_SChildform = null;
     this.comm.Log.CloseFile();
     if (this._fileHdlr != null)
     {
         this._fileHdlr.Close();
     }
     if (this._parseThread != null)
     {
         this._parseThread.Abort();
         this._parseThread.Join();
     }
     if (this._signalMapPanel != null)
     {
         this._signalMapPanel.Close();
     }
     if (this._signalStrengthPanel != null)
     {
         this._signalStrengthPanel.Close();
     }
     if (this._locationViewPanel != null)
     {
         this._locationViewPanel.Close();
     }
     if (this._interferenceReport != null)
     {
         this._interferenceReport.Close();
     }
     if (this._messageFilter != null)
     {
         this._messageFilter.Close();
     }
     if (this._ttffDisplay != null)
     {
         this._ttffDisplay.Close();
     }
     base.OnClosed(e);
 }
Exemple #10
0
 private void fileReplayCloseHandler()
 {
     if (_isFileOpen)
     {
         _playState = _playStates.IDLE;
         _playState = _playStates.QUIT;
         if (_fileHdlr != null)
         {
             _fileHdlr.Close();
         }
         _fileHdlr = null;
         _isFileOpen = false;
         _logFileName = string.Empty;
         toolStripOpenFileBtn.Enabled = true;
         fileOpenToolStripMenuItem.Enabled = true;
         filePlayBackTrackBar.Enabled = true;
         filePlayBackTrackBar.Visible = false;
         Text = string.Format("{0}: File Playback Close", clsGlobal.SiRFLiveVersion);
     }
 }
Exemple #11
0
 private DialogResult fileReplayOpenHandler()
 {
     bool flag = false;
     foreach (string str in PortManagerHash.Keys)
     {
         if (!(str == clsGlobal.FilePlayBackPortName))
         {
             PortManager manager = (PortManager) PortManagerHash[str];
             if ((manager != null) && manager.comm.IsSourceDeviceOpen())
             {
                 flag = true;
                 break;
             }
         }
     }
     if (flag && (MessageBox.Show("Proceeding will close all open ports. Continue?", "File Playback Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.No))
     {
         return DialogResult.Cancel;
     }
     foreach (string str2 in PortManagerHash.Keys)
     {
         if (str2 != clsGlobal.FilePlayBackPortName)
         {
             PortManager tmpP = (PortManager) PortManagerHash[str2];
             if (tmpP != null)
             {
                 if (tmpP.comm.IsSourceDeviceOpen())
                 {
                     tmpP.comm.ClosePort();
                 }
                 tmpP.CloseAll();
                 updateGUIOnConnectNDisconnect(tmpP);
             }
         }
     }
     updateAllMainBtn();
     menuBtnInit();
     OpenFileDialog dialog = new OpenFileDialog();
     dialog.Title = "Specify log file name:";
     dialog.InitialDirectory = @"..\..\logs\";
     dialog.Filter = "GP2 (*.gp2)|*.gp2|GPS (*.gps)|*.gps|Text files (*.txt)|*.txt|All files (*.*)|*.*";
     dialog.FilterIndex = 4;
     dialog.CheckPathExists = false;
     dialog.CheckFileExists = false;
     if (dialog.ShowDialog() != DialogResult.OK)
     {
         goto Label_04AE;
     }
     _logFileName = dialog.FileName;
     if ((_logFileName == string.Empty) || !File.Exists(_logFileName))
     {
         MessageBox.Show(string.Format("Error Open file\n {0}", _logFileName), "File Playback Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
         _playState = _playStates.IDLE;
         return DialogResult.Cancel;
     }
     Text = string.Format("{0}: File Playback", clsGlobal.SiRFLiveVersion);
     _fileHdlr = new LargeFileHandler(_logFileName);
     _totalFileSize = _fileHdlr.Length;
     filePlayBackTrackBar.Value = 0;
     filePlayBackTrackBar.Maximum = 100;
     filePlayBackTrackBar.Minimum = 0;
     filePlayBackTrackBar.Enabled = true;
     filePlayBackTrackBar.Visible = true;
     _playState = _playStates.IDLE;
     _lastPlayState = _playState;
     FileInfo info = new FileInfo(_logFileName);
     if (info.Length == 0L)
     {
         MessageBox.Show(string.Format("0 length file dectected!\n{0}", _logFileName), "File Playback Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
         return DialogResult.Cancel;
     }
     string str3 = info.Extension.ToUpper();
     if (str3 != null)
     {
         if (!(str3 == ".GP2") && !(str3 == ".GPX"))
         {
             if (str3 == ".GPS")
             {
                 _viewType = CommonClass.TransmissionType.GPS;
                 _fileType = CommonClass.TransmissionType.GPS;
                 goto Label_033C;
             }
             if (str3 == ".TXT")
             {
                 _viewType = CommonClass.TransmissionType.Text;
                 _fileType = CommonClass.TransmissionType.Text;
                 goto Label_033C;
             }
             if (str3 == ".BIN")
             {
                 _viewType = CommonClass.TransmissionType.Hex;
                 _fileType = CommonClass.TransmissionType.Hex;
                 goto Label_033C;
             }
         }
         else
         {
             _viewType = CommonClass.TransmissionType.GPS;
             _fileType = CommonClass.TransmissionType.GP2;
             goto Label_033C;
         }
     }
     _viewType = CommonClass.TransmissionType.Hex;
     _fileType = CommonClass.TransmissionType.Hex;
     Label_033C:
     _processFileLog = info.DirectoryName + info.Name + ".par";
     PortManager manager3 = setupFileReplayPort();
     if (manager3 != null)
     {
         manager3.UpdateMainWindow += new PortManager.updateParentEventHandler(updateMainWindowTitle);
         if (!toolStripPortComboBox.Items.Contains(clsGlobal.FilePlayBackPortName))
         {
             toolStripPortComboBox.Items.Add(clsGlobal.FilePlayBackPortName);
         }
         toolStripPortComboBox.Text = clsGlobal.FilePlayBackPortName;
         if (_lastPlayState == _playStates.IDLE)
         {
             manager3.comm.WriteApp("User marker: Open file: " + _logFileName);
         }
         manager3.PerPortToolStrip = AddPortToolbar((toolStripMain.Location.Y + (0x19 * PortManagerHash.Count)) + 0x23, manager3.comm.PortName);
         manager3.ClearSubWindowsData(true);
     }
     else
     {
         MessageBox.Show("Error Setup Port for File Playback", "File Playback Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
         _playState = _playStates.IDLE;
         return DialogResult.Cancel;
     }
     fileOpenToolStripMenuItem.Enabled = false;
     toolStripOpenFileBtn.Enabled = false;
     logManagerStatusLabel.Text = _logFileName;
     _isFileOpen = true;
     _parseThread = new Thread(new ThreadStart(parseFile));
     _parseThread.IsBackground = true;
     _parseThread.Start();
     EnableDisableMenuAndButtonForFilePlayback(true);
     updateFilePlaybackBtn(true);
     Label_04AE:
     return base.DialogResult;
 }
Exemple #12
0
 private void toolStripStopBtn_Click(object sender, EventArgs e)
 {
     if (_isFileOpen && (_playState != _playStates.IDLE))
     {
         _playState = _playStates.IDLE;
         Text = string.Format("{0}: File Playback Stop", clsGlobal.SiRFLiveVersion);
         filePlayBackTrackBar.Enabled = true;
         updateFilePlaybackPauseBtn(false);
     }
 }
Exemple #13
0
 private void toolStripPlayBtn_Click(object sender, EventArgs e)
 {
     if ((_isFileOpen || (fileReplayOpenHandler() != DialogResult.Cancel)) && (_playState != _playStates.PLAY))
     {
         if (_playState != _playStates.PAUSE)
         {
             PortManager manager = (PortManager) PortManagerHash[clsGlobal.FilePlayBackPortName];
             if (((manager != null) && (manager._SiRFAware != null)) && manager.SiRFawareLocation.IsOpen)
             {
                 manager._SiRFAware.SirfawareGUIInit();
             }
         }
         _lastPlayState = _playState;
         _playState = _playStates.PLAY;
         Text = string.Format("{0}: File Playback Play", clsGlobal.SiRFLiveVersion);
         filePlayBackTrackBar.Enabled = false;
         updateFilePlaybackPauseBtn(false);
     }
 }
Exemple #14
0
 private void toolStripPause_Click(object sender, EventArgs e)
 {
     _lastPlayState = _playState;
     if ((_playState != _playStates.IDLE) && (_playState != _playStates.QUIT))
     {
         if (_playState != _playStates.PAUSE)
         {
             _playState = _playStates.PAUSE;
             updateFilePlaybackPauseBtn(true);
             filePlayBackTrackBar.Enabled = true;
             Text = string.Format("{0}: -- File Playback Pause ", clsGlobal.SiRFLiveVersion);
         }
         else
         {
             _playState = _playStates.PLAY;
             updateFilePlaybackPauseBtn(false);
             filePlayBackTrackBar.Enabled = false;
             Text = string.Format("{0}: -- File Playback Play ", clsGlobal.SiRFLiveVersion);
         }
     }
 }
Exemple #15
0
 private void toolStripNextBtn_Click(object sender, EventArgs e)
 {
     if (_playState != _playStates.FORWARD)
     {
         _lastPlayState = _playState;
         _playState = _playStates.FORWARD;
         Text = string.Format("{0}: -- File Playback Forward ", clsGlobal.SiRFLiveVersion);
         filePlayBackTrackBar.Enabled = false;
         updateFilePlaybackPauseBtn(false);
     }
 }
Exemple #16
0
        private void parseFile()
        {
            EventHandler method = null;
            EventHandler handler2 = null;
            EventHandler handler3 = null;
            EventHandler handler4 = null;
            EventHandler handler5 = null;
            EventHandler handler6 = null;
            EventHandler handler7 = null;
            CommonUtilsClass class2 = new CommonUtilsClass();
            string timeStamp = string.Empty;
            int millisecondsTimeout = 500;
            bool flag = false;
            PortManager manager = (PortManager) PortManagerHash[clsGlobal.FilePlayBackPortName];
            Thread.CurrentThread.CurrentCulture = clsGlobal.MyCulture;
            Label_004F:
            try
            {
                switch (_playState)
                {
                    case _playStates.IDLE:
                        millisecondsTimeout = 500;
                        _fileIndex = 0L;
                        if (method == null)
                        {
                            method = delegate {
                                filePlayBackTrackBar.Enabled = true;
                            };
                        }
                        filePlayBackTrackBar.Invoke(method);
                        goto Label_0B9D;

                    case _playStates.PLAY:
                        millisecondsTimeout = _speedDelay;
                        class2.viewPause = false;
                        if (handler3 == null)
                        {
                            handler3 = delegate {
                                filePlayBackTrackBar.Enabled = false;
                            };
                        }
                        filePlayBackTrackBar.Invoke(handler3);
                        if (_fileHdlr != null)
                        {
                            string input = _fileHdlr[_fileIndex];
                            try
                            {
                                string str7;
                                if (input == "EOF")
                                {
                                    if (MessageBox.Show("End of file reached! -- Rewind?", "Information", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.Yes)
                                    {
                                        _fileIndex = 0L;
                                        if (((manager != null) && (manager._SiRFAware != null)) && manager.SiRFawareLocation.IsOpen)
                                        {
                                            manager._SiRFAware.SirfawareGUIInit();
                                        }
                                    }
                                    else
                                    {
                                        _playState = _playStates.IDLE;
                                        if (handler4 == null)
                                        {
                                            handler4 = delegate {
                                                Text = string.Format("{0}: File Playback Stop", clsGlobal.SiRFLiveVersion);
                                            };
                                        }
                                        base.Invoke(handler4);
                                    }
                                    if (handler5 == null)
                                    {
                                        handler5 = delegate {
                                            filePlayBackTrackBar.Value = filePlayBackTrackBar.Maximum;
                                        };
                                    }
                                    filePlayBackTrackBar.Invoke(handler5);
                                    goto Label_0B9D;
                                }
                                string inputString = string.Empty;
                                CommonClass.MessageType normal = CommonClass.MessageType.Normal;
                                input = input.TrimEnd(new char[] { '\n' });
                                input = input.TrimEnd(new char[] { '\r' });
                                string pattern = @"\(1\)\tA0 A2 \w+ \w+ 80";
                                string str5 = @"\(1\)\tA0 A2 \w+ \w+ D6";
                                string str6 = @"(?<rt>\w+) \w+ \w+ B0 B3";
                                Regex regex = new Regex(pattern, RegexOptions.Compiled);
                                if (regex.IsMatch(input))
                                {
                                    manager.comm.RxCtrl.ResetCtrl.ResetDataInit();
                                    regex = new Regex(str6, RegexOptions.Compiled);
                                    if (regex.IsMatch(input))
                                    {
                                        try
                                        {
                                            byte maskByte = byte.Parse(regex.Match(input).Result("${rt}"), NumberStyles.HexNumber);
                                            manager.comm.RxCtrl.ResetCtrl.ResetType = SSB_Format.GetResetTypeFromBitMap(maskByte);
                                        }
                                        catch
                                        {
                                        }
                                    }
                                    else
                                    {
                                        manager.comm.RxCtrl.ResetCtrl.ResetType = "Unknown";
                                    }
                                }
                                regex = new Regex(str5, RegexOptions.Compiled);
                                if (regex.IsMatch(input))
                                {
                                    manager.comm.AutoReplyCtrl.AutoReplyParams.AutoReply = true;
                                }
                                switch (_fileType)
                                {
                                    case CommonClass.TransmissionType.Text:
                                        inputString = input;
                                        normal = CommonClass.MessageType.Incoming;
                                        timeStamp = string.Empty;
                                        goto Label_0863;

                                    case CommonClass.TransmissionType.GP2:
                                    {
                                        input = input.ToUpper();
                                        if (!input.Contains("A0 A2"))
                                        {
                                            goto Label_03A9;
                                        }
                                        int index = input.IndexOf("A0 A2");
                                        int num4 = input.IndexOf("(");
                                        inputString = input.Substring(index);
                                        str7 = input.Substring(num4 + 1, 1);
                                        if (!(str7 == "0"))
                                        {
                                            break;
                                        }
                                        normal = CommonClass.MessageType.Incoming;
                                        goto Label_0863;
                                    }
                                    case CommonClass.TransmissionType.GPS:
                                    {
                                        inputString = input;
                                        normal = CommonClass.MessageType.Normal;
                                        input = input.Replace(" ", "");
                                        string messageProtocol = manager.comm.MessageProtocol;
                                        if (manager.comm.MessageProtocol == "OSP")
                                        {
                                            messageProtocol = "SSB";
                                        }
                                        if (input.StartsWith("2,"))
                                        {
                                            manager.comm.getSatellitesDataForGUIFromCSV(2, 0, messageProtocol, input);
                                        }
                                        else if (input.StartsWith("4,"))
                                        {
                                            manager.comm.getSatellitesDataForGUIFromCSV(4, 0, messageProtocol, input);
                                        }
                                        else if (input.StartsWith("41,"))
                                        {
                                            manager.comm.getSatellitesDataForGUIFromCSV(0x29, 0, messageProtocol, input);
                                        }
                                        else if (input.StartsWith("30,"))
                                        {
                                            manager.comm.getSatellitesDataForGUIFromCSV(30, 0, messageProtocol, input);
                                        }
                                        else
                                        {
                                            if (!input.StartsWith("225,"))
                                            {
                                                goto Label_05FD;
                                            }
                                            if (!input.StartsWith("225,00"))
                                            {
                                                goto Label_053A;
                                            }
                                            if (!clsGlobal.IsMarketingUser() && (input.Length > 1))
                                            {
                                                string str9 = string.Empty;
                                                string[] strArray = input.Split(new char[] { ',' });
                                                for (int i = 2; i < strArray.Length; i += 2)
                                                {
                                                    byte num6 = (byte) int.Parse(strArray[i], NumberStyles.HexNumber);
                                                    num6 = (byte) (num6 ^ 0xff);
                                                    str9 = str9 + Convert.ToChar(num6);
                                                }
                                                inputString = str9;
                                            }
                                        }
                                        goto Label_0863;
                                    }
                                    default:
                                        inputString = input;
                                        normal = CommonClass.MessageType.Normal;
                                        timeStamp = string.Empty;
                                        goto Label_0863;
                                }
                                switch (str7)
                                {
                                    case "1":
                                    case "2":
                                        normal = CommonClass.MessageType.Outgoing;
                                        break;
                                }
                                goto Label_0863;
                            Label_03A9:
                                inputString = input;
                                goto Label_0863;
                            Label_053A:
                                if (input.StartsWith("225,6"))
                                {
                                    manager.GetTTFFFromCSVString(input);
                                    if ((!manager.comm.AutoReplyCtrl.AutoReplyParams.AutoReply && (manager._ttffDisplay != null)) && manager.TTFFDisplayLocation.IsOpen)
                                    {
                                        manager._ttffDisplay.updateTTFFNow();
                                    }
                                }
                                else if (input.StartsWith("225,7"))
                                {
                                    manager.GetTTFFFromCSVString(input);
                                    if ((manager.comm.AutoReplyCtrl.AutoReplyParams.AutoReply && (manager._ttffDisplay != null)) && manager.TTFFDisplayLocation.IsOpen)
                                    {
                                        manager._ttffDisplay.updateTTFFNow();
                                    }
                                }
                                goto Label_0863;
                            Label_05FD:
                                if (input.StartsWith("69,"))
                                {
                                    manager.comm.AutoReplyCtrl.AutoReplyParams.AutoReply = true;
                                    if (input.StartsWith("69,1"))
                                    {
                                        manager.GetOSPPositionFormCSVString(input);
                                    }
                                }
                                else if (input.StartsWith("77,"))
                                {
                                    if ((manager._SiRFAware != null) && manager.SiRFawareLocation.IsOpen)
                                    {
                                        Hashtable siRFAwareScanResHash = null;
                                        if (input.StartsWith("77,1"))
                                        {
                                            siRFAwareScanResHash = manager.comm.getMPMStatsDataForGUIFromCSV(0x4d, 1, "OSP", input);
                                        }
                                        else if (input.StartsWith("77,2"))
                                        {
                                            siRFAwareScanResHash = manager.comm.getMPMStatsDataForGUIFromCSV(0x4d, 2, "OSP", input);
                                        }
                                        else if (input.StartsWith("77,3"))
                                        {
                                            siRFAwareScanResHash = manager.comm.getMPMStatsDataForGUIFromCSV(0x4d, 3, "OSP", input);
                                        }
                                        else if (input.StartsWith("77,4"))
                                        {
                                            siRFAwareScanResHash = manager.comm.getMPMStatsDataForGUIFromCSV(0x4d, 4, "OSP", input);
                                        }
                                        else if (input.StartsWith("77,5"))
                                        {
                                            siRFAwareScanResHash = manager.comm.getMPMStatsDataForGUIFromCSV(0x4d, 5, "OSP", input);
                                        }
                                        else if (input.StartsWith("77,7"))
                                        {
                                            siRFAwareScanResHash = manager.comm.getMPMStatsDataForGUIFromCSV(0x4d, 7, "OSP", input);
                                        }
                                        manager._SiRFAware.UpdateSiRFawareGUI(siRFAwareScanResHash);
                                    }
                                }
                                else if (input.Contains("TTFF(s)"))
                                {
                                    try
                                    {
                                        if (manager._SiRFAware != null)
                                        {
                                            string[] strArray2 = input.Split(new char[] { '=' });
                                            manager._SiRFAware.TTFF = double.Parse(strArray2[1]);
                                            if (manager.SiRFawareLocation.IsOpen)
                                            {
                                                manager._SiRFAware.UpdateSiRFawareGUITime();
                                            }
                                        }
                                    }
                                    catch
                                    {
                                    }
                                }
                                else if (input.Contains("TotalTimeinSiRFaware(s)"))
                                {
                                    try
                                    {
                                        if (manager._SiRFAware != null)
                                        {
                                            string[] strArray3 = input.Split(new char[] { '=' });
                                            manager._SiRFAware.TotalMPMTime = double.Parse(strArray3[1]);
                                            if (manager.SiRFawareLocation.IsOpen)
                                            {
                                                manager._SiRFAware.UpdateSiRFawareGUITime();
                                            }
                                        }
                                    }
                                    catch
                                    {
                                    }
                                }
                            Label_0863:
                                if (manager.comm.File_DataReceived(normal, inputString, manager.comm.DebugViewIsMatchEnable, manager.comm.DebugViewMatchString, timeStamp))
                                {
                                    _playState = _playStates.PAUSE;
                                    updateFilePlaybackPauseBtn(true);
                                }
                                _fileIndex = _fileHdlr.Index + 1L;
                                if (_totalFileSize != 0L)
                                {
                                    int processPercentage = (int) ((((double) _fileHdlr.Index) / ((double) _totalFileSize)) * 100.0);
                                    filePlayBackTrackBar.Invoke((MethodInvoker)delegate
                                    {
                                        filePlayBackTrackBar.Value = processPercentage;
                                    });
                                }
                                if (manager.comm._isEpochMessage)
                                {
                                    manager.comm._isEpochMessage = false;
                                    if (_lastPlayState != _playStates.BACKWARD)
                                    {
                                        if (_epochList.Count >= 100)
                                        {
                                            _epochList.RemoveAt(0);
                                        }
                                        if (!_epochList.Contains(_fileIndex - 1L))
                                        {
                                            _epochList.Add(_fileIndex - 1L);
                                            _epochIndex = _epochList.Count - 1;
                                        }
                                    }
                                }
                            }
                            catch (Exception exception)
                            {
                                if (_playState != _playStates.QUIT)
                                {
                                    string errorStr = string.Format("Error: {0}\n{1}", exception.Message, input);
                                    if ((manager != null) && (manager.comm != null))
                                    {
                                        manager.comm.ErrorPrint(errorStr);
                                    }
                                    _fileIndex = _fileHdlr.Index + 1L;
                                }
                            }
                        }
                        goto Label_0B9D;

                    case _playStates.PAUSE:
                        millisecondsTimeout = 500;
                        if (handler2 == null)
                        {
                            handler2 = delegate {
                                filePlayBackTrackBar.Enabled = true;
                            };
                        }
                        filePlayBackTrackBar.Invoke(handler2);
                        goto Label_0B9D;

                    case _playStates.FORWARD:
                        if (_playState != _lastPlayState)
                        {
                            manager.comm.WriteApp("User marker: Go forward to next epoch");
                        }
                        if (handler6 == null)
                        {
                            handler6 = delegate {
                                filePlayBackTrackBar.Enabled = false;
                            };
                        }
                        filePlayBackTrackBar.Invoke(handler6);
                        manager.comm._isCheckEpoch = true;
                        _lastPlayState = _playState;
                        _playState = _playStates.PLAY;
                        _epochIndex++;
                        if (_epochIndex > (_epochList.Count - 1))
                        {
                            _epochIndex = _epochList.Count - 1;
                            if (_epochIndex < 0)
                            {
                                _epochIndex = 0;
                            }
                        }
                        goto Label_0B9D;

                    case _playStates.BACKWARD:
                        if (_playState != _lastPlayState)
                        {
                            manager.comm.WriteApp("User marker: Go backward to last epoch");
                        }
                        if (handler7 == null)
                        {
                            handler7 = delegate {
                                filePlayBackTrackBar.Enabled = false;
                            };
                        }
                        filePlayBackTrackBar.Invoke(handler7);
                        manager.comm._isCheckEpoch = true;
                        _lastPlayState = _playState;
                        if (_epochIndex < 1)
                        {
                            MessageBox.Show("Reached end of backward list", "File Playback", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                            _epochIndex = 0;
                            _playState = _playStates.PAUSE;
                        }
                        else
                        {
                            _fileIndex = _epochList[_epochIndex - 1];
                            _epochIndex--;
                            _playState = _playStates.PLAY;
                        }
                        goto Label_0B9D;

                    case _playStates.QUIT:
                        updateFilePlaybackPauseBtn(false);
                        flag = true;
                        goto Label_0B9D;
                }
                millisecondsTimeout = _speedDelay;
            }
            catch (Exception exception2)
            {
                if (_playState != _playStates.QUIT)
                {
                    MessageBox.Show(string.Format("Error: frmFileReplay: parseFile() {0}", exception2.ToString()), "ERROR", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Hand);
                    _fileIndex = _fileHdlr.Index + 1L;
                }
            }
            Label_0B9D:
            if (!flag)
            {
                Thread.Sleep(millisecondsTimeout);
                goto Label_004F;
            }
            manager.CloseAll();
            base.Invoke((MethodInvoker)delegate
            {
                toolStripNumPortTxtBox.Text = PortManagerHash.Count.ToString();
                toolStripPortComboBox.Items.Remove(clsGlobal.FilePlayBackPortName);
                if (toolStripPortComboBox.Items.Count >= 1)
                {
                    toolStripPortComboBox.Text = toolStripPortComboBox.Items[0].ToString();
                }
            });
            class2 = null;
            if (manager.comm.RxCtrl != null)
            {
                manager.comm.RxCtrl.Dispose();
                manager.comm.RxCtrl = null;
            }
            manager.comm.Dispose();
            manager.comm = null;
            manager = null;
            GC.Collect(2);
        }