Exemple #1
0
        /// <summary>
        ///   Initializes a new instance of the <see cref = "Sniffer" /> class.
        /// </summary>
        public Sniffer(FormMain form)
        {
            m_form = form;

            m_form.cBSendTo.DataSource = new List <IdentifiedClient> {
                m_player, m_server
            };
            m_form.cBSendTo.DisplayMember = "Name";

            //m_form.cbMessageType.DataSource = MessageReceiver.GetMessages().ToList();

            _moduleProvider.LoadModules();
            AppDomain.CurrentDomain.GetAssemblies().ToDictionary(entry => entry.GetName().Name);

            MessageReceiver.Initialize();
            ProtocolTypeManager.Initialize();

            Port = DefaultPortToSniff;
            form.toolStripTextBoxPort.Text         = Port.ToString();
            form.toolStripTextBoxPort.TextChanged += (sender, e) =>
            {
                int port;
                if (int.TryParse(form.toolStripTextBoxPort.Text, out port))
                {
                    Port = port;
                }
                else
                {
                    form.toolStripTextBoxPort.Text = Port.ToString();
                }
            };
        }
        /// <summary>
        /// Start Marvin.Core, Start will load available modules and triggers
        /// MarvinInitialised when ready
        /// </summary>
        public void Start()
        {
            Console.Out.WriteLine("Marvin system starting");

            Modules = ModuleProvider.LoadModules();
            WireActions(Modules);
            Endpoints = CreateEndpoints();

            Console.Out.WriteLine("Marvin system ready for lift off");
            Initialised?.Invoke(this);
        }