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();
        }