Inheritance: ITeraSniffer
Esempio n. 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Logger.Clear();
            Logger.Log("Starting...");
            _settings = Settings.Load();
            Logger.Log("Settings loaded");
            _classIcons = new ClassIcons(_basicTeraData.ResourceDirectory + @"class-icons\", 36);

            _hotKeyManager = new HotKeyManager();
            _pasteStatsHotKey = new GlobalHotKey(_hotKeyManager);
            _pasteStatsHotKey.Pressed += PasteStatsMenuItem_Click;
            _resetHotKey = new GlobalHotKey(_hotKeyManager);
            _resetHotKey.Pressed += ResetButton_Click;

            _teraSniffer = new TeraSniffer(_basicTeraData.Servers);
            _teraSniffer.MessageReceived += message => InvokeAction(() => HandleMessageReceived(message));
            _teraSniffer.NewConnection += server => InvokeAction(() => HandleNewConnection(server));
            _teraSniffer.Warning += LogWarning;
            if (_settings.BufferSize != null)
            {
                Logger.Log(string.Format("Setting buffer size to {0}B", FormatHelpers.Invariant.FormatValue(_settings.BufferSize)));
                _teraSniffer.BufferSize = _settings.BufferSize.Value;
            }
            SettingsChanged();

            StartSniffing();
        }
Esempio n. 2
0
 public void Stop()
 {
     if (sniffer != null)
     {
         sniffer.Enabled = false;
         sniffer = null;
     }
 }
Esempio n. 3
0
        public void Start(ServerInfo server)
        {
            Stop();

            sniffer = new TeraSniffer(new List<ServerInfo> {server}); //dont want to change the external code ;)
            sniffer.MessageReceived += messageReceived;
            sniffer.NewConnection += newConnection;

            sniffer.Enabled = true;
        }
Esempio n. 4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            _classIcons = new ClassIcons(BasicTeraData.ResourceDirectory + @"class-icons\", 36);
            _teraSniffer = new TeraSniffer(BasicTeraData.Servers);
            _teraSniffer.MessageReceived += message => InvokeAction(() => HandleMessageReceived(message));
            _teraSniffer.NewConnection += server => InvokeAction(() => HandleNewConnection(server));

            _teraSniffer.Enabled = true;
            UpdateSettingsUi();
        }