StartRecording() public static method

public static StartRecording ( bool Is_ReplayFormat, string FilePath, IPAddress Interface_Addres, IPAddress Multicast_Address, int PortNumber ) : bool
Is_ReplayFormat bool
FilePath string
Interface_Addres System.Net.IPAddress
Multicast_Address System.Net.IPAddress
PortNumber int
return bool
Esempio n. 1
0
        private void checkedListBoxRecordingName_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            // Check if this item is checked
            if (e.NewValue == CheckState.Checked)
            {
                AppendDateTime DateTimeAppend = new AppendDateTime();
                string         path_and_name  = this.textBoxRecordDirectory.Text + "\\" + DateTimeAppend.ApendDateandTimeToFront(this.checkedListBoxRecordingName.Items[this.checkedListBoxRecordingName.SelectedIndex].ToString());

                switch (this.checkedListBoxRecordingName.SelectedIndex)
                {
                case 0:
                    if (RecForwConnection1.IsRecordingEnabled() == false)
                    {
                        if (RecForwConnection1.StartRecording(!this.chkBoxReplayFormatEnabled1.Checked,
                                                              path_and_name + GetFileExtension(!this.chkBoxReplayFormatEnabled1.Checked),
                                                              IPAddress.Parse(this.listBoxLocalAddr.Items[this.checkedListBoxRecordingName.SelectedIndex].ToString()),
                                                              IPAddress.Parse(this.listBoxIPAddress.Items[this.checkedListBoxRecordingName.SelectedIndex].ToString()),
                                                              int.Parse(this.listBoxPort.Items[this.checkedListBoxRecordingName.SelectedIndex].ToString())) == false)
                        {
                            this.checkedListBoxRecordingName.SetItemCheckState(this.checkedListBoxRecordingName.SelectedIndex, CheckState.Unchecked);
                        }
                        else
                        {
                            progressBar1.Visible = true;
                            this.chkBoxReplayFormatEnabled1.Enabled = false;
                        }
                    }
                    break;

                case 1:
                    if (RecForwConnection2.IsRecordingEnabled() == false)
                    {
                        if (RecForwConnection2.StartRecording(!this.chkBoxReplayFormatEnabled2.Checked,
                                                              path_and_name + GetFileExtension(!this.chkBoxReplayFormatEnabled2.Checked),
                                                              IPAddress.Parse(this.listBoxLocalAddr.Items[this.checkedListBoxRecordingName.SelectedIndex].ToString()),
                                                              IPAddress.Parse(this.listBoxIPAddress.Items[this.checkedListBoxRecordingName.SelectedIndex].ToString()),
                                                              int.Parse(this.listBoxPort.Items[this.checkedListBoxRecordingName.SelectedIndex].ToString())) == false)
                        {
                            this.checkedListBoxRecordingName.SetItemCheckState(this.checkedListBoxRecordingName.SelectedIndex, CheckState.Unchecked);
                        }
                        else
                        {
                            progressBar2.Visible = true;
                            this.chkBoxReplayFormatEnabled2.Enabled = false;
                        }
                    }
                    break;

                case 2:
                    if (RecForwConnection3.IsRecordingEnabled() == false)
                    {
                        if (RecForwConnection3.StartRecording(!this.chkBoxReplayFormatEnabled3.Checked,
                                                              path_and_name + GetFileExtension(!this.chkBoxReplayFormatEnabled3.Checked),
                                                              IPAddress.Parse(this.listBoxLocalAddr.Items[this.checkedListBoxRecordingName.SelectedIndex].ToString()),
                                                              IPAddress.Parse(this.listBoxIPAddress.Items[this.checkedListBoxRecordingName.SelectedIndex].ToString()),
                                                              int.Parse(this.listBoxPort.Items[this.checkedListBoxRecordingName.SelectedIndex].ToString())) == false)
                        {
                            this.checkedListBoxRecordingName.SetItemCheckState(this.checkedListBoxRecordingName.SelectedIndex, CheckState.Unchecked);
                        }
                        else
                        {
                            progressBar3.Visible = true;
                            this.chkBoxReplayFormatEnabled3.Enabled = false;
                        }
                    }
                    break;

                case 3:
                    if (RecForwConnection4.IsRecordingEnabled() == false)
                    {
                        if (RecForwConnection4.StartRecording(!this.chkBoxReplayFormatEnabled4.Checked,
                                                              path_and_name + GetFileExtension(!this.chkBoxReplayFormatEnabled4.Checked),
                                                              IPAddress.Parse(this.listBoxLocalAddr.Items[this.checkedListBoxRecordingName.SelectedIndex].ToString()),
                                                              IPAddress.Parse(this.listBoxIPAddress.Items[this.checkedListBoxRecordingName.SelectedIndex].ToString()),
                                                              int.Parse(this.listBoxPort.Items[this.checkedListBoxRecordingName.SelectedIndex].ToString())) == false)
                        {
                            this.checkedListBoxRecordingName.SetItemCheckState(this.checkedListBoxRecordingName.SelectedIndex, CheckState.Unchecked);
                        }
                        else
                        {
                            progressBar4.Visible = true;
                            this.chkBoxReplayFormatEnabled4.Enabled = false;
                        }
                    }
                    break;

                case 4:
                    if (RecForwConnection5.IsRecordingEnabled() == false)
                    {
                        if (RecForwConnection5.StartRecording(!this.chkBoxReplayFormatEnabled5.Checked,
                                                              path_and_name + GetFileExtension(!this.chkBoxReplayFormatEnabled5.Checked),
                                                              IPAddress.Parse(this.listBoxLocalAddr.Items[this.checkedListBoxRecordingName.SelectedIndex].ToString()),
                                                              IPAddress.Parse(this.listBoxIPAddress.Items[this.checkedListBoxRecordingName.SelectedIndex].ToString()),
                                                              int.Parse(this.listBoxPort.Items[this.checkedListBoxRecordingName.SelectedIndex].ToString())) == false)
                        {
                            this.checkedListBoxRecordingName.SetItemCheckState(this.checkedListBoxRecordingName.SelectedIndex, CheckState.Unchecked);
                        }
                        else
                        {
                            progressBar5.Visible = true;
                            this.chkBoxReplayFormatEnabled5.Enabled = false;
                        }
                    }
                    break;

                default:
                    break;
                }
            }
            else // No it is not checked
            {
                switch (this.checkedListBoxRecordingName.SelectedIndex)
                {
                case 0:
                    if (RecForwConnection1.IsRecordingEnabled() == true)
                    {
                        RecForwConnection1.StopRecording();
                        progressBar1.Visible = false;
                        this.chkBoxReplayFormatEnabled1.Enabled = true;
                    }
                    break;

                case 1:
                    if (RecForwConnection2.IsRecordingEnabled() == true)
                    {
                        RecForwConnection2.StopRecording();
                        progressBar2.Visible = false;
                        this.chkBoxReplayFormatEnabled2.Enabled = true;
                    }
                    break;

                case 2:
                    if (RecForwConnection3.IsRecordingEnabled() == true)
                    {
                        RecForwConnection3.StopRecording();
                        progressBar3.Visible = false;
                        this.chkBoxReplayFormatEnabled3.Enabled = true;
                    }
                    break;

                case 3:
                    if (RecForwConnection4.IsRecordingEnabled() == true)
                    {
                        RecForwConnection4.StopRecording();
                        progressBar4.Visible = false;
                        this.chkBoxReplayFormatEnabled4.Enabled = true;
                    }
                    break;

                case 4:
                    if (RecForwConnection5.IsRecordingEnabled() == true)
                    {
                        RecForwConnection5.StopRecording();
                        progressBar5.Visible = false;
                        this.chkBoxReplayFormatEnabled5.Enabled = true;
                    }
                    break;

                default:
                    break;
                }
            }
        }