void LoadSettings() { // Load settings into form. LoggingTextBox.Text = SettingsManager.Options.LogText; SearchPattern = Encoding.ASCII.GetBytes(LoggingTextBox.Text); LoggingCheckBox.Checked = SettingsManager.Options.LogEnable; CacheDataWriteCheckBox.Checked = SettingsManager.Options.CacheDataWrite; CacheDataReadCheckBox.Checked = SettingsManager.Options.CacheDataRead; CacheDataGeneralizeCheckBox.Checked = SettingsManager.Options.CacheDataGeneralize; UpdateWinCapState(); var allowWinCap = SettingsManager.Options.UseWinCap & MainHelper.GetWinPcapVersion() != null; CaptureSocButton.Checked = !allowWinCap; CaptureWinButton.Checked = allowWinCap; // Update writer settings. SaveSettings(); // Attach events. LoggingTextBox.TextChanged += LoggingTextBox_TextChanged; LoggingCheckBox.CheckedChanged += LoggingCheckBox_CheckedChanged; CacheDataWriteCheckBox.CheckedChanged += CacheDataWriteCheckBox_CheckedChanged; CacheDataReadCheckBox.CheckedChanged += CacheDataReadCheckBox_CheckedChanged; CacheDataGeneralizeCheckBox.CheckedChanged += CacheDataGeneralizeCheckBox_CheckedChanged; LoggingPlaySoundCheckBox.CheckedChanged += LoggingPlaySoundCheckBox_CheckedChanged; CaptureSocButton.CheckedChanged += CaptureSocButton_CheckedChanged; CaptureWinButton.CheckedChanged += CaptureWinButton_CheckedChanged; EnumeratePlaybackDevices(); UpdatePlayBackDevice(); }
public void UpdateWinCapState() { var version = MainHelper.GetWinPcapVersion(); if (version != null) { CaptureWinButton.Text = string.Format("WinPcap {0}", version.ToString()); CaptureWinButton.Enabled = true; } else { CaptureWinButton.Text = "WinPcap"; CaptureWinButton.Enabled = false; } }