private void HighlightDescriptionClick(object sender, EventArgs e)
        {
            DialogResult dr = _colorDialog.ShowDialog();

            if (dr == DialogResult.OK)
            {
                //get current description
                string description = (string)_dataGrid.Rows[_currentRightClickedRow].Cells["_description"].Value;
                //save this to the current profile
                Dictionary <string, string> hDefs = _dataSource.Profile.GetHighlightingDefinitions();
                if (!hDefs.ContainsKey(description))
                {
                    hDefs.Add(description, TVColorConverter.GetARGBString(_colorDialog.Color));
                    _dataSource.Profile.SetHighlightingDefinitions(hDefs);
                }
                //color all the visible rows that have this description
                int    n = _dataGrid.Rows.Count;
                string c;
                for (int i = 0; i < n; i++)
                {
                    c = (string)_dataGrid.Rows[i].Cells["_description"].Value;
                    if (c == description)
                    {
                        _dataGrid.Rows[i].DefaultCellStyle.BackColor = _colorDialog.Color;
                    }
                }
            }
        }
        private void HighlightSelectionClick(object sender, EventArgs e)
        {
            DialogResult dr = _colorDialog.ShowDialog();

            if (dr == DialogResult.OK)
            {
                Dictionary <string, string> hDefs = _dataSource.Profile.GetHighlightingDefinitions();
                string selectedColor = TVColorConverter.GetARGBString(_colorDialog.Color);
                foreach (DataGridViewRow row in _dataGrid.SelectedRows)
                {
                    string id = (string)row.Cells["_id"].Value;
                    //save this to the current profile
                    if (!hDefs.ContainsKey(id))
                    {
                        hDefs.Add(id, selectedColor);
                    }
                    else
                    {
                        hDefs[id] = selectedColor;
                    }

                    //color the row
                    row.DefaultCellStyle.BackColor = _colorDialog.Color;
                    //deselect the row
                    row.Selected = false;
                }

                //apply new highlighting definitions
                _dataSource.Profile.SetHighlightingDefinitions(hDefs);
                //deselect all rows
            }
        }
Exemple #3
0
        private void OkClick(object sender, EventArgs e)
        {
            if (_checkOptMemory.Checked)
            {
                TrafficViewerOptions.Instance.MemoryBufferSize  = 1;
                TrafficViewerOptions.Instance.EstimatedLineSize = 1024;
            }
            else
            {
                TrafficViewerOptions.Instance.EstimatedLineSize = 10240;
                TrafficViewerOptions.Instance.MemoryBufferSize  = 100;
            }

            TrafficViewerOptions.Instance.TrafficServerIp         = _boxIp.Text;
            TrafficViewerOptions.Instance.TrafficServerPort       = (int)_numProxyPort.Value;
            TrafficViewerOptions.Instance.TrafficServerPortSecure = (int)_numServerSecurePort.Value;

            //re-initialize the variable definitions so we can use the SetMultiValueOption method
            TrafficViewerOptions.Instance.VariableDefinitions = null;
            TrafficViewerOptions.Instance.SetMultiValueOption("VariableDefinitions", _gridVarDefs.GetValues());

            TrafficViewerOptions.Instance.SetDynamicElements(_gridDynElems.GetValues());
            //import at startup
            TrafficViewerOptions.Instance.StartupImport        = _fileAutoLoad.Text;
            TrafficViewerOptions.Instance.StartupImportProfile = _boxStartupProfile.Text;

            TrafficViewerOptions.Instance.ColorTextboxBackground = TVColorConverter.GetARGBString(
                _swatchBackground.Color);
            TrafficViewerOptions.Instance.ColorTextboxText = TVColorConverter.GetARGBString(
                _swatchTextColor.Color);
            TrafficViewerOptions.Instance.ColorDiffText = TVColorConverter.GetARGBString(
                _swatchDiffColor.Color);
            TrafficViewerOptions.Instance.ColorHighlight = TVColorConverter.GetARGBString(
                _swatchHighlightColor.Color);

            TrafficViewerOptions.Instance.SetExtensions(_extensionGrid.GetValues());

            TrafficViewerOptions.Instance.SetResponsePatterns(_gridResponsePatterns.GetValues());
            TrafficViewerOptions.Instance.SetSessionIdRegexes(_gridSessionIds.GetValues());


            if (_checkPrompt.Checked)
            {
                TrafficViewerOptions.Instance.ActionOnClose = (int)ConfirmCloseResult.Unknown;
            }


            TrafficViewerOptions.Instance.StartupParser = _boxStartupParser.SelectedItem as string;

            TrafficViewerOptions.Instance.HttpClientName = _boxHttpClient.SelectedItem as string;

            //http clients
            TrafficViewer.Instance.HttpClientFactory = TrafficViewer.Instance.HttpClientFactoryList[_boxHttpClient.SelectedIndex];


            TrafficViewerOptions.Instance.IgnoreInvalidSslCert = _checkIgnoreInvalidCert.Checked;

            TrafficViewerOptions.Instance.UseProxy = _checkUseProxy.Checked;


            TrafficViewerOptions.Instance.HttpProxyServer = _boxProxyHost.Text;
            TrafficViewerOptions.Instance.ProxyCert       = _proxyCertificate.Text;
            TrafficViewerOptions.Instance.ProxyCertPass   = _boxProxyCertPass.Text;

            TrafficViewerOptions.Instance.HttpProxyPort      = (int)_boxProxyPort.Value;
            TrafficViewerOptions.Instance.HttpRequestTimeout = (int)_boxTimeout.Value;
            TrafficViewerOptions.Instance.RequestDelay       = (int)_numericRequestDelay.Value;
            TrafficViewerOptions.Instance.RequestDelayFilter = _textRequestDelayFilter.Text;

            if (String.IsNullOrEmpty(TrafficViewerOptions.Instance.ForwardingHost) && !String.IsNullOrEmpty(_textForwardingHost.Text))
            {
                if (MessageBox.Show(Resources.WarnForwarding,
                                    Resources.Warning, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.No)
                {
                    _textForwardingHost.Text = String.Empty;
                }
            }

            TrafficViewerOptions.Instance.ForwardingHost = _textForwardingHost.Text;
            TrafficViewerOptions.Instance.ForwardingPort = (int)_numForwardingPort.Value;


            TrafficViewerOptions.Instance.Save();

            //TrafficViewer.Instance.LoadExtensions(); //this causes extensions added dynamically to be deleted

            //WarnRestartNeeded();
            TrafficViewer.InitSdkSettings();

            this.Hide();
        }