Exemple #1
0
        private static void ExternTool_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            int argInfo  = (int)e.ClickedItem.Tag;
            int toolInfo = (int)e.ClickedItem.OwnerItem.Tag;

            if (toolInfo < 0 || argInfo < -1)
            {
                return;
            }

            Process    process = new Process();
            ExternTool tool    = FiddlerOptions.ExternTools[toolInfo];

            process.StartInfo.FileName = tool.FileName;
            if (argInfo >= 0)
            {
                process.StartInfo.Arguments = tool.Args[argInfo];
            }

            try
            {
                process.Start();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error starting tool",
                                MessageBoxButtons.OK, MessageBoxIcon.Error,
                                MessageBoxDefaultButton.Button1);
            }
        }
Exemple #2
0
        private void OnToolIndexChanged(object sender, EventArgs e)
        {
            if (listBoxTools.SelectedIndex >= 0)
            {
                listBoxArgs.BeginUpdate();
                listBoxArgs.Items.Clear();
                ExternTool tool = FiddlerOptions.ExternTools[listBoxTools.SelectedIndex];
                for (int i = 0; i < tool.Args.Count; i++)
                {
                    listBoxArgs.Items.Add(i);
                }
                listBoxArgs.EndUpdate();
                textBoxToolName.Text = tool.Name;
                textBoxToolFile.Text = tool.FileName;
                textBoxArgName.Text  = "";
                textBoxArgParam.Text = "";
            }
            else
            {
                textBoxToolName.Text = "";
                textBoxToolFile.Text = "";
            }

            listBoxTools.Invalidate();
        }
Exemple #3
0
        private void OnClickSaveTool(object sender, EventArgs e)
        {
            if (listBoxTools.SelectedIndex < 0)
            {
                return;
            }

            ExternTool tool = FiddlerOptions.ExternTools[listBoxTools.SelectedIndex];

            tool.Name     = textBoxToolName.Text;
            tool.FileName = textBoxToolFile.Text;
            listBoxTools.Invalidate();
        }
Exemple #4
0
        private void OnAddArg(object sender, EventArgs e)
        {
            if (listBoxTools.SelectedIndex < 0)
            {
                return;
            }

            ExternTool tool = FiddlerOptions.ExternTools[listBoxTools.SelectedIndex];

            tool.Args.Add(textBoxArgParam.Text);
            tool.ArgsName.Add(textBoxArgName.Text);
            listBoxArgs.Items.Add(tool.Args.Count - 1);
            listBoxArgs.SelectedIndex = tool.Args.Count - 1;
        }
Exemple #5
0
 private void OnArgIndexChanged(object sender, EventArgs e)
 {
     if (listBoxArgs.SelectedIndex >= 0)
     {
         ExternTool tool = FiddlerOptions.ExternTools[listBoxTools.SelectedIndex];
         textBoxArgName.Text  = tool.ArgsName[listBoxArgs.SelectedIndex];
         textBoxArgParam.Text = tool.Args[listBoxArgs.SelectedIndex];
     }
     else
     {
         textBoxArgName.Text  = "";
         textBoxArgParam.Text = "";
     }
     listBoxArgs.Invalidate();
 }
Exemple #6
0
        /// <summary>
        /// Reloads the Extern Tools DropDown <see cref="FiddlerOptions.ExternTools"/>
        /// </summary>
        public static void LoadExternToolStripMenu()
        {
            _refMarker.ExternToolsDropDown.DropDownItems.Clear();
            ToolStripMenuItem item = new ToolStripMenuItem
            {
                Text = "Manage.."
            };

            item.Click += _refMarker.OnClickToolManage;

            _refMarker.ExternToolsDropDown.DropDownItems.Add(item);
            _refMarker.ExternToolsDropDown.DropDownItems.Add(new ToolStripSeparator());

            if (FiddlerOptions.ExternTools is null)
            {
                return;
            }

            for (int i = 0; i < FiddlerOptions.ExternTools.Count; i++)
            {
                ExternTool tool = FiddlerOptions.ExternTools[i];
                item = new ToolStripMenuItem
                {
                    Text = tool.Name,
                    Tag  = i
                };
                item.DropDownItemClicked += ExternTool_ItemClicked;

                ToolStripMenuItem sub = new ToolStripMenuItem
                {
                    Text = "Start",
                    Tag  = -1
                };
                item.DropDownItems.Add(sub);
                item.DropDownItems.Add(new ToolStripSeparator());
                for (int j = 0; j < tool.Args.Count; j++)
                {
                    ToolStripMenuItem arg = new ToolStripMenuItem
                    {
                        Text = tool.ArgsName[j],
                        Tag  = j
                    };
                    item.DropDownItems.Add(arg);
                }
                _refMarker.ExternToolsDropDown.DropDownItems.Add(item);
            }
        }
Exemple #7
0
        private void OnClickSaveArg(object sender, EventArgs e)
        {
            if (listBoxTools.SelectedIndex < 0)
            {
                return;
            }

            ExternTool tool = FiddlerOptions.ExternTools[listBoxTools.SelectedIndex];

            if (listBoxArgs.SelectedIndex < 0)
            {
                return;
            }

            tool.Args[listBoxArgs.SelectedIndex]     = textBoxArgParam.Text;
            tool.ArgsName[listBoxArgs.SelectedIndex] = textBoxArgName.Text;
            listBoxArgs.Invalidate();
        }
Exemple #8
0
        private void OnClickRemoveArg(object sender, EventArgs e)
        {
            if (listBoxTools.SelectedIndex < 0 || listBoxArgs.SelectedIndex < 0)
            {
                return;
            }

            ExternTool tool = FiddlerOptions.ExternTools[listBoxTools.SelectedIndex];

            tool.Args.RemoveAt(listBoxArgs.SelectedIndex);
            tool.ArgsName.RemoveAt(listBoxArgs.SelectedIndex);
            listBoxArgs.BeginUpdate();
            listBoxArgs.Items.Clear();
            for (int i = 0; i < tool.Args.Count; i++)
            {
                listBoxArgs.Items.Add(i);
            }
            listBoxArgs.EndUpdate();
            listBoxArgs.Invalidate();
            textBoxArgName.Text  = "";
            textBoxArgParam.Text = "";
        }