Пример #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();
        }
Пример #2
0
 internal void RemoveHotKeyHandle(GlobalHotKey hotKey, GlobalHotKeyHandle handle)
 {
     _hotkeyHandlesById.Remove(handle.Id);
     _hotkeysById.Remove(handle.Id);
 }
Пример #3
0
 internal GlobalHotKeyHandle CreateHotKeyHandle(GlobalHotKey hotkey, KeyModifiers fsModifiers, uint vk)
 {
     var id = CreateId();
     var result = new GlobalHotKeyHandle(HWnd, id, fsModifiers, vk);
     _hotkeyHandlesById.Add(id, result);
     _hotkeysById[id] = hotkey;
     return result;
 }