Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainForm"/> class.
        /// </summary>
        public MainForm()
        {
            this.InitializeComponent();
            var serviceContainer = new ServiceContainer();

            serviceContainer.AddService(typeof(ILoggerFactory), new NullLoggerFactory());
            this.plugInManager = new PlugInManager(null, new NullLoggerFactory(), serviceContainer);
            this.plugInManager.DiscoverAndRegisterPlugIns();
            this.clientBindingSource.DataSource        = this.proxiedConnections;
            this.connectedClientsListBox.DisplayMember = nameof(ICapturedConnection.Name);
            this.connectedClientsListBox.Update();

            this.clientVersionComboBox.SelectedIndexChanged += (_, __) =>
            {
                var listener = this.clientListener;
                if (listener != null)
                {
                    listener.ClientVersion = this.SelectedClientVersion;
                }
            };
            this.clientVersionComboBox.DataSource    = new BindingSource(this.clientVersions, null);
            this.clientVersionComboBox.DisplayMember = "Value";
            this.clientVersionComboBox.ValueMember   = "Key";

            this.analyzer  = new PacketAnalyzer();
            this.Disposed += (_, __) => this.analyzer.Dispose();

            this.targetHostTextBox.TextChanged += (_, __) =>
            {
                var listener = this.clientListener;
                if (listener != null)
                {
                    listener.TargetHost = this.targetHostTextBox.Text;
                }
            };
            this.targetPortNumericUpDown.ValueChanged += (_, __) =>
            {
                var listener = this.clientListener;
                if (listener != null)
                {
                    listener.TargetPort = (int)this.targetPortNumericUpDown.Value;
                }
            };
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainForm"/> class.
        /// </summary>
        public MainForm()
        {
            this.InitializeComponent();
            this.clientBindingSource.DataSource        = this.proxiedConnections;
            this.connectedClientsListBox.DisplayMember = nameof(ICapturedConnection.Name);
            this.connectedClientsListBox.Update();

            this.clientVersionComboBox.SelectedIndexChanged += (_, __) =>
            {
                var listener = this.clientListener;
                if (listener != null)
                {
                    listener.ClientVersion = this.SelectedClientVersion;
                }
            };
            this.clientVersionComboBox.DataSource    = new BindingSource(this.clientVersions, null);
            this.clientVersionComboBox.DisplayMember = "Value";
            this.clientVersionComboBox.ValueMember   = "Key";

            this.analyzer  = new PacketAnalyzer();
            this.Disposed += (_, __) => this.analyzer.Dispose();

            this.targetHostTextBox.TextChanged += (_, __) =>
            {
                var listener = this.clientListener;
                if (listener != null)
                {
                    listener.TargetHost = this.targetHostTextBox.Text;
                }
            };
            this.targetPortNumericUpDown.ValueChanged += (_, __) =>
            {
                var listener = this.clientListener;
                if (listener != null)
                {
                    listener.TargetPort = (int)this.targetPortNumericUpDown.Value;
                }
            };
        }