예제 #1
0
        private void InitializeGUI()
        {
            _initializing = true;

            #region Detector settings container

            _modeStates[DetectorType.WFM] = Utils.GetIntArraySetting("wfmState", _defaultWFMState);
            _modeStates[DetectorType.NFM] = Utils.GetIntArraySetting("nfmState", _defaultNFMState);
            _modeStates[DetectorType.AM]  = Utils.GetIntArraySetting("amState",  _defaultAMState);
            _modeStates[DetectorType.LSB] = Utils.GetIntArraySetting("lsbState", _defaultSSBState);
            _modeStates[DetectorType.USB] = Utils.GetIntArraySetting("usbState", _defaultSSBState);
            _modeStates[DetectorType.DSB] = Utils.GetIntArraySetting("dsbState", _defaultDSBState);
            _modeStates[DetectorType.CW] = Utils.GetIntArraySetting("cwState", _defaultCWState);
            _modeStates[DetectorType.RAW] = Utils.GetIntArraySetting("rawState", _defaultRAWState);

            #endregion

            #region Tunning

            ThreadPool.QueueUserWorkItem(TuneThreadProc);

            #endregion

            #region Audio devices

            var defaultIndex = 0;
            var savedIndex = -1;
            var devices = AudioDevice.GetDevices(DeviceDirection.Input);
            var savedDeviceName = Utils.GetStringSetting("inputDevice", string.Empty);
            for (var i = 0; i < devices.Count; i++)
            {
                inputDeviceComboBox.Items.Add(devices[i]);
                if (devices[i].IsDefault)
                {
                    defaultIndex = i;
                }
                if (devices[i].ToString() == savedDeviceName)
                {
                    savedIndex = i;
                }
            }
            if (inputDeviceComboBox.Items.Count > 0)
            {
                inputDeviceComboBox.SelectedIndex = savedIndex >= 0 ? savedIndex : defaultIndex;
            }

            defaultIndex = 0;
            devices = AudioDevice.GetDevices(DeviceDirection.Output);
            savedDeviceName = Utils.GetStringSetting("outputDevice", string.Empty);
            for (int i = 0; i < devices.Count; i++)
            {
                outputDeviceComboBox.Items.Add(devices[i]);
                if (devices[i].IsDefault)
                {
                    defaultIndex = i;
                }
                if (devices[i].ToString() == savedDeviceName)
                {
                    savedIndex = i;
                }
            }
            if (outputDeviceComboBox.Items.Count > 0)
            {
                outputDeviceComboBox.SelectedIndex = savedIndex >= 0 ? savedIndex : defaultIndex;
            }

            _streamControl.BufferNeeded += ProcessBuffer;

            #endregion

            #region VFO

            DetectorType = (DetectorType) Utils.GetIntSetting("detectorType", (int) DetectorType.AM);
            modeRadioButton_CheckStateChanged(null, null);
            filterBandwidthNumericUpDown_ValueChanged(null, null);
            filterOrderNumericUpDown_ValueChanged(null, null);
            filterTypeComboBox_SelectedIndexChanged(null, null);
            cwShiftNumericUpDown_ValueChanged(null, null);

            agcCheckBox.Checked = Utils.GetBooleanSetting("useAGC");
            agcCheckBox_CheckedChanged(null, null);

            agcThresholdNumericUpDown.Value = Utils.GetIntSetting("agcThreshold", -100);
            agcThresholdNumericUpDown_ValueChanged(null, null);

            agcDecayNumericUpDown.Value = Utils.GetIntSetting("agcDecay", 100);
            agcDecayNumericUpDown_ValueChanged(null, null);

            agcSlopeNumericUpDown.Value = Utils.GetIntSetting("agcSlope", 0);
            agcSlopeNumericUpDown_ValueChanged(null, null);

            agcUseHangCheckBox.Checked = Utils.GetBooleanSetting("agcHang");
            agcUseHangCheckBox_CheckedChanged(null, null);

            SetCenterFrequency(0);

            frequencyShiftNumericUpDown.Value = Utils.GetLongSetting("frequencyShift", 0);
            frequencyShiftNumericUpDown_ValueChanged(null, null);

            frequencyShiftCheckBox.Checked = Utils.GetBooleanSetting("frequencyShiftEnabled");
            frequencyShiftCheckBox_CheckStateChanged(null, null);

            swapIQCheckBox.Checked = Utils.GetBooleanSetting("swapIQ");
            swapIQCheckBox_CheckedChanged(null, null);

            correctIQCheckBox.Checked = Utils.GetBooleanSetting("correctIQ");
            autoCorrectIQCheckBox_CheckStateChanged(null, null);

            markPeaksCheckBox.Checked = Utils.GetBooleanSetting("markPeaks");
            markPeaksCheckBox_CheckedChanged(null, null);

            fmStereoCheckBox.Checked = Utils.GetBooleanSetting("fmStereo");
            fmStereoCheckBox_CheckedChanged(null, null);

            filterAudioCheckBox.Checked = Utils.GetBooleanSetting("filterAudio");
            filterAudioCheckBox_CheckStateChanged(null, null);

            unityGainCheckBox.Checked = Utils.GetBooleanSetting("unityGain");
            unityGainCheckBox_CheckStateChanged(null, null);

            audioGainTrackBar.Value = Utils.GetIntSetting("audioGain", 30);
            audioGainTrackBar_ValueChanged(null, null);

            latencyNumericUpDown.Value = Utils.GetIntSetting("latency", 100);
            sampleRateComboBox.Text = Utils.GetStringSetting("sampleRate", "48000 sample/sec");

            WindowState = (FormWindowState) Utils.GetIntSetting("windowState", (int) FormWindowState.Normal);

            spectrumAnalyzer.SpectrumWidth = Utils.GetIntSetting("spectrumWidth", 48000);
            waterfall.SpectrumWidth = spectrumAnalyzer.SpectrumWidth;

            var locationArray = Utils.GetIntArraySetting("windowPosition", null);
            if (locationArray != null)
            {
                _lastLocation.X = locationArray[0];
                _lastLocation.Y = locationArray[1];
                Location = _lastLocation;
            }
            else
            {
                _lastLocation = Location;
            }

            var sizeArray = Utils.GetIntArraySetting("windowSize", null);
            if (sizeArray != null)
            {
                _lastSize.Width = sizeArray[0];
                _lastSize.Height = sizeArray[1];
                Size = _lastSize;
            }
            else
            {
                _lastSize = Size;
            }

            panSplitContainer.SplitterDistance = Utils.GetIntSetting("splitterPosition", panSplitContainer.SplitterDistance);
            
            #endregion

            #region FFT display

            _fftTimer = new System.Windows.Forms.Timer(components);
            _fftTimer.Tick += fftTimer_Tick;
            _fftTimer.Enabled = true;

            _performTimer = new System.Windows.Forms.Timer(components);
            _performTimer.Tick += performTimer_Tick;
            _performTimer.Interval = 40;
            _performTimer.Enabled = true;

            viewComboBox.SelectedIndex = Utils.GetIntSetting("fftView", 2);
            fftResolutionComboBox.SelectedIndex = Utils.GetIntSetting("fftResolution", 3);
            fftWindowComboBox.SelectedIndex = Utils.GetIntSetting("fftWindowType", (int) WindowType.BlackmanHarris4);
            filterTypeComboBox.SelectedIndex = Utils.GetIntSetting("filterType", (int) WindowType.BlackmanHarris4 - 1);
            
            fftSpeedTrackBar.Value = Utils.GetIntSetting("fftSpeed", 40);
            fftSpeedTrackBar_ValueChanged(null, null);

            fftContrastTrackBar.Value = Utils.GetIntSetting("fftContrast", 0);
            fftContrastTrackBar_Changed(null, null);

            spectrumAnalyzer.Attack = Utils.GetDoubleSetting("spectrumAnalyzerAttack", 0.9);
            sAttackTrackBar.Value = (int) (spectrumAnalyzer.Attack * sAttackTrackBar.Maximum);

            spectrumAnalyzer.Decay = Utils.GetDoubleSetting("spectrumAnalyzerDecay", 0.3);
            sDecayTrackBar.Value = (int) (spectrumAnalyzer.Decay * sDecayTrackBar.Maximum);

            waterfall.Attack = Utils.GetDoubleSetting("waterfallAttack", 0.9);
            wAttackTrackBar.Value = (int) (waterfall.Attack * wAttackTrackBar.Maximum);

            waterfall.Decay = Utils.GetDoubleSetting("waterfallDecay", 0.5);
            wDecayTrackBar.Value = (int) (waterfall.Decay * wDecayTrackBar.Maximum);

            useTimestampsCheckBox.Checked = Utils.GetBooleanSetting("useTimeMarkers");
            useTimestampCheckBox_CheckedChanged(null, null);

            fftOffsetTrackBar.Value = Utils.GetIntSetting("fftDisplayOffset", 0);
            fftOffsetTrackBar_Scroll(null, null);

            fftRangeTrackBar.Value = Utils.GetIntSetting("fftDisplayRange", 13);
            fftRangeTrackBar_Scroll(null, null);

            #endregion

            #region Initialize the plugins

            var frontendPlugins = (NameValueCollection) ConfigurationManager.GetSection("frontendPlugins");

            foreach (string key in frontendPlugins.Keys)
            {
                try
                {
                    var fullyQualifiedTypeName = frontendPlugins[key];
                    var patterns = fullyQualifiedTypeName.Split(',');
                    var typeName = patterns[0];
                    var assemblyName = patterns[1];
                    var objectHandle = Activator.CreateInstance(assemblyName, typeName);
                    var controller = (IFrontendController) objectHandle.Unwrap();
                    _frontendControllers.Add(key, controller);
                    iqSourceComboBox.Items.Add(key);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error loading '" + frontendPlugins[key] + "' - " + ex.Message);
                }
            }

            var extIOs = Directory.GetFiles(".", "ExtIO_*.dll");

            var dropDownWidth = iqSourceComboBox.Width;
            var graphics = iqSourceComboBox.CreateGraphics();

            foreach (var extIO in extIOs)
            {
                try
                {
                    var controller = new ExtIOController(extIO);
                    controller.HideSettingGUI();
                    var displayName = string.IsNullOrEmpty(ExtIO.HWName) ? "" + Path.GetFileName(extIO) : ExtIO.HWName;
                    if (!string.IsNullOrEmpty(ExtIO.HWModel))
                    {
                        displayName += " (" + ExtIO.HWModel + ")";
                    }
                    displayName += " - " + Path.GetFileName(extIO);
                    var size = graphics.MeasureString(displayName, iqSourceComboBox.Font);
                    if (size.Width > dropDownWidth)
                    {
                        dropDownWidth = (int)size.Width;
                    }
                    _frontendControllers.Add(displayName, controller);
                    iqSourceComboBox.Items.Add(displayName);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error loading '" + Path.GetFileName(extIO) + "'\r\n" + ex.Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }

            iqSourceComboBox.DropDownWidth = dropDownWidth;

            ExtIO.SampleRateChanged += ExtIO_SampleRateChanged;
            ExtIO.LOFreqChanged += ExtIO_LOFreqChanged;

            iqSourceComboBox.Items.Add("IQ file (*.wav)");

            iqSourceComboBox.Items.Add("Other (Sound card)");

            #endregion

            #region Source selection

            _waveFile = Utils.GetStringSetting("waveFile", string.Empty);
            var sourceIndex = Utils.GetIntSetting("iqSource", iqSourceComboBox.Items.Count - 1);
            iqSourceComboBox.SelectedIndex = sourceIndex < iqSourceComboBox.Items.Count ? sourceIndex : (iqSourceComboBox.Items.Count - 1);
            SetCenterFrequency(Utils.GetLongSetting("centerFrequency", _centerFrequency));
            var vfo = Utils.GetLongSetting("vfo", _centerFrequency);
            vfoFrequencyEdit.Frequency = vfo;

            #endregion

            _initializing = false;
        }
예제 #2
0
파일: MainForm.cs 프로젝트: zloiia/sdrsrc
 private void InitializeGUI()
 {
     this._initializing = true;
       this._modeStates[DetectorType.WFM] = Utils.GetIntArraySetting("wfmState", MainForm._defaultWFMState);
       this._modeStates[DetectorType.NFM] = Utils.GetIntArraySetting("nfmState", MainForm._defaultNFMState);
       this._modeStates[DetectorType.AM] = Utils.GetIntArraySetting("amState", MainForm._defaultAMState);
       this._modeStates[DetectorType.LSB] = Utils.GetIntArraySetting("lsbState", MainForm._defaultSSBState);
       this._modeStates[DetectorType.USB] = Utils.GetIntArraySetting("usbState", MainForm._defaultSSBState);
       this._modeStates[DetectorType.DSB] = Utils.GetIntArraySetting("dsbState", MainForm._defaultDSBState);
       this._modeStates[DetectorType.CW] = Utils.GetIntArraySetting("cwState", MainForm._defaultCWState);
       this._modeStates[DetectorType.RAW] = Utils.GetIntArraySetting("rawState", MainForm._defaultRAWState);
       ThreadPool.QueueUserWorkItem(new WaitCallback(this.TuneThreadProc));
       this.stepSizeComboBox.Items.AddRange((object[]) Utils.GetStringSetting("stepSizes", "1 Hz,10 Hz,100 Hz,500 Hz,1 kHz,2.5 kHz,5 kHz,6.25 kHz,7.5 kHz,8.33 kHz,9 kHz,10 kHz,12.5 kHz,15 kHz,20 kHz,25 kHz,30 kHz,50 kHz,100 kHz,150 kHz,200 kHz,250 kHz,300 kHz,350 kHz,400 kHz,450 kHz,500 kHz").Split(','));
       this._tuningStyle = (MainForm.TuningStyle) Utils.GetIntSetting("tuningStyle", 0);
       switch (this._tuningStyle)
       {
     case MainForm.TuningStyle.Free:
       this.centerButton.Image = (Image) Resources.free_tuning;
       this._tooltip.SetToolTip((Control) this.centerButton, "Free tuning");
       break;
     case MainForm.TuningStyle.Sticky:
       this.centerButton.Image = (Image) Resources.sticky;
       this._tooltip.SetToolTip((Control) this.centerButton, "Sticky tuning");
       break;
     case MainForm.TuningStyle.Center:
       this.centerButton.Image = (Image) Resources.center_24;
       this._tooltip.SetToolTip((Control) this.centerButton, "Center tuning");
       break;
       }
       int num1 = 0;
       int num2 = -1;
       List<AudioDevice> devices1 = AudioDevice.GetDevices(DeviceDirection.Input);
       string stringSetting1 = Utils.GetStringSetting("inputDevice", string.Empty);
       for (int index = 0; index < devices1.Count; ++index)
       {
     this.inputDeviceComboBox.Items.Add((object) devices1[index]);
     if (devices1[index].IsDefault)
       num1 = index;
     if (devices1[index].ToString() == stringSetting1)
       num2 = index;
       }
       if (this.inputDeviceComboBox.Items.Count > 0)
     this.inputDeviceComboBox.SelectedIndex = num2 >= 0 ? num2 : num1;
       int num3 = 0;
       List<AudioDevice> devices2 = AudioDevice.GetDevices(DeviceDirection.Output);
       string stringSetting2 = Utils.GetStringSetting("outputDevice", string.Empty);
       for (int index = 0; index < devices2.Count; ++index)
       {
     this.outputDeviceComboBox.Items.Add((object) devices2[index]);
     if (devices2[index].IsDefault)
       num3 = index;
     if (devices2[index].ToString() == stringSetting2)
       num2 = index;
       }
       if (this.outputDeviceComboBox.Items.Count > 0)
     this.outputDeviceComboBox.SelectedIndex = num2 >= 0 ? num2 : num3;
       this._streamControl.BufferNeeded += new BufferNeededDelegate(this.ProcessBuffer);
       this.DetectorType = (DetectorType) Utils.GetIntSetting("detectorType", 2);
       this.modeRadioButton_CheckStateChanged((object) null, (EventArgs) null);
       this.filterBandwidthNumericUpDown_ValueChanged((object) null, (EventArgs) null);
       this.filterOrderNumericUpDown_ValueChanged((object) null, (EventArgs) null);
       this.filterTypeComboBox_SelectedIndexChanged((object) null, (EventArgs) null);
       this.cwShiftNumericUpDown_ValueChanged((object) null, (EventArgs) null);
       this.agcCheckBox.Checked = Utils.GetBooleanSetting("useAGC");
       this.agcCheckBox_CheckedChanged((object) null, (EventArgs) null);
       this.agcThresholdNumericUpDown.Value = (Decimal) Utils.GetIntSetting("agcThreshold", -100);
       this.agcThresholdNumericUpDown_ValueChanged((object) null, (EventArgs) null);
       this.agcDecayNumericUpDown.Value = (Decimal) Utils.GetIntSetting("agcDecay", 100);
       this.agcDecayNumericUpDown_ValueChanged((object) null, (EventArgs) null);
       this.agcSlopeNumericUpDown.Value = (Decimal) Utils.GetIntSetting("agcSlope", 0);
       this.agcSlopeNumericUpDown_ValueChanged((object) null, (EventArgs) null);
       this.agcUseHangCheckBox.Checked = Utils.GetBooleanSetting("agcHang");
       this.agcUseHangCheckBox_CheckedChanged((object) null, (EventArgs) null);
       this.SetCenterFrequency(0L);
       this.frequencyShiftNumericUpDown.Value = (Decimal) Utils.GetLongSetting("frequencyShift", 0L);
       this.frequencyShiftNumericUpDown_ValueChanged((object) null, (EventArgs) null);
       this.frequencyShiftCheckBox.Checked = Utils.GetBooleanSetting("frequencyShiftEnabled");
       this.frequencyShiftCheckBox_CheckStateChanged((object) null, (EventArgs) null);
       this.swapIQCheckBox.Checked = Utils.GetBooleanSetting("swapIQ");
       this.swapIQCheckBox_CheckedChanged((object) null, (EventArgs) null);
       this.correctIQCheckBox.Checked = Utils.GetBooleanSetting("correctIQ");
       this.autoCorrectIQCheckBox_CheckStateChanged((object) null, (EventArgs) null);
       this.markPeaksCheckBox.Checked = Utils.GetBooleanSetting("markPeaks");
       this.markPeaksCheckBox_CheckedChanged((object) null, (EventArgs) null);
       this.fmStereoCheckBox.Checked = Utils.GetBooleanSetting("fmStereo");
       this.fmStereoCheckBox_CheckedChanged((object) null, (EventArgs) null);
       this.filterAudioCheckBox.Checked = Utils.GetBooleanSetting("filterAudio");
       this.filterAudioCheckBox_CheckStateChanged((object) null, (EventArgs) null);
       this.unityGainCheckBox.Checked = Utils.GetBooleanSetting("unityGain");
       this.unityGainCheckBox_CheckStateChanged((object) null, (EventArgs) null);
       this.audioGainTrackBar.Value = Utils.GetIntSetting("audioGain", 50);
       this.audioGainTrackBar_ValueChanged((object) null, (EventArgs) null);
       this._vfo.Muted = Utils.GetBooleanSetting("AudioIsMuted");
       this.UpdateMuteButton();
       this.latencyNumericUpDown.Value = (Decimal) Utils.GetIntSetting("latency", 100);
       this.sampleRateComboBox.Text = Utils.GetStringSetting("sampleRate", "48000 sample/sec");
       this.WindowState = (FormWindowState) Utils.GetIntSetting("windowState", 0);
       this.spectrumAnalyzer.SpectrumWidth = Utils.GetIntSetting("spectrumWidth", 48000);
       this.waterfall.SpectrumWidth = this.spectrumAnalyzer.SpectrumWidth;
       this.lockCarrierCheckBox.Checked = Utils.GetBooleanSetting("lockCarrier");
       this.lockCarrierCheckBox_CheckedChanged((object) null, (EventArgs) null);
       this.useAntiFadingCheckBox.Checked = Utils.GetBooleanSetting("useAntiFading");
       this.useAntiFadingCheckBox_CheckedChanged((object) null, (EventArgs) null);
       int[] intArraySetting1 = Utils.GetIntArraySetting("windowPosition", (int[]) null);
       if (intArraySetting1 != null)
       {
     this._lastLocation.X = intArraySetting1[0];
     this._lastLocation.Y = intArraySetting1[1];
     this.Location = this._lastLocation;
       }
       else
     this._lastLocation = this.Location;
       int[] intArraySetting2 = Utils.GetIntArraySetting("windowSize", (int[]) null);
       if (intArraySetting2 != null)
       {
     this._lastSize.Width = intArraySetting2[0];
     this._lastSize.Height = intArraySetting2[1];
     this.Size = this._lastSize;
       }
       else
     this._lastSize = this.Size;
       this.spectrumSplitter.SplitPosition = Utils.GetIntSetting("splitterPosition", this.spectrumSplitter.SplitPosition);
       this._fftTimer = new System.Windows.Forms.Timer(this.components);
       this._fftTimer.Tick += new EventHandler(this.fftTimer_Tick);
       this._fftTimer.Enabled = true;
       this.viewComboBox.SelectedIndex = Utils.GetIntSetting("fftView", 2);
       this.fftResolutionComboBox.SelectedIndex = Utils.GetIntSetting("fftResolution", 6);
       this.fftWindowComboBox.SelectedIndex = Utils.GetIntSetting("fftWindowType", 3);
       this.spectrumStyleComboBox.SelectedIndex = Utils.GetIntSetting("spectrumStyle", 3);
       this.spectrumStyleComboBox_SelectedIndexChanged((object) null, (EventArgs) null);
       this.fftSpeedTrackBar.Value = Utils.GetIntSetting("fftSpeed", 40);
       this.fftSpeedTrackBar_ValueChanged((object) null, (EventArgs) null);
       this.fftContrastTrackBar.Value = Utils.GetIntSetting("fftContrast", 0);
       this.fftContrastTrackBar_Changed((object) null, (EventArgs) null);
       this.spectrumAnalyzer.Attack = (float) Utils.GetDoubleSetting("spectrumAnalyzerAttack", 0.9);
       this.sAttackTrackBar.Value = (int) ((double) this.spectrumAnalyzer.Attack * (double) this.sAttackTrackBar.Maximum);
       this.spectrumAnalyzer.Decay = (float) Utils.GetDoubleSetting("spectrumAnalyzerDecay", 0.3);
       this.sDecayTrackBar.Value = (int) ((double) this.spectrumAnalyzer.Decay * (double) this.sDecayTrackBar.Maximum);
       this.waterfall.Attack = (float) Utils.GetDoubleSetting("waterfallAttack", 0.9);
       this.wAttackTrackBar.Value = (int) ((double) this.waterfall.Attack * (double) this.wAttackTrackBar.Maximum);
       this.waterfall.Decay = (float) Utils.GetDoubleSetting("waterfallDecay", 0.5);
       this.wDecayTrackBar.Value = (int) ((double) this.waterfall.Decay * (double) this.wDecayTrackBar.Maximum);
       this.useTimestampsCheckBox.Checked = Utils.GetBooleanSetting("useTimeMarkers");
       this.useTimestampCheckBox_CheckedChanged((object) null, (EventArgs) null);
       this.fftOffsetTrackBar.Value = Utils.GetIntSetting("fftDisplayOffset", 0);
       this.fftOffsetTrackBar_Scroll((object) null, (EventArgs) null);
       this.fftRangeTrackBar.Value = Utils.GetIntSetting("fftDisplayRange", 13);
       this.fftRangeTrackBar_Scroll((object) null, (EventArgs) null);
       NameValueCollection nameValueCollection = (NameValueCollection) ConfigurationManager.GetSection("frontendPlugins");
       foreach (string key in nameValueCollection.Keys)
       {
     try
     {
       string[] strArray = nameValueCollection[key].Split(',');
       string typeName = strArray[0];
       IFrontendController frontendController = (IFrontendController) Activator.CreateInstance(strArray[1], typeName).Unwrap();
       ISampleRateChangeSource rateChangeSource = frontendController as ISampleRateChangeSource;
       IControlAwareObject controlAwareObject = frontendController as IControlAwareObject;
       if (rateChangeSource != null)
     rateChangeSource.SampleRateChanged += new EventHandler(this.frontendController_SampleRateChanged);
       if (controlAwareObject != null)
     controlAwareObject.Control = (object) this._sharpControlProxy;
       this._frontendControllers.Add(key, frontendController);
       this.iqSourceComboBox.Items.Add((object) key);
     }
     catch (Exception ex)
     {
       int num4 = (int) MessageBox.Show("Error loading '" + nameValueCollection[key] + "' - " + ex.Message);
     }
       }
       string[] files = Directory.GetFiles(".", "ExtIO_*.dll");
       int num5 = this.iqSourceComboBox.Width;
       Graphics graphics = this.iqSourceComboBox.CreateGraphics();
       foreach (string str1 in files)
       {
     try
     {
       ExtIOController extIoController = new ExtIOController(str1);
       extIoController.HideSettingGUI();
       string str2 = string.IsNullOrEmpty(ExtIO.HWName) ? Path.GetFileName(str1) ?? "" : ExtIO.HWName;
       if (!string.IsNullOrEmpty(ExtIO.HWModel))
     str2 = str2 + " (" + ExtIO.HWModel + ")";
       string str3 = str2 + " - " + Path.GetFileName(str1);
       SizeF sizeF = graphics.MeasureString(str3, this.iqSourceComboBox.Font);
       if ((double) sizeF.Width > (double) num5)
     num5 = (int) sizeF.Width;
       this._frontendControllers.Add(str3, (IFrontendController) extIoController);
       this.iqSourceComboBox.Items.Add((object) str3);
     }
     catch (Exception ex)
     {
       int num4 = (int) MessageBox.Show("Error loading '" + Path.GetFileName(str1) + "'\r\n" + ex.Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
       }
       this.iqSourceComboBox.DropDownWidth = num5;
       ExtIO.SampleRateChanged += new SampleRateChangedDelegate(this.ExtIO_SampleRateChanged);
       ExtIO.LOFreqChanged += new LOFrequencyChangedDelegate(this.ExtIO_LOFreqChanged);
       this.iqSourceComboBox.Items.Add((object) "IQ file (*.wav)");
       this.iqSourceComboBox.Items.Add((object) "Other (Sound card)");
       this._waveFile = Utils.GetStringSetting("waveFile", string.Empty);
       int intSetting = Utils.GetIntSetting("iqSource", this.iqSourceComboBox.Items.Count - 1);
       this.iqSourceComboBox.SelectedIndex = intSetting < this.iqSourceComboBox.Items.Count ? intSetting : this.iqSourceComboBox.Items.Count - 1;
       this.SetCenterFrequency(Utils.GetLongSetting("centerFrequency", this._centerFrequency));
       this.vfoFrequencyEdit.Frequency = Utils.GetLongSetting("vfo", this._centerFrequency);
       this._tooltip.SetToolTip((Control) this.playStopButton, "Start");
       bool flag = !Utils.GetBooleanSetting("menuIsHidden");
       this.scrollPanel.Visible = flag;
       this.menuSpacerPanel.Visible = flag;
       this._tooltip.SetToolTip((Control) this.toggleMenuButton, "Menu");
       this._initializing = false;
 }