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(); }
private void Form1_Load(object sender, EventArgs e) { Logger.Log("Form created"); _settings = Settings.Load(); Logger.Log("Settings loaded"); _classIcons = new ClassIcons(_basicTeraData.ResourceDirectory + @"class-icons\", 36); _toolTip.ShowAlways = true; _hotKeyManager = new HotKeyManager(); _pasteStatsHotKey = new GlobalHotKey(_hotKeyManager); _pasteStatsHotKey.Pressed += PasteStatsMenuItem_Click; _resetHotKey = new GlobalHotKey(_hotKeyManager); _resetHotKey.Pressed += ResetButton_Click; _teraSniffer = new TeraSniffer(_basicTeraData.Servers, _settings.UseRaw); _teraSniffer.MessageReceived += message => InvokeAction(() => HandleMessageReceived(message)); _teraSniffer.NewConnection += server => InvokeAction(() => HandleNewConnection(server)); _teraSniffer.Warning += LogWarning; _teraSniffer.BufferSize = _settings.BufferSize; Logger.Log(string.Format("Setting buffer size to {0}B", FormatHelpers.Invariant.FormatValue(_settings.BufferSize) ?? "Default")); SettingsChanged(); StartSniffing(); }
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)); SettingsChanged(); Logger.Log("Starting sniffing..."); _teraSniffer.Enabled = true; Logger.Log("Sniffing started"); }
public GlobalHotKey(HotKeyManager manager) { _manager = manager; _manager._hotkeys.Add(this); }