SDRSharper (SDRSharp Remake) Full Source (VS2017)

SDRSharper (SDRSharp Remake) Full Source (VS2017)
This commit is contained in:
SDRSharpR 2018-03-26 14:02:05 -07:00
parent 15020c6fd1
commit c07e6e6034
494 changed files with 310729 additions and 0 deletions

BIN
Build Config Orig.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View file

@ -0,0 +1,21 @@
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security.Permissions;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SDR#")]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyTrademark("")]
[assembly: CompilationRelaxations(8)]
[assembly: AssemblyDescription("IAudioInterceptor Test Plugin")]
[assembly: ComVisible(false)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("AudioInterceptorTest")]
[assembly: AssemblyCopyright("Copyright © Youssef TOUIL and Ian Gilmour 2013")]
[assembly: Guid("dfd7918b-ff74-4825-a628-ac37c85d5e9f")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]

View file

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{80F6534B-F628-4C68-9A35-828F79F8F034}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<OutputType>Library</OutputType>
<AssemblyName>SDRSharp.DNR</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'x86' ">
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>bin\Debug\</OutputPath>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>bin\Release\</OutputPath>
<DebugSymbols>true</DebugSymbols>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
</PropertyGroup>
<ItemGroup>
<Reference Include="SDRSharp.Radio">
<HintPath>C:\Users\James\Downloads\RTL-SDR Stuff\SDRSharper_06l\SDRSharp.Radio.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms">
<HintPath>C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll</HintPath>
</Reference>
<Reference Include="SDRSharp.Common">
<HintPath>C:\Users\James\Downloads\RTL-SDR Stuff\SDRSharper_06l\SDRSharp.Common.dll</HintPath>
</Reference>
<Reference Include="System">
<HintPath>C:\Windows\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll</HintPath>
</Reference>
<Reference Include="System.Drawing">
<HintPath>C:\Windows\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SDRSharp.DNR\AudioProcessor.cs" />
<Compile Include="SDRSharp.DNR\DNRPlugin.cs" />
<Compile Include="SDRSharp.DNR\IFProcessor.cs" />
<Compile Include="SDRSharp.DNR\INoiseProcessor.cs" />
<Compile Include="SDRSharp.DNR\NoiseFilter.cs" />
<Compile Include="SDRSharp.DNR\ProcessorPanel.cs">
<SubType>UserControl</SubType>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View file

@ -0,0 +1,62 @@
using SDRSharp.Radio;
namespace SDRSharp.DNR
{
public class AudioProcessor : INoiseProcessor, IRealProcessor, IBaseProcessor
{
private double _sampleRate;
private bool _enabled;
private NoiseFilter _filter1;
private NoiseFilter _filter2;
private bool _needNewFilters;
public double SampleRate
{
get
{
return this._sampleRate;
}
set
{
this._sampleRate = value;
this._needNewFilters = true;
}
}
public bool Enabled
{
get
{
return this._enabled;
}
set
{
this._enabled = value;
}
}
public int NoiseThreshold
{
get;
set;
}
public unsafe void Process(float* buffer, int length)
{
if (this._needNewFilters)
{
this._filter1 = new NoiseFilter(4096);
this._filter2 = new NoiseFilter(4096);
this._needNewFilters = false;
}
this._filter1.NoiseThreshold = (float)this.NoiseThreshold;
this._filter2.NoiseThreshold = (float)this.NoiseThreshold;
this._filter1.Process(buffer, length, 2);
this._filter2.Process(buffer + 1, length, 2);
}
}
}

View file

@ -0,0 +1,47 @@
using SDRSharp.Common;
using SDRSharp.Radio;
using System.Windows.Forms;
namespace SDRSharp.DNR
{
public class DNRPlugin : ISharpPlugin
{
private const string _displayName = "Digital Noise Reduction";
private ISharpControl _control;
private AudioProcessor _audioProcessor;
private IFProcessor _ifProcessor;
private ProcessorPanel _guiControl;
public string DisplayName => "Digital Noise Reduction";
public bool HasGui => true;
public UserControl GuiControl => this._guiControl;
public void Initialize(ISharpControl control)
{
this._control = control;
this._audioProcessor = new AudioProcessor();
this._control.RegisterStreamHook(this._audioProcessor, ProcessorType.FilteredAudioOutput);
this._ifProcessor = new IFProcessor();
this._control.RegisterStreamHook(this._ifProcessor, ProcessorType.DecimatedAndFilteredIQ);
this._ifProcessor.NoiseThreshold = Utils.GetIntSetting("DNRIThreshold", -30);
this._ifProcessor.Enabled = Utils.GetBooleanSetting("DNRIEnabled");
this._audioProcessor.NoiseThreshold = Utils.GetIntSetting("DNRAThreshold", -70);
this._audioProcessor.Enabled = Utils.GetBooleanSetting("DNRAEnabled");
this._guiControl = new ProcessorPanel(this._ifProcessor, this._audioProcessor);
}
public void Close()
{
Utils.SaveSetting("DNRIThreshold", this._ifProcessor.NoiseThreshold);
Utils.SaveSetting("DNRIEnabled", this._ifProcessor.Enabled);
Utils.SaveSetting("DNRAThreshold", this._audioProcessor.NoiseThreshold);
Utils.SaveSetting("DNRAEnabled", this._audioProcessor.Enabled);
}
}
}

View file

@ -0,0 +1,57 @@
using SDRSharp.Radio;
namespace SDRSharp.DNR
{
public class IFProcessor : INoiseProcessor, IIQProcessor, IBaseProcessor
{
private double _sampleRate;
private bool _enabled;
private NoiseFilter _filter;
private bool _needNewFilter;
public double SampleRate
{
get
{
return this._sampleRate;
}
set
{
this._sampleRate = value;
this._needNewFilter = true;
}
}
public bool Enabled
{
get
{
return this._enabled;
}
set
{
this._enabled = value;
}
}
public int NoiseThreshold
{
get;
set;
}
public unsafe void Process(Complex* buffer, int length)
{
if (this._needNewFilter)
{
this._filter = new NoiseFilter(4096);
this._needNewFilter = false;
}
this._filter.NoiseThreshold = (float)this.NoiseThreshold;
this._filter.Process(buffer, length);
}
}
}

View file

@ -0,0 +1,13 @@
using SDRSharp.Radio;
namespace SDRSharp.DNR
{
public interface INoiseProcessor : IBaseProcessor
{
int NoiseThreshold
{
get;
set;
}
}
}

View file

@ -0,0 +1,82 @@
using SDRSharp.Radio;
namespace SDRSharp.DNR
{
public class NoiseFilter : FftProcessor
{
private const int WindowSize = 32;
private const int FftSize = 4096;
private const float OverlapRatio = 0.2f;
private float _noiseThreshold;
private readonly UnsafeBuffer _gainBuffer;
private unsafe readonly float* _gainPtr;
private readonly UnsafeBuffer _smoothedGainBuffer;
private unsafe readonly float* _smoothedGainPtr;
private readonly UnsafeBuffer _powerBuffer;
private unsafe readonly float* _powerPtr;
public float NoiseThreshold
{
get
{
return this._noiseThreshold;
}
set
{
this._noiseThreshold = value;
}
}
public unsafe NoiseFilter(int fftSize = 4096)
: base(fftSize, 0.2f)
{
this._gainBuffer = UnsafeBuffer.Create(fftSize, 4);
this._gainPtr = (float*)(void*)this._gainBuffer;
this._smoothedGainBuffer = UnsafeBuffer.Create(fftSize, 4);
this._smoothedGainPtr = (float*)(void*)this._smoothedGainBuffer;
this._powerBuffer = UnsafeBuffer.Create(fftSize, 4);
this._powerPtr = (float*)(void*)this._powerBuffer;
}
protected unsafe override void ProcessFft(Complex* buffer, int length)
{
Fourier.SpectrumPower(buffer, this._powerPtr, length, 0f, false);
for (int i = 0; i < length; i++)
{
this._gainPtr[i] = ((this._powerPtr[i] > this._noiseThreshold) ? 1f : 0f);
}
for (int j = 0; j < length; j++)
{
float num = 0f;
for (int k = -16; k < 16; k++)
{
int num2 = j + k;
if (num2 >= length)
{
num2 -= length;
}
if (num2 < 0)
{
num2 += length;
}
num += this._gainPtr[num2];
}
float num3 = num / 32f;
this._smoothedGainPtr[j] = num3;
}
for (int l = 0; l < length; l++)
{
Complex.Mul(ref buffer[l], this._smoothedGainPtr[l]);
}
}
}
}

View file

@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace SDRSharp.DNR {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class ProcessorPanel {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
private IFProcessor _ifProcessor;
private AudioProcessor _audioProcessor;
public ProcessorPanel(IFProcessor ifProcessor, AudioProcessor audioProcessor)
{
_ifProcessor = ifProcessor;
_audioProcessor = audioProcessor;
}
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal ProcessorPanel() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SDRSharp.DNR.ProcessorPanel", typeof(ProcessorPanel).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

View file

@ -0,0 +1,181 @@
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace SDRSharp.DNR
{
public class ProcessorPanel : UserControl
{
private IContainer components;
private CheckBox ifEnableCheckBox;
private GroupBox groupBox1;
private Label ifThresholdLabel;
private TrackBar ifThresholdTrackBar;
private GroupBox groupBox2;
private Label audioThresholdLabel;
private TrackBar audioThresholdTrackBar;
private CheckBox audioEnableCheckBox;
private INoiseProcessor _aControl;
private INoiseProcessor _iControl;
protected override void Dispose(bool disposing)
{
if (disposing && this.components != null)
{
this.components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.ifEnableCheckBox = new CheckBox();
this.groupBox1 = new GroupBox();
this.ifThresholdLabel = new Label();
this.ifThresholdTrackBar = new TrackBar();
this.groupBox2 = new GroupBox();
this.audioThresholdLabel = new Label();
this.audioThresholdTrackBar = new TrackBar();
this.audioEnableCheckBox = new CheckBox();
this.groupBox1.SuspendLayout();
((ISupportInitialize)this.ifThresholdTrackBar).BeginInit();
this.groupBox2.SuspendLayout();
((ISupportInitialize)this.audioThresholdTrackBar).BeginInit();
base.SuspendLayout();
this.ifEnableCheckBox.Anchor = AnchorStyles.Top;
this.ifEnableCheckBox.AutoSize = true;
this.ifEnableCheckBox.Location = new Point(6, 19);
this.ifEnableCheckBox.Name = "ifEnableCheckBox";
this.ifEnableCheckBox.RightToLeft = RightToLeft.Yes;
this.ifEnableCheckBox.Size = new Size(65, 17);
this.ifEnableCheckBox.TabIndex = 4;
this.ifEnableCheckBox.Text = "Enabled";
this.ifEnableCheckBox.UseVisualStyleBackColor = true;
this.ifEnableCheckBox.CheckedChanged += this.ifEnableCheckBox_CheckedChanged;
this.groupBox1.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
this.groupBox1.Controls.Add(this.ifThresholdLabel);
this.groupBox1.Controls.Add(this.ifThresholdTrackBar);
this.groupBox1.Controls.Add(this.ifEnableCheckBox);
this.groupBox1.Location = new Point(0, 0);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new Size(204, 100);
this.groupBox1.TabIndex = 7;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "IF";
this.ifThresholdLabel.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
this.ifThresholdLabel.Location = new Point(111, 15);
this.ifThresholdLabel.Name = "ifThresholdLabel";
this.ifThresholdLabel.Size = new Size(87, 23);
this.ifThresholdLabel.TabIndex = 6;
this.ifThresholdLabel.Text = "-5 dB";
this.ifThresholdLabel.TextAlign = ContentAlignment.MiddleRight;
this.ifThresholdTrackBar.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
this.ifThresholdTrackBar.Location = new Point(3, 40);
this.ifThresholdTrackBar.Maximum = 20;
this.ifThresholdTrackBar.Minimum = -80;
this.ifThresholdTrackBar.Name = "ifThresholdTrackBar";
this.ifThresholdTrackBar.Size = new Size(198, 45);
this.ifThresholdTrackBar.TabIndex = 5;
this.ifThresholdTrackBar.TickFrequency = 5;
this.ifThresholdTrackBar.Value = -30;
this.ifThresholdTrackBar.Scroll += this.ifThresholdTrackBar_Scroll;
this.groupBox2.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
this.groupBox2.Controls.Add(this.audioThresholdLabel);
this.groupBox2.Controls.Add(this.audioThresholdTrackBar);
this.groupBox2.Controls.Add(this.audioEnableCheckBox);
this.groupBox2.Location = new Point(0, 102);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new Size(204, 100);
this.groupBox2.TabIndex = 8;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Audio";
this.audioThresholdLabel.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
this.audioThresholdLabel.Location = new Point(111, 15);
this.audioThresholdLabel.Name = "audioThresholdLabel";
this.audioThresholdLabel.Size = new Size(87, 23);
this.audioThresholdLabel.TabIndex = 6;
this.audioThresholdLabel.Text = "-5 dB";
this.audioThresholdLabel.TextAlign = ContentAlignment.MiddleRight;
this.audioThresholdTrackBar.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
this.audioThresholdTrackBar.Location = new Point(3, 40);
this.audioThresholdTrackBar.Maximum = -20;
this.audioThresholdTrackBar.Minimum = -120;
this.audioThresholdTrackBar.Name = "audioThresholdTrackBar";
this.audioThresholdTrackBar.Size = new Size(198, 45);
this.audioThresholdTrackBar.TabIndex = 5;
this.audioThresholdTrackBar.TickFrequency = 5;
this.audioThresholdTrackBar.Value = -70;
this.audioThresholdTrackBar.Scroll += this.audioThresholdTrackBar_Scroll;
this.audioEnableCheckBox.Anchor = AnchorStyles.Top;
this.audioEnableCheckBox.AutoSize = true;
this.audioEnableCheckBox.Location = new Point(6, 19);
this.audioEnableCheckBox.Name = "audioEnableCheckBox";
this.audioEnableCheckBox.RightToLeft = RightToLeft.Yes;
this.audioEnableCheckBox.Size = new Size(65, 17);
this.audioEnableCheckBox.TabIndex = 4;
this.audioEnableCheckBox.Text = "Enabled";
this.audioEnableCheckBox.UseVisualStyleBackColor = true;
this.audioEnableCheckBox.CheckedChanged += this.audioEnableCheckbox_CheckedChanged;
this.BackColor = SystemColors.ControlLight;
base.Controls.Add(this.groupBox2);
base.Controls.Add(this.groupBox1);
base.Name = "ProcessorPanel";
base.Size = new Size(204, 227);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
((ISupportInitialize)this.ifThresholdTrackBar).EndInit();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
((ISupportInitialize)this.audioThresholdTrackBar).EndInit();
base.ResumeLayout(false);
}
public ProcessorPanel(INoiseProcessor iControl, INoiseProcessor aControl)
{
this._iControl = iControl;
this._aControl = aControl;
this.InitializeComponent();
this.ifThresholdTrackBar.Value = this._iControl.NoiseThreshold;
this.ifEnableCheckBox.Checked = this._iControl.Enabled;
this.audioThresholdTrackBar.Value = this._aControl.NoiseThreshold;
this.audioEnableCheckBox.Checked = this._aControl.Enabled;
this.ifThresholdTrackBar_Scroll(null, null);
this.audioThresholdTrackBar_Scroll(null, null);
}
private void ifEnableCheckBox_CheckedChanged(object sender, EventArgs e)
{
this._iControl.Enabled = this.ifEnableCheckBox.Checked;
this.ifThresholdTrackBar_Scroll(null, null);
}
private void audioEnableCheckbox_CheckedChanged(object sender, EventArgs e)
{
this._aControl.Enabled = this.audioEnableCheckBox.Checked;
this.audioThresholdTrackBar_Scroll(null, null);
}
private void ifThresholdTrackBar_Scroll(object sender, EventArgs e)
{
this.ifThresholdLabel.Text = this.ifThresholdTrackBar.Value + " dB";
this._iControl.NoiseThreshold = this.ifThresholdTrackBar.Value;
}
private void audioThresholdTrackBar_Scroll(object sender, EventArgs e)
{
this.audioThresholdLabel.Text = this.audioThresholdTrackBar.Value + " dB";
this._aControl.NoiseThreshold = this.audioThresholdTrackBar.Value;
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,21 @@
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security.Permissions;
[assembly: AssemblyCopyright("Copyright © Youssef TOUIL 2012")]
[assembly: AssemblyDescription("IAudioInterceptor Plugin")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SDR#")]
[assembly: AssemblyTitle("AudioInterceptor")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("dfd7918b-ff74-4825-a628-ac37c85d5e9f")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]

View file

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{C447AB68-5C45-476E-9120-017AA0741164}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<OutputType>Library</OutputType>
<AssemblyName>SDRSharp.Equalizer</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'x86' ">
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>bin\Debug\</OutputPath>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>bin\Release\</OutputPath>
<DebugSymbols>true</DebugSymbols>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
</PropertyGroup>
<ItemGroup>
<Reference Include="SDRSharp.Radio">
<HintPath>C:\Users\James\Downloads\RTL-SDR Stuff\SDRSharper_06l\SDRSharp.Radio.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms">
<HintPath>C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll</HintPath>
</Reference>
<Reference Include="SDRSharp.Common">
<HintPath>C:\Users\James\Downloads\RTL-SDR Stuff\SDRSharper_06l\SDRSharp.Common.dll</HintPath>
</Reference>
<Reference Include="System">
<HintPath>C:\Windows\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll</HintPath>
</Reference>
<Reference Include="SDRSharp.Controls">
<HintPath>C:\Users\James\Downloads\RTL-SDR Stuff\SDRSharper_06l\SDRSharp.Controls.dll</HintPath>
</Reference>
<Reference Include="System.Drawing">
<HintPath>C:\Windows\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SDRSharp.Equalizer\EqualizerPanel.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="SDRSharp.Equalizer\EqualizerPlugin.cs" />
<Compile Include="SDRSharp.Equalizer\EqualizerProcessor.cs" />
<Compile Include="SDRSharp.Equalizer\SimpleEq.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View file

@ -0,0 +1,72 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace SDRSharp.Equalizer {
using System;
using SDRSharp.Common;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class EqualizerPanel {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
private ISharpControl _control;
private EqualizerProcessor _audioProcessor;
public EqualizerPanel(ISharpControl control, EqualizerProcessor audioProcessor)
{
_control = control;
_audioProcessor = audioProcessor;
}
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal EqualizerPanel() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SDRSharp.Equalizer.EqualizerPanel", typeof(EqualizerPanel).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

View file

@ -0,0 +1,334 @@
using SDRSharp.Common;
using SDRSharp.Controls;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace SDRSharp.Equalizer
{
public class EqualizerPanel : UserControl
{
private IContainer components;
private Panel panel1;
private Label label7;
private Label label6;
private Label label5;
private Label label4;
private gButton bassButton;
private Label label54;
private gSliderV tbHighGain;
private gSliderV tbMedGain;
private Label label52;
private gSliderV tbLowGain;
private gButton enableButton;
private Label label1;
private gUpDown numHighCutoff;
private gUpDown numLowCutoff;
private ISharpControl _control;
private EqualizerProcessor _audioProcessor;
public ToolTip _toolTip;
protected override void Dispose(bool disposing)
{
if (disposing && this.components != null)
{
this.components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.panel1 = new Panel();
this.label1 = new Label();
this.label7 = new Label();
this.label6 = new Label();
this.label5 = new Label();
this.label4 = new Label();
this.label54 = new Label();
this.label52 = new Label();
this.numLowCutoff = new gUpDown();
this.numHighCutoff = new gUpDown();
this.bassButton = new gButton();
this.tbHighGain = new gSliderV();
this.tbMedGain = new gSliderV();
this.tbLowGain = new gSliderV();
this.enableButton = new gButton();
this.panel1.SuspendLayout();
base.SuspendLayout();
this.panel1.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
this.panel1.BackColor = Color.FromArgb(64, 64, 64);
this.panel1.Controls.Add(this.numLowCutoff);
this.panel1.Controls.Add(this.numHighCutoff);
this.panel1.Controls.Add(this.label1);
this.panel1.Controls.Add(this.label7);
this.panel1.Controls.Add(this.label6);
this.panel1.Controls.Add(this.label5);
this.panel1.Controls.Add(this.label4);
this.panel1.Controls.Add(this.bassButton);
this.panel1.Controls.Add(this.label54);
this.panel1.Controls.Add(this.tbHighGain);
this.panel1.Controls.Add(this.tbMedGain);
this.panel1.Controls.Add(this.label52);
this.panel1.Controls.Add(this.tbLowGain);
this.panel1.Controls.Add(this.enableButton);
this.panel1.Location = new Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new Size(198, 134);
this.panel1.TabIndex = 9;
this.label1.AutoSize = true;
this.label1.ForeColor = Color.Orange;
this.label1.Location = new Point(31, 9);
this.label1.Name = "label1";
this.label1.Size = new Size(21, 13);
this.label1.TabIndex = 118;
this.label1.Text = "On";
this.label1.TextAlign = ContentAlignment.MiddleCenter;
this.label7.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
this.label7.AutoSize = true;
this.label7.ForeColor = Color.Orange;
this.label7.Location = new Point(168, 29);
this.label7.Name = "label7";
this.label7.Size = new Size(29, 13);
this.label7.TabIndex = 117;
this.label7.Text = "High";
this.label7.TextAlign = ContentAlignment.MiddleCenter;
this.label6.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
this.label6.AutoSize = true;
this.label6.ForeColor = Color.Orange;
this.label6.Location = new Point(133, 29);
this.label6.Name = "label6";
this.label6.Size = new Size(28, 13);
this.label6.TabIndex = 116;
this.label6.Text = "Med";
this.label6.TextAlign = ContentAlignment.MiddleCenter;
this.label5.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
this.label5.AutoSize = true;
this.label5.ForeColor = Color.Orange;
this.label5.Location = new Point(97, 29);
this.label5.Name = "label5";
this.label5.Size = new Size(27, 13);
this.label5.TabIndex = 115;
this.label5.Text = "Low";
this.label5.TextAlign = ContentAlignment.MiddleCenter;
this.label4.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
this.label4.AutoSize = true;
this.label4.ForeColor = Color.Orange;
this.label4.Location = new Point(125, 9);
this.label4.Name = "label4";
this.label4.Size = new Size(59, 13);
this.label4.TabIndex = 114;
this.label4.Text = "Bass boost";
this.label4.TextAlign = ContentAlignment.MiddleCenter;
this.label54.AutoSize = true;
this.label54.ForeColor = Color.Orange;
this.label54.Location = new Point(0, 30);
this.label54.Name = "label54";
this.label54.Size = new Size(81, 13);
this.label54.TabIndex = 108;
this.label54.Text = "High cutoff (Hz)";
this.label54.TextAlign = ContentAlignment.MiddleCenter;
this.label52.AutoSize = true;
this.label52.ForeColor = Color.Orange;
this.label52.Location = new Point(0, 78);
this.label52.Name = "label52";
this.label52.Size = new Size(79, 13);
this.label52.TabIndex = 105;
this.label52.Text = "Low cutoff (Hz)";
this.label52.TextAlign = ContentAlignment.MiddleCenter;
this.numLowCutoff.ForeColor = Color.Yellow;
this.numLowCutoff.Increment = 20;
this.numLowCutoff.Location = new Point(3, 96);
this.numLowCutoff.Margin = new Padding(5);
this.numLowCutoff.Maximum = 800L;
this.numLowCutoff.Minimum = 50L;
this.numLowCutoff.Name = "numLowCutoff";
this.numLowCutoff.Size = new Size(79, 20);
this.numLowCutoff.TabIndex = 120;
this.numLowCutoff.ToolTip = null;
this.numLowCutoff.Value = 200L;
this.numLowCutoff.ValueChanged += this.numLowCutOff_ValueChanged;
this.numHighCutoff.ForeColor = Color.Yellow;
this.numHighCutoff.Increment = 200;
this.numHighCutoff.Location = new Point(3, 48);
this.numHighCutoff.Margin = new Padding(5);
this.numHighCutoff.Maximum = 8000L;
this.numHighCutoff.Minimum = 2000L;
this.numHighCutoff.Name = "numHighCutoff";
this.numHighCutoff.Size = new Size(79, 20);
this.numHighCutoff.TabIndex = 119;
this.numHighCutoff.ToolTip = null;
this.numHighCutoff.Value = 4000L;
this.numHighCutoff.ValueChanged += this.numHighCutOff_ValueChanged;
this.bassButton.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
this.bassButton.Arrow = 0;
this.bassButton.Checked = false;
this.bassButton.Edge = 0.15f;
this.bassButton.EndColor = Color.White;
this.bassButton.EndFactor = 0.2f;
this.bassButton.Font = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Regular, GraphicsUnit.Point, 0);
this.bassButton.ForeColor = Color.Orange;
this.bassButton.Location = new Point(97, 6);
this.bassButton.Name = "bassButton";
this.bassButton.NoBorder = false;
this.bassButton.NoLed = false;
this.bassButton.RadioButton = false;
this.bassButton.Radius = 6;
this.bassButton.RadiusB = 0;
this.bassButton.Size = new Size(26, 20);
this.bassButton.StartColor = Color.Black;
this.bassButton.StartFactor = 0.35f;
this.bassButton.TabIndex = 113;
this.bassButton.CheckedChanged += this.bassButton_CheckedChanged;
this.tbHighGain.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
this.tbHighGain.Button = false;
this.tbHighGain.Checked = false;
this.tbHighGain.ColorFactor = 0.55f;
this.tbHighGain.ForeColor = Color.Black;
this.tbHighGain.Location = new Point(173, 44);
this.tbHighGain.Margin = new Padding(4);
this.tbHighGain.Maximum = 30;
this.tbHighGain.Minimum = 1;
this.tbHighGain.Name = "tbHighGain";
this.tbHighGain.Size = new Size(17, 84);
this.tbHighGain.TabIndex = 107;
this.tbHighGain.Tag = "1";
this.tbHighGain.TickColor = Color.Silver;
this.tbHighGain.Ticks = 5;
this.tbHighGain.ToolTip = null;
this.tbHighGain.Value = 10;
this.tbHighGain.ValueChanged += this.tbHighGain_ValueChanged;
this.tbMedGain.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
this.tbMedGain.Button = false;
this.tbMedGain.Checked = false;
this.tbMedGain.ColorFactor = 0.6f;
this.tbMedGain.ForeColor = Color.Black;
this.tbMedGain.Location = new Point(137, 44);
this.tbMedGain.Margin = new Padding(4);
this.tbMedGain.Maximum = 30;
this.tbMedGain.Minimum = 1;
this.tbMedGain.Name = "tbMedGain";
this.tbMedGain.Size = new Size(17, 84);
this.tbMedGain.TabIndex = 106;
this.tbMedGain.Tag = "1";
this.tbMedGain.TickColor = Color.Silver;
this.tbMedGain.Ticks = 5;
this.tbMedGain.ToolTip = null;
this.tbMedGain.Value = 10;
this.tbMedGain.ValueChanged += this.tbMedGain_ValueChanged;
this.tbLowGain.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
this.tbLowGain.Button = false;
this.tbLowGain.Checked = false;
this.tbLowGain.ColorFactor = 0.6f;
this.tbLowGain.ForeColor = Color.Black;
this.tbLowGain.Location = new Point(101, 44);
this.tbLowGain.Margin = new Padding(4);
this.tbLowGain.Maximum = 30;
this.tbLowGain.Minimum = 1;
this.tbLowGain.Name = "tbLowGain";
this.tbLowGain.Size = new Size(17, 84);
this.tbLowGain.TabIndex = 104;
this.tbLowGain.Tag = "1";
this.tbLowGain.TickColor = Color.Silver;
this.tbLowGain.Ticks = 5;
this.tbLowGain.ToolTip = null;
this.tbLowGain.Value = 10;
this.tbLowGain.ValueChanged += this.tbLowGain_ValueChanged;
this.enableButton.Arrow = 0;
this.enableButton.Checked = false;
this.enableButton.Edge = 0.15f;
this.enableButton.EndColor = Color.White;
this.enableButton.EndFactor = 0.2f;
this.enableButton.Font = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Regular, GraphicsUnit.Point, 0);
this.enableButton.ForeColor = Color.Orange;
this.enableButton.Location = new Point(2, 6);
this.enableButton.Name = "enableButton";
this.enableButton.NoBorder = false;
this.enableButton.NoLed = false;
this.enableButton.RadioButton = false;
this.enableButton.Radius = 6;
this.enableButton.RadiusB = 0;
this.enableButton.Size = new Size(26, 20);
this.enableButton.StartColor = Color.Black;
this.enableButton.StartFactor = 0.35f;
this.enableButton.TabIndex = 17;
this.enableButton.CheckedChanged += this.enableButton_CheckedChanged;
base.AutoScaleDimensions = new SizeF(6f, 13f);
base.AutoScaleMode = AutoScaleMode.Font;
base.Controls.Add(this.panel1);
base.Name = "EqualizerPanel";
base.Size = new Size(198, 154);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
base.ResumeLayout(false);
}
public EqualizerPanel(ISharpControl control, EqualizerProcessor audioProcessor)
{
this.InitializeComponent();
this._control = control;
this._audioProcessor = audioProcessor;
this.tbHighGain.Value = (int)(this._audioProcessor.HighGain * 8f);
this.tbMedGain.Value = (int)(this._audioProcessor.MidGain * 8f);
this.tbLowGain.Value = (int)(this._audioProcessor.LowGain * 8f);
this.numHighCutoff.Value = (int)this._audioProcessor.HighCutoff;
this.numLowCutoff.Value = (int)this._audioProcessor.LowCutoff;
this.enableButton.Checked = this._audioProcessor.Enabled;
this.bassButton.Checked = this._audioProcessor.BassBoost;
}
private void enableButton_CheckedChanged(object sender, EventArgs e)
{
this._audioProcessor.Enabled = this.enableButton.Checked;
}
private void bassButton_CheckedChanged(object sender, EventArgs e)
{
this._audioProcessor.BassBoost = this.bassButton.Checked;
}
private void numHighCutOff_ValueChanged(object sender, EventArgs e)
{
this._audioProcessor.HighCutoff = (float)this.numHighCutoff.Value;
}
private void numLowCutOff_ValueChanged(object sender, EventArgs e)
{
this._audioProcessor.LowCutoff = (float)this.numLowCutoff.Value;
}
private void tbLowGain_ValueChanged(object sender, EventArgs e)
{
this._audioProcessor.LowGain = (float)this.tbLowGain.Value / 8f;
}
private void tbMedGain_ValueChanged(object sender, EventArgs e)
{
this._audioProcessor.MidGain = (float)this.tbMedGain.Value / 8f;
}
private void tbHighGain_ValueChanged(object sender, EventArgs e)
{
this._audioProcessor.HighGain = (float)this.tbHighGain.Value / 8f;
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,60 @@
using SDRSharp.Common;
using SDRSharp.Radio;
using System.ComponentModel;
using System.Windows.Forms;
namespace SDRSharp.Equalizer
{
public class EqualizerPlugin : ISharpPlugin
{
private const string _displayName = "Audio Equalizer";
private ISharpControl _control;
private EqualizerProcessor _audioProcessor;
private EqualizerPanel _guiControl;
public string DisplayName => "Audio Equalizer";
public bool HasGui => true;
public UserControl GuiControl => this._guiControl;
public void Initialize(ISharpControl control)
{
this._control = control;
this._control.PropertyChanged += this.PropertyChangedHandler;
this._audioProcessor = new EqualizerProcessor();
this._audioProcessor.Enabled = Utils.GetBooleanSetting("EqEnabled");
this._audioProcessor.BassBoost = Utils.GetBooleanSetting("EqBassBoost");
this._audioProcessor.LowCutoff = (float)Utils.GetIntSetting("EqLowCutoff", 200);
this._audioProcessor.HighCutoff = (float)Utils.GetIntSetting("EqHighCutoff", 4000);
this._audioProcessor.LowGain = (float)Utils.GetDoubleSetting("EqLowGain", 2.25);
this._audioProcessor.MidGain = (float)Utils.GetDoubleSetting("EqMidGain", 1.125);
this._audioProcessor.HighGain = (float)Utils.GetDoubleSetting("EqHighGain", 2.25);
this._control.RegisterStreamHook(this._audioProcessor, ProcessorType.FilteredAudioOutput);
this._guiControl = new EqualizerPanel(this._control, this._audioProcessor);
}
private void PropertyChangedHandler(object sender, PropertyChangedEventArgs e)
{
string propertyName;
if ((propertyName = e.PropertyName) != null && !(propertyName == "StartRadio"))
{
bool flag = propertyName == "StopRadio";
}
}
public void Close()
{
Utils.SaveSetting("EqEnabled", this._audioProcessor.Enabled);
Utils.SaveSetting("EqBassBoost", this._audioProcessor.BassBoost);
Utils.SaveSetting("EqLowCutoff", this._audioProcessor.LowCutoff);
Utils.SaveSetting("EqHighCutoff", this._audioProcessor.HighCutoff);
Utils.SaveSetting("EqLowGain", this._audioProcessor.LowGain);
Utils.SaveSetting("EqMidGain", this._audioProcessor.MidGain);
Utils.SaveSetting("EqHighGain", this._audioProcessor.HighGain);
}
}
}

View file

@ -0,0 +1,122 @@
using SDRSharp.Radio;
namespace SDRSharp.Equalizer
{
public class EqualizerProcessor : IRealProcessor, IBaseProcessor
{
private bool _bypass;
private SimpleEq _eq1 = new SimpleEq();
private SimpleEq _eq2 = new SimpleEq();
public double SampleRate
{
get
{
return this._eq1.SampleRate;
}
set
{
this._eq1.SampleRate = value;
this._eq2.SampleRate = value;
}
}
public bool Enabled
{
get
{
return !this._bypass;
}
set
{
this._bypass = !value;
}
}
public float LowGain
{
get
{
return this._eq1.LowGain;
}
set
{
this._eq1.LowGain = value;
this._eq2.LowGain = value;
}
}
public float MidGain
{
get
{
return this._eq1.MidGain;
}
set
{
this._eq1.MidGain = value;
this._eq2.MidGain = value;
}
}
public float HighGain
{
get
{
return this._eq1.HighGain;
}
set
{
this._eq1.HighGain = value;
this._eq2.HighGain = value;
}
}
public bool BassBoost
{
get
{
return this._eq1.BassBoost;
}
set
{
this._eq1.BassBoost = value;
this._eq2.BassBoost = value;
}
}
public float LowCutoff
{
get
{
return this._eq1.LowCutoff;
}
set
{
this._eq1.LowCutoff = value;
this._eq2.LowCutoff = value;
}
}
public float HighCutoff
{
get
{
return this._eq1.HighCutoff;
}
set
{
this._eq1.HighCutoff = value;
this._eq2.HighCutoff = value;
}
}
public unsafe void Process(float* audio, int length)
{
this._eq1.ProcessInterleaved(audio, length);
this._eq2.ProcessInterleaved(audio + 1, length);
}
}
}

View file

@ -0,0 +1,168 @@
using SDRSharp.Radio;
namespace SDRSharp.Equalizer
{
public class SimpleEq
{
private const int BassFilterCutoff = 150;
private float _lowGain = 1f;
private float _midGain = 1f;
private float _highGain = 1f;
private float _lowCutoff = 400f;
private float _highCutoff = 5000f;
private double _sampleRate = 48000.0;
private bool _bassBoost;
private IirFilter _lowFilter;
private IirFilter _highFilter;
private IirFilter _bassFilter;
public float LowGain
{
get
{
return this._lowGain;
}
set
{
this._lowGain = value;
}
}
public float HighGain
{
get
{
return this._highGain;
}
set
{
this._highGain = value;
}
}
public float MidGain
{
get
{
return this._midGain;
}
set
{
this._midGain = value;
}
}
public bool BassBoost
{
get
{
return this._bassBoost;
}
set
{
this._bassBoost = value;
}
}
public double SampleRate
{
get
{
return this._sampleRate;
}
set
{
this._sampleRate = value;
this.initLow();
this.initHigh();
this.initBass();
}
}
public float LowCutoff
{
get
{
return this._lowCutoff;
}
set
{
this._lowCutoff = value;
this.initLow();
}
}
public float HighCutoff
{
get
{
return this._highCutoff;
}
set
{
this._highCutoff = value;
this.initHigh();
}
}
public SimpleEq()
{
this._lowFilter = default(IirFilter);
this._highFilter = default(IirFilter);
this._bassFilter = default(IirFilter);
this.initLow();
this.initHigh();
this.initBass();
}
private void initBass()
{
this._bassFilter.Init(IirFilterType.LowPass, 150.0, this._sampleRate, 4);
}
private void initLow()
{
this._lowFilter.Init(IirFilterType.LowPass, (double)this._lowCutoff, this._sampleRate, 1);
}
private void initHigh()
{
this._highFilter.Init(IirFilterType.HighPass, (double)this._highCutoff, this._sampleRate, 1);
}
public unsafe void ProcessInterleaved(float* buffer, int length)
{
float num = 0f;
for (int i = 0; i < length; i += 2)
{
float num2 = this._lowFilter.Process(buffer[i]);
float num3 = this._highFilter.Process(buffer[i]);
float num4 = buffer[i] - (num2 + num3);
if (this._bassBoost)
{
num = this._bassFilter.Process(buffer[i]);
}
num2 *= this._lowGain;
num4 *= this._midGain;
num3 *= this._highGain;
buffer[i] = num2 + num4 + num3;
if (this._bassBoost)
{
num *= 0.8f;
buffer[i] += num;
}
buffer[i] *= 0.5f;
}
}
}
}

View file

@ -0,0 +1,18 @@
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyDescription("")]
[assembly: CompilationRelaxations(8)]
[assembly: AssemblyTitle("Frequency Manager for SDR#")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SDR#")]
[assembly: AssemblyCopyright("Copyright © Tony BenBrahim 2012")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(true)]
[assembly: Guid("a80d3b15-c0c9-4d61-8bd6-b87954dce39d")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]

View file

@ -0,0 +1,49 @@
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Resources;
using System.Runtime.CompilerServices;
namespace SDRSharp.FrequencyManager.Properties
{
[DebuggerNonUserCode]
[CompilerGenerated]
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
internal class Resources
{
private static ResourceManager resourceMan;
private static CultureInfo resourceCulture;
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static ResourceManager ResourceManager
{
get
{
if (object.ReferenceEquals(Resources.resourceMan, null))
{
ResourceManager resourceManager = Resources.resourceMan = new ResourceManager("SDRSharp.FrequencyManager.Properties.Resources", typeof(Resources).Assembly);
}
return Resources.resourceMan;
}
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static CultureInfo Culture
{
get
{
return Resources.resourceCulture;
}
set
{
Resources.resourceCulture = value;
}
}
internal Resources()
{
}
}
}

View file

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{93599733-9D4A-49EB-B852-65515FB1A8AB}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<OutputType>Library</OutputType>
<AssemblyName>SDRSharp.FrequencyManager</AssemblyName>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'x86' ">
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>bin\Debug\</OutputPath>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>bin\Release\</OutputPath>
<DebugSymbols>true</DebugSymbols>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DefineConstants>TRACE;DEBUG</DefineConstants>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Release\</OutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Release\</OutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="SDRSharp.Common">
<HintPath>..\..\SDRSharper\bin\x64\Debug\SDRSharp.Common.dll</HintPath>
</Reference>
<Reference Include="SDRSharp.Radio">
<HintPath>..\..\SDRSharper\bin\x64\Debug\SDRSharp.Radio.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms">
<HintPath>..\..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\System.Windows.Forms.dll</HintPath>
</Reference>
<Reference Include="System">
<HintPath>..\..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\System.dll</HintPath>
</Reference>
<Reference Include="System.Xml">
<HintPath>..\..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\System.Xml.dll</HintPath>
</Reference>
<Reference Include="System.Drawing">
<HintPath>..\..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\System.Drawing.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SDRSharp.FrequencyManager.Properties\Resources.cs" />
<Compile Include="SDRSharp.FrequencyManager\DialogEntryInfo.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="SDRSharp.FrequencyManager\FrequencyManagerPanel.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="SDRSharp.FrequencyManager\FrequencyManagerPlugin.cs" />
<Compile Include="SDRSharp.FrequencyManager\FrequencyManagerUtils.cs" />
<Compile Include="SDRSharp.FrequencyManager\MemoryEntry.cs" />
<Compile Include="SDRSharp.FrequencyManager\MemoryInfoEventArgs.cs" />
<Compile Include="SDRSharp.FrequencyManager\RadioInfo.cs" />
<Compile Include="SDRSharp.FrequencyManager\SerializableDictionary.cs" />
<Compile Include="SDRSharp.FrequencyManager\SettingsPersister.cs" />
<Compile Include="SDRSharp.FrequencyManager\SortableBindingList.cs" />
<Compile Include="SDRSharp.FrequencyManager\SortableBindingListComparer.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="SDRSharp.FrequencyManager\DialogEntryInfo.resx">
<DependentUpon>DialogEntryInfo.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="SDRSharp.FrequencyManager\FrequencyManagerPanel.resx">
<DependentUpon>FrequencyManagerPanel.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View file

@ -0,0 +1,37 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27428.2015
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDRSharp.FrequencyManager", "SDRSharp.FrequencyManager.csproj", "{93599733-9D4A-49EB-B852-65515FB1A8AB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{93599733-9D4A-49EB-B852-65515FB1A8AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{93599733-9D4A-49EB-B852-65515FB1A8AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{93599733-9D4A-49EB-B852-65515FB1A8AB}.Debug|x64.ActiveCfg = Debug|x64
{93599733-9D4A-49EB-B852-65515FB1A8AB}.Debug|x64.Build.0 = Debug|x64
{93599733-9D4A-49EB-B852-65515FB1A8AB}.Debug|x86.ActiveCfg = Debug|x86
{93599733-9D4A-49EB-B852-65515FB1A8AB}.Debug|x86.Build.0 = Debug|x86
{93599733-9D4A-49EB-B852-65515FB1A8AB}.Release|Any CPU.ActiveCfg = Release|x86
{93599733-9D4A-49EB-B852-65515FB1A8AB}.Release|Any CPU.Build.0 = Release|x86
{93599733-9D4A-49EB-B852-65515FB1A8AB}.Release|x64.ActiveCfg = Release|x86
{93599733-9D4A-49EB-B852-65515FB1A8AB}.Release|x64.Build.0 = Release|x86
{93599733-9D4A-49EB-B852-65515FB1A8AB}.Release|x86.ActiveCfg = Release|x86
{93599733-9D4A-49EB-B852-65515FB1A8AB}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {97731D80-BEC3-4DC6-888B-4893D3B0F22A}
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,327 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace SDRSharp.FrequencyManager
{
public class DialogEntryInfo : Form
{
private MemoryEntry _memoryEntry;
private IContainer components;
private Label label1;
private Label label2;
private Label label3;
private Label label4;
private Label label5;
private Label lblMode;
private ComboBox comboGroupName;
private TextBox textBoxName;
private NumericUpDown frequencyNumericUpDown;
private Button btnOk;
private Button btnCancel;
private NumericUpDown shiftNumericUpDown;
private Label label6;
private NumericUpDown nudFilterBandwidth;
private Label label7;
private CheckBox favouriteCb;
public DialogEntryInfo()
{
this.InitializeComponent();
this.ValidateForm();
}
public DialogEntryInfo(MemoryEntry memoryEntry, List<string> groups)
{
this._memoryEntry = memoryEntry;
this.InitializeComponent();
this.textBoxName.Text = memoryEntry.Name;
this.comboGroupName.Text = memoryEntry.GroupName;
this.frequencyNumericUpDown.Value = memoryEntry.Frequency;
this.shiftNumericUpDown.Value = memoryEntry.Shift;
this.lblMode.Text = memoryEntry.DetectorType.ToString();
this.comboGroupName.Items.AddRange(groups.ToArray());
this.nudFilterBandwidth.Value = memoryEntry.FilterBandwidth;
this.favouriteCb.Checked = memoryEntry.IsFavourite;
this.ValidateForm();
}
private void Control_TextChanged(object sender, EventArgs e)
{
this.ValidateForm();
}
private void ValidateForm()
{
bool enabled = this.textBoxName.Text != null && !"".Equals(this.textBoxName.Text.Trim()) && this.comboGroupName.Text != null && !"".Equals(this.comboGroupName.Text.Trim()) && this.frequencyNumericUpDown.Value != 0m && this.nudFilterBandwidth.Value != 0m;
this.btnOk.Enabled = enabled;
}
private void btnOk_Click(object sender, EventArgs e)
{
this._memoryEntry.Name = this.textBoxName.Text.Trim();
this._memoryEntry.GroupName = this.comboGroupName.Text.Trim();
this._memoryEntry.Frequency = (long)this.frequencyNumericUpDown.Value;
this._memoryEntry.Shift = (long)this.shiftNumericUpDown.Value;
this._memoryEntry.FilterBandwidth = (long)this.nudFilterBandwidth.Value;
this._memoryEntry.IsFavourite = this.favouriteCb.Checked;
base.DialogResult = DialogResult.OK;
}
protected override void Dispose(bool disposing)
{
if (disposing && this.components != null)
{
this.components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.label1 = new Label();
this.label2 = new Label();
this.label3 = new Label();
this.label4 = new Label();
this.label5 = new Label();
this.lblMode = new Label();
this.comboGroupName = new ComboBox();
this.textBoxName = new TextBox();
this.frequencyNumericUpDown = new NumericUpDown();
this.btnOk = new Button();
this.btnCancel = new Button();
this.shiftNumericUpDown = new NumericUpDown();
this.label6 = new Label();
this.nudFilterBandwidth = new NumericUpDown();
this.label7 = new Label();
this.favouriteCb = new CheckBox();
((ISupportInitialize)this.frequencyNumericUpDown).BeginInit();
((ISupportInitialize)this.shiftNumericUpDown).BeginInit();
((ISupportInitialize)this.nudFilterBandwidth).BeginInit();
base.SuspendLayout();
this.label1.AutoSize = true;
this.label1.Location = new Point(10, 11);
this.label1.Margin = new Padding(2, 0, 2, 0);
this.label1.Name = "label1";
this.label1.Size = new Size(250, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Select an existing group or enter a new group name";
this.label2.AutoSize = true;
this.label2.Location = new Point(10, 37);
this.label2.Margin = new Padding(2, 0, 2, 0);
this.label2.Name = "label2";
this.label2.Size = new Size(39, 13);
this.label2.TabIndex = 1;
this.label2.Text = "Group:";
this.label3.AutoSize = true;
this.label3.Location = new Point(10, 67);
this.label3.Margin = new Padding(2, 0, 2, 0);
this.label3.Name = "label3";
this.label3.Size = new Size(38, 13);
this.label3.TabIndex = 2;
this.label3.Text = "Name:";
this.label4.AutoSize = true;
this.label4.Location = new Point(10, 98);
this.label4.Margin = new Padding(2, 0, 2, 0);
this.label4.Name = "label4";
this.label4.Size = new Size(60, 13);
this.label4.TabIndex = 3;
this.label4.Text = "Frequency:";
this.label5.AutoSize = true;
this.label5.Location = new Point(11, 187);
this.label5.Margin = new Padding(2, 0, 2, 0);
this.label5.Name = "label5";
this.label5.Size = new Size(37, 13);
this.label5.TabIndex = 4;
this.label5.Text = "Mode:";
this.lblMode.Location = new Point(89, 187);
this.lblMode.Margin = new Padding(2, 0, 2, 0);
this.lblMode.Name = "lblMode";
this.lblMode.Size = new Size(120, 17);
this.lblMode.TabIndex = 5;
this.comboGroupName.FormattingEnabled = true;
this.comboGroupName.Location = new Point(85, 34);
this.comboGroupName.Margin = new Padding(2);
this.comboGroupName.Name = "comboGroupName";
this.comboGroupName.Size = new Size(178, 21);
this.comboGroupName.TabIndex = 0;
this.comboGroupName.TextChanged += this.Control_TextChanged;
this.textBoxName.Location = new Point(85, 64);
this.textBoxName.Margin = new Padding(2);
this.textBoxName.Name = "textBoxName";
this.textBoxName.Size = new Size(178, 20);
this.textBoxName.TabIndex = 1;
this.textBoxName.TextChanged += this.Control_TextChanged;
this.frequencyNumericUpDown.Increment = new decimal(new int[4]
{
10,
0,
0,
0
});
this.frequencyNumericUpDown.Location = new Point(85, 96);
this.frequencyNumericUpDown.Margin = new Padding(2);
this.frequencyNumericUpDown.Maximum = new decimal(new int[4]
{
-727379969,
232,
0,
0
});
this.frequencyNumericUpDown.Minimum = new decimal(new int[4]
{
-727379969,
232,
0,
-2147483648
});
this.frequencyNumericUpDown.Name = "frequencyNumericUpDown";
this.frequencyNumericUpDown.Size = new Size(124, 20);
this.frequencyNumericUpDown.TabIndex = 2;
this.frequencyNumericUpDown.TextAlign = HorizontalAlignment.Right;
this.frequencyNumericUpDown.ThousandsSeparator = true;
this.frequencyNumericUpDown.ValueChanged += this.Control_TextChanged;
this.btnOk.DialogResult = DialogResult.OK;
this.btnOk.Enabled = false;
this.btnOk.Location = new Point(149, 245);
this.btnOk.Margin = new Padding(2);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new Size(56, 23);
this.btnOk.TabIndex = 5;
this.btnOk.Text = "O&K";
this.btnOk.UseVisualStyleBackColor = true;
this.btnOk.Click += this.btnOk_Click;
this.btnCancel.DialogResult = DialogResult.Cancel;
this.btnCancel.Location = new Point(209, 245);
this.btnCancel.Margin = new Padding(2);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new Size(56, 23);
this.btnCancel.TabIndex = 6;
this.btnCancel.Text = "&Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
this.shiftNumericUpDown.Increment = new decimal(new int[4]
{
10,
0,
0,
0
});
this.shiftNumericUpDown.Location = new Point(85, 126);
this.shiftNumericUpDown.Margin = new Padding(2);
this.shiftNumericUpDown.Maximum = new decimal(new int[4]
{
-727379969,
232,
0,
0
});
this.shiftNumericUpDown.Minimum = new decimal(new int[4]
{
-727379969,
232,
0,
-2147483648
});
this.shiftNumericUpDown.Name = "shiftNumericUpDown";
this.shiftNumericUpDown.Size = new Size(124, 20);
this.shiftNumericUpDown.TabIndex = 3;
this.shiftNumericUpDown.TextAlign = HorizontalAlignment.Right;
this.shiftNumericUpDown.ThousandsSeparator = true;
this.label6.AutoSize = true;
this.label6.Location = new Point(10, 129);
this.label6.Margin = new Padding(2, 0, 2, 0);
this.label6.Name = "label6";
this.label6.Size = new Size(31, 13);
this.label6.TabIndex = 12;
this.label6.Text = "Shift:";
this.nudFilterBandwidth.Increment = new decimal(new int[4]
{
10,
0,
0,
0
});
this.nudFilterBandwidth.Location = new Point(85, 156);
this.nudFilterBandwidth.Margin = new Padding(2);
this.nudFilterBandwidth.Maximum = new decimal(new int[4]
{
1410065407,
2,
0,
0
});
this.nudFilterBandwidth.Name = "nudFilterBandwidth";
this.nudFilterBandwidth.Size = new Size(124, 20);
this.nudFilterBandwidth.TabIndex = 4;
this.nudFilterBandwidth.TextAlign = HorizontalAlignment.Right;
this.nudFilterBandwidth.ThousandsSeparator = true;
this.label7.AutoSize = true;
this.label7.Location = new Point(10, 160);
this.label7.Margin = new Padding(2, 0, 2, 0);
this.label7.Name = "label7";
this.label7.Size = new Size(53, 13);
this.label7.TabIndex = 14;
this.label7.Text = "Filter BW:";
this.favouriteCb.AutoSize = true;
this.favouriteCb.Location = new Point(85, 207);
this.favouriteCb.Name = "favouriteCb";
this.favouriteCb.Size = new Size(70, 17);
this.favouriteCb.TabIndex = 16;
this.favouriteCb.Text = "Favourite";
this.favouriteCb.UseVisualStyleBackColor = true;
base.AcceptButton = this.btnOk;
base.AutoScaleDimensions = new SizeF(6f, 13f);
base.AutoScaleMode = AutoScaleMode.Font;
base.CancelButton = this.btnCancel;
base.ClientSize = new Size(276, 279);
base.Controls.Add(this.favouriteCb);
base.Controls.Add(this.nudFilterBandwidth);
base.Controls.Add(this.label7);
base.Controls.Add(this.shiftNumericUpDown);
base.Controls.Add(this.label6);
base.Controls.Add(this.btnCancel);
base.Controls.Add(this.btnOk);
base.Controls.Add(this.frequencyNumericUpDown);
base.Controls.Add(this.textBoxName);
base.Controls.Add(this.comboGroupName);
base.Controls.Add(this.lblMode);
base.Controls.Add(this.label5);
base.Controls.Add(this.label4);
base.Controls.Add(this.label3);
base.Controls.Add(this.label2);
base.Controls.Add(this.label1);
base.FormBorderStyle = FormBorderStyle.FixedDialog;
base.Margin = new Padding(2);
base.MaximizeBox = false;
base.MinimizeBox = false;
base.Name = "DialogEntryInfo";
base.SizeGripStyle = SizeGripStyle.Hide;
base.StartPosition = FormStartPosition.CenterScreen;
this.Text = "Edit Entry Information";
((ISupportInitialize)this.frequencyNumericUpDown).EndInit();
((ISupportInitialize)this.shiftNumericUpDown).EndInit();
((ISupportInitialize)this.nudFilterBandwidth).EndInit();
base.ResumeLayout(false);
base.PerformLayout();
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,452 @@
using SDRSharp.Common;
using SDRSharp.Radio;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace SDRSharp.FrequencyManager
{
[Category("SDRSharp")]
[DesignTimeVisible(true)]
[Description("RF Memory Management Panel")]
public class FrequencyManagerPanel : UserControl
{
private const string AllGroups = "[All Groups]";
private const string FavouriteGroup = "[Favourites]";
private readonly SortableBindingList<MemoryEntry> _displayedEntries = new SortableBindingList<MemoryEntry>();
private readonly List<MemoryEntry> _entries;
private readonly SettingsPersister _settingsPersister;
private readonly List<string> _groups = new List<string>();
private ISharpControl _controlInterface;
private IContainer components;
private ToolStrip mainToolStrip;
private ToolStripButton btnNewEntry;
private ToolStripButton btnEdit;
private ToolStripButton btnDelete;
private Label label17;
private DataGridView frequencyDataGridView;
private ComboBox comboGroups;
private BindingSource memoryEntryBindingSource;
private DataGridViewTextBoxColumn nameDataGridViewTextBoxColumn;
private DataGridViewTextBoxColumn frequencyDataGridViewTextBoxColumn;
public string SelectedGroup
{
get
{
return (string)this.comboGroups.SelectedItem;
}
set
{
if (value != null && this.comboGroups.Items.IndexOf(value) != -1)
{
this.comboGroups.SelectedIndex = this.comboGroups.Items.IndexOf(value);
}
}
}
public FrequencyManagerPanel(ISharpControl control)
{
this.InitializeComponent();
this._controlInterface = control;
if (LicenseManager.UsageMode == LicenseUsageMode.Runtime)
{
this._settingsPersister = new SettingsPersister();
this._entries = this._settingsPersister.ReadStoredFrequencies();
this._groups = this.GetGroupsFromEntries();
this.ProcessGroups(null);
}
this.memoryEntryBindingSource.DataSource = this._displayedEntries;
}
private void btnNewEntry_Click(object sender, EventArgs e)
{
this.Bookmark();
}
private void btnEdit_Click(object sender, EventArgs e)
{
if (this.memoryEntryBindingSource.Current != null)
{
this.DoEdit((MemoryEntry)this.memoryEntryBindingSource.Current, false);
}
}
private void btnDelete_Click(object sender, EventArgs e)
{
MemoryEntry memoryEntry = (MemoryEntry)this.memoryEntryBindingSource.Current;
if (memoryEntry != null && MessageBox.Show("Are you sure that you want to delete '" + memoryEntry.Name + "'?", "Delete Entry", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
this._entries.Remove(memoryEntry);
this._settingsPersister.PersistStoredFrequencies(this._entries);
this._displayedEntries.Remove(memoryEntry);
}
}
private void DoEdit(MemoryEntry memoryEntry, bool isNew)
{
DialogEntryInfo dialogEntryInfo = new DialogEntryInfo(memoryEntry, this._groups);
if (dialogEntryInfo.ShowDialog() == DialogResult.OK)
{
if (isNew)
{
this._entries.Add(memoryEntry);
this._entries.Sort((MemoryEntry e1, MemoryEntry e2) => e1.Frequency.CompareTo(e2.Frequency));
}
this._settingsPersister.PersistStoredFrequencies(this._entries);
if (!this._groups.Contains(memoryEntry.GroupName))
{
this._groups.Add(memoryEntry.GroupName);
this.ProcessGroups(memoryEntry.GroupName);
}
else if ((string)this.comboGroups.SelectedItem == "[All Groups]" || (string)this.comboGroups.SelectedItem == memoryEntry.GroupName || ((string)this.comboGroups.SelectedItem == "[Favourites]" && memoryEntry.IsFavourite))
{
if (isNew)
{
this._displayedEntries.Add(memoryEntry);
}
}
else
{
this.comboGroups.SelectedItem = memoryEntry.GroupName;
}
}
}
private List<string> GetGroupsFromEntries()
{
List<string> list = new List<string>();
foreach (MemoryEntry entry in this._entries)
{
if (!list.Contains(entry.GroupName))
{
list.Add(entry.GroupName);
}
}
return list;
}
private void frequencyDataGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if (this.frequencyDataGridView.Columns[e.ColumnIndex].DataPropertyName == "Frequency" && e.Value != null)
{
long frequency = (long)e.Value;
e.Value = FrequencyManagerPanel.GetFrequencyDisplay(frequency);
e.FormattingApplied = true;
}
}
private void frequencyDataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
this.Navigate();
}
private void ProcessGroups(string selectedGroupName)
{
this._groups.Sort();
this.comboGroups.Items.Clear();
this.comboGroups.Items.Add("[All Groups]");
this.comboGroups.Items.Add("[Favourites]");
this.comboGroups.Items.AddRange(this._groups.ToArray());
if (selectedGroupName != null)
{
this.comboGroups.SelectedItem = selectedGroupName;
}
else
{
this.comboGroups.SelectedIndex = 0;
}
}
private void comboGroups_SelectedIndexChanged(object sender, EventArgs e)
{
this.memoryEntryBindingSource.Clear();
this._displayedEntries.Clear();
if (this.comboGroups.SelectedIndex != -1)
{
string text = (string)this.comboGroups.SelectedItem;
foreach (MemoryEntry entry in this._entries)
{
if (text == "[All Groups]" || entry.GroupName == text || (text == "[Favourites]" && entry.IsFavourite))
{
this._displayedEntries.Add(entry);
}
}
}
}
private void frequencyDataGridView_SelectionChanged(object sender, EventArgs e)
{
this.btnDelete.Enabled = (this.frequencyDataGridView.SelectedRows.Count > 0);
this.btnEdit.Enabled = (this.frequencyDataGridView.SelectedRows.Count > 0);
}
public void Bookmark()
{
if (this._controlInterface.IsPlaying)
{
MemoryEntry memoryEntry = new MemoryEntry();
memoryEntry.DetectorType = this._controlInterface.DetectorType;
memoryEntry.CenterFrequency = this._controlInterface.CenterFrequency;
memoryEntry.Frequency = this._controlInterface.Frequency;
memoryEntry.FilterBandwidth = this._controlInterface.FilterBandwidth;
memoryEntry.Shift = (this._controlInterface.FrequencyShiftEnabled ? this._controlInterface.FrequencyShift : 0);
memoryEntry.GroupName = "Misc";
if (this._controlInterface.DetectorType == DetectorType.WFM)
{
string text = this._controlInterface.RdsProgramService.Trim();
memoryEntry.Name = string.Empty;
if (!string.IsNullOrEmpty(text))
{
memoryEntry.Name = text;
}
else
{
memoryEntry.Name = FrequencyManagerPanel.GetFrequencyDisplay(this._controlInterface.Frequency) + " " + memoryEntry.DetectorType;
}
}
else
{
memoryEntry.Name = FrequencyManagerPanel.GetFrequencyDisplay(this._controlInterface.Frequency) + " " + memoryEntry.DetectorType;
}
memoryEntry.IsFavourite = true;
this.DoEdit(memoryEntry, true);
}
}
public void Navigate()
{
if (this._controlInterface.IsPlaying)
{
int num = (this.frequencyDataGridView.SelectedCells.Count > 0) ? this.frequencyDataGridView.SelectedCells[0].RowIndex : (-1);
if (num != -1)
{
try
{
MemoryEntry memoryEntry = (MemoryEntry)this.memoryEntryBindingSource.List[num];
this._controlInterface.FrequencyShift = memoryEntry.Shift;
this._controlInterface.FrequencyShiftEnabled = (memoryEntry.Shift != 0);
if (Math.Abs(memoryEntry.Frequency - memoryEntry.CenterFrequency - this._controlInterface.FrequencyShift) < this._controlInterface.RFBandwidth / 2)
{
this._controlInterface.CenterFrequency = memoryEntry.CenterFrequency;
this._controlInterface.Frequency = memoryEntry.Frequency;
}
else
{
long num2 = memoryEntry.Frequency - memoryEntry.Shift + this._controlInterface.FilterBandwidth / 2 + 5000;
if (Math.Abs(memoryEntry.Frequency - num2 - memoryEntry.Shift) < this._controlInterface.RFBandwidth / 2)
{
this._controlInterface.CenterFrequency = num2;
this._controlInterface.Frequency = memoryEntry.Frequency;
}
else
{
this._controlInterface.CenterFrequency = memoryEntry.Frequency - this._controlInterface.FrequencyShift;
this._controlInterface.Frequency = memoryEntry.Frequency;
}
}
this._controlInterface.DetectorType = memoryEntry.DetectorType;
this._controlInterface.FilterBandwidth = (int)memoryEntry.FilterBandwidth;
}
catch (Exception ex)
{
MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
}
}
}
}
private static string GetFrequencyDisplay(long frequency)
{
long num = Math.Abs(frequency);
if (num == 0)
{
return "DC";
}
if (num > 1500000000)
{
return $"{(double)frequency / 1000000000.0:#,0.000 000} GHz";
}
if (num > 30000000)
{
return $"{(double)frequency / 1000000.0:0,0.000#} MHz";
}
if (num > 1000)
{
return $"{(double)frequency / 1000.0:#,#.###} kHz";
}
return frequency.ToString();
}
private void frequencyDataGridView_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Return)
{
this.Navigate();
e.Handled = true;
}
}
private void frequencyDataGridView_Scroll(object sender, ScrollEventArgs e)
{
this._controlInterface.FFTSkips = -10;
}
protected override void Dispose(bool disposing)
{
if (disposing && this.components != null)
{
this.components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.components = new Container();
ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(FrequencyManagerPanel));
DataGridViewCellStyle dataGridViewCellStyle = new DataGridViewCellStyle();
this.mainToolStrip = new ToolStrip();
this.btnNewEntry = new ToolStripButton();
this.btnEdit = new ToolStripButton();
this.btnDelete = new ToolStripButton();
this.label17 = new Label();
this.frequencyDataGridView = new DataGridView();
this.nameDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
this.frequencyDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
this.memoryEntryBindingSource = new BindingSource(this.components);
this.comboGroups = new ComboBox();
this.mainToolStrip.SuspendLayout();
((ISupportInitialize)this.frequencyDataGridView).BeginInit();
((ISupportInitialize)this.memoryEntryBindingSource).BeginInit();
base.SuspendLayout();
this.mainToolStrip.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
this.mainToolStrip.AutoSize = false;
this.mainToolStrip.Dock = DockStyle.None;
this.mainToolStrip.GripStyle = ToolStripGripStyle.Hidden;
this.mainToolStrip.Items.AddRange(new ToolStripItem[3]
{
this.btnNewEntry,
this.btnEdit,
this.btnDelete
});
this.mainToolStrip.Location = new Point(1, 6);
this.mainToolStrip.MinimumSize = new Size(205, 0);
this.mainToolStrip.Name = "mainToolStrip";
this.mainToolStrip.Size = new Size(235, 22);
this.mainToolStrip.Stretch = true;
this.mainToolStrip.TabIndex = 7;
this.mainToolStrip.Text = "toolStrip1";
this.btnNewEntry.Image = (Image)componentResourceManager.GetObject("btnNewEntry.Image");
this.btnNewEntry.ImageTransparentColor = Color.Magenta;
this.btnNewEntry.Name = "btnNewEntry";
this.btnNewEntry.Size = new Size(48, 19);
this.btnNewEntry.Text = "New";
this.btnNewEntry.Click += this.btnNewEntry_Click;
this.btnEdit.Image = (Image)componentResourceManager.GetObject("btnEdit.Image");
this.btnEdit.ImageTransparentColor = Color.Magenta;
this.btnEdit.Name = "btnEdit";
this.btnEdit.Size = new Size(45, 19);
this.btnEdit.Text = "Edit";
this.btnEdit.Click += this.btnEdit_Click;
this.btnDelete.Image = (Image)componentResourceManager.GetObject("btnDelete.Image");
this.btnDelete.ImageTransparentColor = Color.Magenta;
this.btnDelete.Name = "btnDelete";
this.btnDelete.Size = new Size(58, 19);
this.btnDelete.Text = "Delete";
this.btnDelete.Click += this.btnDelete_Click;
this.label17.ForeColor = Color.CornflowerBlue;
this.label17.AutoSize = true;
this.label17.Location = new Point(2, 38);
this.label17.Margin = new Padding(2, 0, 2, 0);
this.label17.Name = "label17";
this.label17.Size = new Size(39, 13);
this.label17.TabIndex = 5;
this.label17.Text = "Group:";
this.frequencyDataGridView.BackgroundColor = Color.FromArgb(64, 64, 64);
this.frequencyDataGridView.AllowUserToAddRows = false;
this.frequencyDataGridView.AllowUserToDeleteRows = false;
this.frequencyDataGridView.AllowUserToResizeRows = false;
dataGridViewCellStyle.BackColor = Color.WhiteSmoke;
this.frequencyDataGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle;
this.frequencyDataGridView.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
this.frequencyDataGridView.AutoGenerateColumns = false;
this.frequencyDataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.frequencyDataGridView.Columns.AddRange(this.nameDataGridViewTextBoxColumn, this.frequencyDataGridViewTextBoxColumn);
this.frequencyDataGridView.DataSource = this.memoryEntryBindingSource;
this.frequencyDataGridView.Location = new Point(0, 60);
this.frequencyDataGridView.Margin = new Padding(2, 2, 2, 2);
this.frequencyDataGridView.Name = "frequencyDataGridView";
this.frequencyDataGridView.RowHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single;
this.frequencyDataGridView.RowHeadersVisible = false;
this.frequencyDataGridView.RowTemplate.Height = 24;
this.frequencyDataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
this.frequencyDataGridView.ShowCellErrors = false;
this.frequencyDataGridView.ShowCellToolTips = false;
this.frequencyDataGridView.ShowEditingIcon = false;
this.frequencyDataGridView.ShowRowErrors = false;
this.frequencyDataGridView.Size = new Size(234, 329);
this.frequencyDataGridView.TabIndex = 6;
this.frequencyDataGridView.CellDoubleClick += this.frequencyDataGridView_CellDoubleClick;
this.frequencyDataGridView.CellFormatting += this.frequencyDataGridView_CellFormatting;
this.frequencyDataGridView.Scroll += this.frequencyDataGridView_Scroll;
this.frequencyDataGridView.SelectionChanged += this.frequencyDataGridView_SelectionChanged;
this.frequencyDataGridView.KeyDown += this.frequencyDataGridView_KeyDown;
this.nameDataGridViewTextBoxColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
this.nameDataGridViewTextBoxColumn.DataPropertyName = "Name";
this.nameDataGridViewTextBoxColumn.HeaderText = "Name";
this.nameDataGridViewTextBoxColumn.Name = "nameDataGridViewTextBoxColumn";
this.nameDataGridViewTextBoxColumn.ReadOnly = true;
this.frequencyDataGridViewTextBoxColumn.DataPropertyName = "Frequency";
this.frequencyDataGridViewTextBoxColumn.HeaderText = "Frequency";
this.frequencyDataGridViewTextBoxColumn.Name = "frequencyDataGridViewTextBoxColumn";
this.frequencyDataGridViewTextBoxColumn.ReadOnly = true;
this.memoryEntryBindingSource.DataSource = typeof(MemoryEntry);
this.comboGroups.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
this.comboGroups.AutoCompleteMode = AutoCompleteMode.Suggest;
this.comboGroups.AutoCompleteSource = AutoCompleteSource.ListItems;
this.comboGroups.DropDownStyle = ComboBoxStyle.DropDownList;
this.comboGroups.FormattingEnabled = true;
this.comboGroups.Location = new Point(47, 35);
this.comboGroups.Margin = new Padding(2, 2, 2, 2);
this.comboGroups.Name = "comboGroups";
this.comboGroups.Size = new Size(189, 21);
this.comboGroups.TabIndex = 4;
this.comboGroups.SelectedIndexChanged += this.comboGroups_SelectedIndexChanged;
base.AutoScaleDimensions = new SizeF(6f, 13f);
base.AutoScaleMode = AutoScaleMode.Font;
base.Controls.Add(this.mainToolStrip);
base.Controls.Add(this.label17);
base.Controls.Add(this.frequencyDataGridView);
base.Controls.Add(this.comboGroups);
base.Margin = new Padding(2, 2, 2, 2);
base.Name = "FrequencyManagerPanel";
base.Size = new Size(236, 389);
this.mainToolStrip.ResumeLayout(false);
this.mainToolStrip.PerformLayout();
((ISupportInitialize)this.frequencyDataGridView).EndInit();
((ISupportInitialize)this.memoryEntryBindingSource).EndInit();
base.ResumeLayout(false);
base.PerformLayout();
}
}
}

View file

@ -0,0 +1,164 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="btnEdit.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wQAADsEBuJFr7QAAAf9JREFUOE+Vkm9LU2EYxgd9lL5A4Ku+hFF9gIgyazZsZK6sFsNKxFYvItiitMwy
UnTm0ixL2kCnzApWuebxqOn6QyJkpaTFr/t+dubJtKgbfpzDeZ7ruu7nfo7nf4vSTSjpLR7Mh/PxWZQL
Pe8Ix/M0xKapb5+g7naWMy0ZQo1PCUaGqbmYhKYoBGuMeNUgfHeG7z8waK3Ic2kFFr7B3Fd4uwCT87Lg
iNm1DXZs5tz2rQWDhs4plkWk1EriRvxRrFXfbrG4jEGTF4XPkj6/BB++OMknj4m4FHYWxP7T3a7B2dYx
PolA+Zfk0RfWWoPa5ow5q6KikhIMzKUdsSQ74pFZGHo2jj/U5RqEGkfJy6AUk1osNVCkCxXr2uAMPElb
VJ7qcA2CkRS2TFkpGkSjUXNNRbGWriWmYCBl4Tt+xzXQ+81+xLCmg99K1x7Z0Ju0qTja6hoEwv08f49B
N/2NPgvuJWy8R264BlV1vQzLcJSRPKTknEPyPvgGktPS8iT0S3LfOMRfQ2zAptx/zTXQiSZko7JR6q/E
xqDjsU2Z74pr4DvRxkNpzTBReD4Q7gs9ktotqV1Z6BRx28uCwR5vdL3Bq1yOTDZnfhS9a70unbgOTc+t
rat4nUFF4BarVN/EGxCqWzhQ1cz+w9fZd6iJssqr7D14WYQRw+7yS46Bx/MTmEel233vFo8AAAAASUVO
RK5CYII=
</value>
</data>
<data name="btnDelete.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wQAADsEBuJFr7QAAAgVJREFUOE9jAAEvLy8DNy/PPZ6enk719fVMYEFiQWhoKLOTk2u6o6PLfydn52/e
3t6BIDGoNAqwt7dnCQoKUnJ3d82DCkEEHR2dk2ztHbaZW9r+19LS+uPu7lmFboi8vD2Hpa2jk7eX13d7
e8c5UGEIsLV1l7S3d7FwcHDZZmVj/9/O3uG/v4/nRldXV26QvIWFBae7u/sKeXmn36am5t1AS3jAGtEB
0FY2JyeXAnkH5992dk7/gd5ZZm5uo2dpaTfZ1sbmv56ByWQlJWN+qHKcgNHOzkXT1tbpvJm59X99ff3v
hsZG79W0dNfJyFhwQtUQBvr6xg56+iY/La2A4aJvdE9GRksIKkUY6JubK6ioaF3S1TP8p29g8t/E1OK/
lrbOLag0fmBoaCivpq59VU1d64+GpuYaYWEJE1lZlW0Ghsb/VdS0M6HKsANg6ErIyiufklNU/a+tZ3BI
RkZGSFxcnBuE5RTVphsYGH9R1taWhSpHBfL29hwyiqqLJKSlP2ppGT7R0jLQgkqBEgEHA4MQn7a+wVkJ
KflJQBHMhCYtJ+ctJqHwX1VNG+hUjVYGBnFwGkACTMrKWirKysr3BQQE5EF8iDAEsAkLi7YKCYv/l5dX
3sXGxqsGFMOWJ5hNTS0nc/JxmgLZqPKScspGrKzsE4FMOyDmBQtiByxAzAVhDjxgYAAAJT51jooYX84A
AAAASUVORK5CYII=
</value>
</data>
<data name="btnNewEntry.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wQAADsEBuJFr7QAAAaVJREFUOE+NkU1LAlEUhi9BK2nVNugHtGpRm6h95aZ1y/oTQdAPKIIKg7Ii7AMt
EPqAKMiKCrKICC00LRGzMDWtNG1mnLdzZ+74QTT4wuFczrnPe+ecYYZSqcGiLA8EYGeAj0GW+yPxuFUS
bXOVApZtaYRA2IBdyvf6WavlujfEtf+lBCzXZWCZYovpZ6plg11we/xw7d9gdceLlR3vuMAqkiboso1i
ikNcTv1L5imcRg1Y2DxGZ9/wX5PIPZPXJ5tVTNNlmh9PjcAR5WI7EGsROL2xuo+Dc79m4ti+mBA4jaBY
r8oj8Bfp9fJOMKbBXDOOPQ02QuBkkOs5KQOLlMMN2lmvzXFWk6yUNBPDSOC61FTbaCnUNAs3Qc+tQHqE
/oBdoICqqsgXJCTSec2go3eo1sDQkvtUILX6kRS8fxQQff0wN5h3eQRSkVJS8Zn/wUsyh4fou7nB7NqB
wCoqFGUkM9+IxLPwhZLmBrxZLb647FcRscQnApE0ru5e6zeoXlw4lsFt8A1nN8/1G1Qv7u4xBa/vBYeX
0foMeDYLUwPerCcYY+wX8jI23Xr/uKIAAAAASUVORK5CYII=
</value>
</data>
</root>

View file

@ -0,0 +1,164 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="btnEdit.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wQAADsEBuJFr7QAAAf9JREFUOE+Vkm9LU2EYxgd9lL5A4Ku+hFF9gIgyazZsZK6sFsNKxFYvItiitMwy
UnTm0ixL2kCnzApWuebxqOn6QyJkpaTFr/t+dubJtKgbfpzDeZ7ruu7nfo7nf4vSTSjpLR7Mh/PxWZQL
Pe8Ix/M0xKapb5+g7naWMy0ZQo1PCUaGqbmYhKYoBGuMeNUgfHeG7z8waK3Ic2kFFr7B3Fd4uwCT87Lg
iNm1DXZs5tz2rQWDhs4plkWk1EriRvxRrFXfbrG4jEGTF4XPkj6/BB++OMknj4m4FHYWxP7T3a7B2dYx
PolA+Zfk0RfWWoPa5ow5q6KikhIMzKUdsSQ74pFZGHo2jj/U5RqEGkfJy6AUk1osNVCkCxXr2uAMPElb
VJ7qcA2CkRS2TFkpGkSjUXNNRbGWriWmYCBl4Tt+xzXQ+81+xLCmg99K1x7Z0Ju0qTja6hoEwv08f49B
N/2NPgvuJWy8R264BlV1vQzLcJSRPKTknEPyPvgGktPS8iT0S3LfOMRfQ2zAptx/zTXQiSZko7JR6q/E
xqDjsU2Z74pr4DvRxkNpzTBReD4Q7gs9ktotqV1Z6BRx28uCwR5vdL3Bq1yOTDZnfhS9a70unbgOTc+t
rat4nUFF4BarVN/EGxCqWzhQ1cz+w9fZd6iJssqr7D14WYQRw+7yS46Bx/MTmEel233vFo8AAAAASUVO
RK5CYII=
</value>
</data>
<data name="btnDelete.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wQAADsEBuJFr7QAAAgVJREFUOE9jAAEvLy8DNy/PPZ6enk719fVMYEFiQWhoKLOTk2u6o6PLfydn52/e
3t6BIDGoNAqwt7dnCQoKUnJ3d82DCkEEHR2dk2ztHbaZW9r+19LS+uPu7lmFboi8vD2Hpa2jk7eX13d7
e8c5UGEIsLV1l7S3d7FwcHDZZmVj/9/O3uG/v4/nRldXV26QvIWFBae7u/sKeXmn36am5t1AS3jAGtEB
0FY2JyeXAnkH5992dk7/gd5ZZm5uo2dpaTfZ1sbmv56ByWQlJWN+qHKcgNHOzkXT1tbpvJm59X99ff3v
hsZG79W0dNfJyFhwQtUQBvr6xg56+iY/La2A4aJvdE9GRksIKkUY6JubK6ioaF3S1TP8p29g8t/E1OK/
lrbOLag0fmBoaCivpq59VU1d64+GpuYaYWEJE1lZlW0Ghsb/VdS0M6HKsANg6ErIyiufklNU/a+tZ3BI
RkZGSFxcnBuE5RTVphsYGH9R1taWhSpHBfL29hwyiqqLJKSlP2ppGT7R0jLQgkqBEgEHA4MQn7a+wVkJ
KflJQBHMhCYtJ+ctJqHwX1VNG+hUjVYGBnFwGkACTMrKWirKysr3BQQE5EF8iDAEsAkLi7YKCYv/l5dX
3sXGxqsGFMOWJ5hNTS0nc/JxmgLZqPKScspGrKzsE4FMOyDmBQtiByxAzAVhDjxgYAAAJT51jooYX84A
AAAASUVORK5CYII=
</value>
</data>
<data name="btnNewEntry.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wQAADsEBuJFr7QAAAaVJREFUOE+NkU1LAlEUhi9BK2nVNugHtGpRm6h95aZ1y/oTQdAPKIIKg7Ii7AMt
EPqAKMiKCrKICC00LRGzMDWtNG1mnLdzZ+74QTT4wuFczrnPe+ecYYZSqcGiLA8EYGeAj0GW+yPxuFUS
bXOVApZtaYRA2IBdyvf6WavlujfEtf+lBCzXZWCZYovpZ6plg11we/xw7d9gdceLlR3vuMAqkiboso1i
ikNcTv1L5imcRg1Y2DxGZ9/wX5PIPZPXJ5tVTNNlmh9PjcAR5WI7EGsROL2xuo+Dc79m4ti+mBA4jaBY
r8oj8Bfp9fJOMKbBXDOOPQ02QuBkkOs5KQOLlMMN2lmvzXFWk6yUNBPDSOC61FTbaCnUNAs3Qc+tQHqE
/oBdoICqqsgXJCTSec2go3eo1sDQkvtUILX6kRS8fxQQff0wN5h3eQRSkVJS8Zn/wUsyh4fou7nB7NqB
wCoqFGUkM9+IxLPwhZLmBrxZLb647FcRscQnApE0ru5e6zeoXlw4lsFt8A1nN8/1G1Qv7u4xBa/vBYeX
0foMeDYLUwPerCcYY+wX8jI23Xr/uKIAAAAASUVORK5CYII=
</value>
</data>
</root>

View file

@ -0,0 +1,30 @@
using SDRSharp.Common;
using System.Windows.Forms;
namespace SDRSharp.FrequencyManager
{
public class FrequencyManagerPlugin : ISharpPlugin
{
private const string _displayName = "Frequency Mgr";
private ISharpControl _controlInterface;
private FrequencyManagerPanel _frequencyManagerPanel;
public bool HasGui => true;
public UserControl GuiControl => this._frequencyManagerPanel;
public string DisplayName => "Frequency Mgr";
public void Close()
{
}
public void Initialize(ISharpControl control)
{
this._controlInterface = control;
this._frequencyManagerPanel = new FrequencyManagerPanel(this._controlInterface);
}
}
}

View file

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
namespace SDRSharp.FrequencyManager
{
public static class FreqManUtils
{
public static Assembly UnmanagedDLLAssemblyVer = Assembly.GetExecutingAssembly();
}
}

View file

@ -0,0 +1,135 @@
using SDRSharp.Radio;
namespace SDRSharp.FrequencyManager
{
public class MemoryEntry
{
private long _frequency;
private DetectorType _detectorType;
private string _name;
private long _shift;
private long _centerFrequency;
private string _groupName;
private long _filterBandwidth;
private bool _isFavourite;
public bool IsFavourite
{
get
{
return this._isFavourite;
}
set
{
this._isFavourite = value;
}
}
public string Name
{
get
{
return this._name;
}
set
{
this._name = value;
}
}
public string GroupName
{
get
{
return this._groupName;
}
set
{
this._groupName = value;
}
}
public long Frequency
{
get
{
return this._frequency;
}
set
{
this._frequency = value;
}
}
public DetectorType DetectorType
{
get
{
return this._detectorType;
}
set
{
this._detectorType = value;
}
}
public long Shift
{
get
{
return this._shift;
}
set
{
this._shift = value;
}
}
public long CenterFrequency
{
get
{
return this._centerFrequency;
}
set
{
this._centerFrequency = value;
}
}
public long FilterBandwidth
{
get
{
return this._filterBandwidth;
}
set
{
this._filterBandwidth = value;
}
}
public MemoryEntry()
{
}
public MemoryEntry(MemoryEntry memoryEntry)
{
this._name = memoryEntry._name;
this._groupName = memoryEntry._groupName;
this._detectorType = memoryEntry._detectorType;
this._frequency = memoryEntry._frequency;
this._shift = memoryEntry._shift;
this._centerFrequency = memoryEntry._centerFrequency;
this._filterBandwidth = memoryEntry._filterBandwidth;
this._isFavourite = memoryEntry._isFavourite;
}
}
}

View file

@ -0,0 +1,16 @@
using System;
namespace SDRSharp.FrequencyManager
{
public class MemoryInfoEventArgs : EventArgs
{
private readonly MemoryEntry _memoryEntry;
public MemoryEntry MemoryEntry => this._memoryEntry;
public MemoryInfoEventArgs(MemoryEntry entry)
{
this._memoryEntry = entry;
}
}
}

View file

@ -0,0 +1,4 @@
namespace SDRSharp.FrequencyManager
{
public delegate void RadioInfo(object sender, MemoryInfoEventArgs e);
}

View file

@ -0,0 +1,74 @@
using System;
using System.Collections.Generic;
namespace SDRSharp.FrequencyManager
{
[Serializable]
public class SerializableDictionary<TKey, TValue>
{
private List<TKey> _keys = new List<TKey>();
private List<TValue> _values = new List<TValue>();
public TValue this[TKey index]
{
get
{
int num = this._keys.IndexOf(index);
if (num != -1)
{
return this._values[num];
}
throw new KeyNotFoundException();
}
set
{
int num = this._keys.IndexOf(index);
if (num == -1)
{
this._keys.Add(index);
this._values.Add(value);
}
else
{
this._values[num] = value;
}
}
}
public List<TKey> Keys
{
get
{
return this._keys;
}
set
{
this._keys = value;
}
}
public List<TValue> Values
{
get
{
return this._values;
}
set
{
this._values = value;
}
}
public bool ContainsKey(TKey key)
{
return this._keys.IndexOf(key) != -1;
}
public void Clear()
{
this._keys.Clear();
this._values.Clear();
}
}
}

View file

@ -0,0 +1,59 @@
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
using System.Xml.Serialization;
namespace SDRSharp.FrequencyManager
{
public class SettingsPersister
{
private const string FreqMgrFilename = "frequencies.xml";
private readonly string _settingsFolder;
public SettingsPersister()
{
this._settingsFolder = Path.GetDirectoryName(Application.ExecutablePath);
}
public List<MemoryEntry> ReadStoredFrequencies()
{
List<MemoryEntry> list = this.ReadObject<List<MemoryEntry>>("frequencies.xml");
if (list != null)
{
list.Sort((MemoryEntry e1, MemoryEntry e2) => e1.Frequency.CompareTo(e2.Frequency));
return list;
}
return new List<MemoryEntry>();
}
public void PersistStoredFrequencies(List<MemoryEntry> entries)
{
this.WriteObject(entries, "frequencies.xml");
}
private T ReadObject<T>(string fileName)
{
string path = Path.Combine(this._settingsFolder, fileName);
if (File.Exists(path))
{
using (FileStream stream = new FileStream(path, FileMode.Open))
{
XmlSerializer xmlSerializer = new XmlSerializer(typeof(T));
return (T)xmlSerializer.Deserialize(stream);
}
}
return default(T);
}
private void WriteObject<T>(T obj, string fileName)
{
string path = Path.Combine(this._settingsFolder, fileName);
using (FileStream stream = new FileStream(path, FileMode.Create))
{
XmlSerializer xmlSerializer = new XmlSerializer(obj.GetType());
xmlSerializer.Serialize(stream, obj);
}
}
}
}

View file

@ -0,0 +1,40 @@
using System.Collections.Generic;
using System.ComponentModel;
namespace SDRSharp.FrequencyManager
{
public class SortableBindingList<T> : BindingList<T>
{
private bool _isSorted;
private PropertyDescriptor _sortProperty;
private ListSortDirection _sortDirection;
protected override bool SupportsSortingCore => true;
protected override ListSortDirection SortDirectionCore => this._sortDirection;
protected override PropertyDescriptor SortPropertyCore => this._sortProperty;
protected override bool IsSortedCore => this._isSorted;
protected override void ApplySortCore(PropertyDescriptor property, ListSortDirection direction)
{
List<T> list = (List<T>)base.Items;
if (list != null)
{
SortableBindingListComparer<T> comparer = new SortableBindingListComparer<T>(property.Name, direction);
list.Sort(comparer);
this._isSorted = true;
}
else
{
this._isSorted = false;
}
this._sortProperty = property;
this._sortDirection = direction;
this.OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1));
}
}
}

View file

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Reflection;
namespace SDRSharp.FrequencyManager
{
public class SortableBindingListComparer<T> : IComparer<T>
{
private PropertyInfo _sortProperty;
private ListSortDirection _sortDirection;
public SortableBindingListComparer(string sortProperty, ListSortDirection sortDirection)
{
this._sortProperty = typeof(T).GetProperty(sortProperty);
this._sortDirection = sortDirection;
}
public int Compare(T x, T y)
{
IComparable comparable = (IComparable)this._sortProperty.GetValue(x, null);
IComparable comparable2 = (IComparable)this._sortProperty.GetValue(y, null);
if (this._sortDirection == ListSortDirection.Ascending)
{
return comparable.CompareTo(comparable2);
}
return comparable2.CompareTo(comparable);
}
}
}

View file

@ -0,0 +1,21 @@
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Fast Scanner for SDR#")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("rtl-sdr.ru")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(true)]
[assembly: Guid("a80d3b15-c0c9-4d61-8bd6-b87954dce39d")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]

View file

@ -0,0 +1,49 @@
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Resources;
using System.Runtime.CompilerServices;
namespace SDRSharp.FrequencyScanner.Properties
{
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[DebuggerNonUserCode]
[CompilerGenerated]
internal class Resources
{
private static ResourceManager resourceMan;
private static CultureInfo resourceCulture;
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static ResourceManager ResourceManager
{
get
{
if (Resources.resourceMan == null)
{
Resources.resourceMan = new ResourceManager("SDRSharp.FrequencyScanner.Properties.Resources", typeof(Resources).Assembly);
}
return Resources.resourceMan;
}
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static CultureInfo Culture
{
get
{
return Resources.resourceCulture;
}
set
{
Resources.resourceCulture = value;
}
}
internal Resources()
{
}
}
}

View file

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{1FF2D27C-12DF-4FD3-A548-400D6901030D}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<OutputType>Library</OutputType>
<AssemblyName>SDRSharp.FrequencyScanner</AssemblyName>
<TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>bin\Debug\</OutputPath>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>bin\Release\</OutputPath>
<DebugSymbols>true</DebugSymbols>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
</PropertyGroup>
<ItemGroup>
<Reference Include="SDRSharp.Radio">
<HintPath>C:\Users\James\Downloads\RTL-SDR Stuff\SDRSharper_06l\SDRSharp.Radio.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms">
<HintPath>C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089\System.Windows.Forms.dll</HintPath>
</Reference>
<Reference Include="System">
<HintPath>C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll</HintPath>
</Reference>
<Reference Include="SDRSharp.Common">
<HintPath>C:\Users\James\Downloads\RTL-SDR Stuff\SDRSharper_06l\SDRSharp.Common.dll</HintPath>
</Reference>
<Reference Include="System.Drawing">
<HintPath>C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll</HintPath>
</Reference>
<Reference Include="System.Xml">
<HintPath>C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SDRSharp.FrequencyScanner.Properties\Resources.cs" />
<Compile Include="SDRSharp.FrequencyScanner\ChannelAnalizerMemoryEntry.cs" />
<Compile Include="SDRSharp.FrequencyScanner\ChannelAnalyzer.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="SDRSharp.FrequencyScanner\CustomPaintEventArgs.cs" />
<Compile Include="SDRSharp.FrequencyScanner\CustomPaintEventHandler.cs" />
<Compile Include="SDRSharp.FrequencyScanner\DialogConfigure.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="SDRSharp.FrequencyScanner\DialogEditRange.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="SDRSharp.FrequencyScanner\FrequencyScannerPanel.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="SDRSharp.FrequencyScanner\FrequencyScannerPlugin.cs" />
<Compile Include="SDRSharp.FrequencyScanner\IFProcessor.cs" />
<Compile Include="SDRSharp.FrequencyScanner\MemoryEntry.cs" />
<Compile Include="SDRSharp.FrequencyScanner\MemoryEntryFrequencyRange.cs" />
<Compile Include="SDRSharp.FrequencyScanner\MemoryEntryNewFrequency.cs" />
<Compile Include="SDRSharp.FrequencyScanner\MemoryEntryNewSkipAndRangeFrequency.cs" />
<Compile Include="SDRSharp.FrequencyScanner\SerializableDictionary.cs" />
<Compile Include="SDRSharp.FrequencyScanner\SettingsPersister.cs" />
<Compile Include="SDRSharp.FrequencyScanner\SortableBindingList.cs" />
<Compile Include="SDRSharp.FrequencyScanner\SortableBindingListComparer.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="SDRSharp.FrequencyScanner\ChannelAnalyzer.resx">
<DependentUpon>ChannelAnalyzer.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="SDRSharp.FrequencyScanner\DialogConfigure.resx">
<DependentUpon>DialogConfigure.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="SDRSharp.FrequencyScanner\DialogEditRange.resx">
<DependentUpon>DialogEditRange.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="SDRSharp.FrequencyScanner\FrequencyScannerPanel.resx">
<DependentUpon>FrequencyScannerPanel.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View file

@ -0,0 +1,195 @@
using SDRSharp.Radio;
namespace SDRSharp.FrequencyScanner
{
public class ChannelAnalizerMemoryEntry
{
private long _frequency;
private long _centerFrequency;
private float _level;
private int _activity;
private bool _skipped;
private bool _isStore;
private string _storeName;
private int _filterBandwidth;
private DetectorType _detectorType;
private int _stepSize;
private int _startBins;
private int _endBins;
public long Frequency
{
get
{
return this._frequency;
}
set
{
this._frequency = value;
}
}
public long CenterFrequency
{
get
{
return this._centerFrequency;
}
set
{
this._centerFrequency = value;
}
}
public string StoreName
{
get
{
return this._storeName;
}
set
{
this._storeName = value;
}
}
public bool IsStore
{
get
{
return this._isStore;
}
set
{
this._isStore = value;
}
}
public float Level
{
get
{
return this._level;
}
set
{
this._level = value;
}
}
public bool Skipped
{
get
{
return this._skipped;
}
set
{
this._skipped = value;
}
}
public int Activity
{
get
{
return this._activity;
}
set
{
this._activity = value;
}
}
public int StartBins
{
get
{
return this._startBins;
}
set
{
this._startBins = value;
}
}
public int EndBins
{
get
{
return this._endBins;
}
set
{
this._endBins = value;
}
}
public int FilterBandwidth
{
get
{
return this._filterBandwidth;
}
set
{
this._filterBandwidth = value;
}
}
public int StepSize
{
get
{
return this._stepSize;
}
set
{
this._stepSize = value;
}
}
public DetectorType DetectorType
{
get
{
return this._detectorType;
}
set
{
this._detectorType = value;
}
}
public ChannelAnalizerMemoryEntry()
{
}
public ChannelAnalizerMemoryEntry(ChannelAnalizerMemoryEntry ChannelAnalizerMemoryEntry)
{
this._frequency = ChannelAnalizerMemoryEntry._frequency;
this._centerFrequency = ChannelAnalizerMemoryEntry._centerFrequency;
this._level = ChannelAnalizerMemoryEntry._level;
this._activity = ChannelAnalizerMemoryEntry._activity;
this._skipped = ChannelAnalizerMemoryEntry._skipped;
this._isStore = ChannelAnalizerMemoryEntry._isStore;
this._storeName = ChannelAnalizerMemoryEntry._storeName;
this._filterBandwidth = ChannelAnalizerMemoryEntry._filterBandwidth;
this._detectorType = ChannelAnalizerMemoryEntry._detectorType;
this._stepSize = ChannelAnalizerMemoryEntry._stepSize;
this._startBins = ChannelAnalizerMemoryEntry._startBins;
this._endBins = ChannelAnalizerMemoryEntry._endBins;
}
}
}

View file

@ -0,0 +1,381 @@
using SDRSharp.Radio;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Windows.Forms;
namespace SDRSharp.FrequencyScanner
{
public class ChannelAnalyzer : UserControl
{
private const float TrackingFontSize = 16f;
private const int CarrierPenWidth = 1;
private const int GradientAlpha = 180;
public const int AxisMargin = 2;
public const float DefaultCursorHeight = 32f;
private bool _drawBackgroundNeeded;
private Bitmap _bkgBuffer;
private Bitmap _buffer;
private Graphics _graphics;
private float _xIncrement;
private float _yIncrement;
private long _playFrequency;
private int _playFrequencyIndex;
private List<ChannelAnalizerMemoryEntry> _channelArray;
private int _zoom;
private int _zoomPosition;
private float _defXIncrement;
public long Frequency
{
set
{
this._playFrequency = value;
}
}
public int Zoom
{
get
{
return this._zoom;
}
set
{
this._zoom = value;
}
}
public int ZoomPosition
{
get
{
return this._zoomPosition;
}
set
{
this._zoomPosition = value;
}
}
public event CustomPaintEventHandler CustomPaint;
public ChannelAnalyzer()
{
Rectangle clientRectangle = base.ClientRectangle;
int width = clientRectangle.Width;
clientRectangle = base.ClientRectangle;
this._bkgBuffer = new Bitmap(width, clientRectangle.Height, PixelFormat.Format32bppPArgb);
clientRectangle = base.ClientRectangle;
int width2 = clientRectangle.Width;
clientRectangle = base.ClientRectangle;
this._buffer = new Bitmap(width2, clientRectangle.Height, PixelFormat.Format32bppPArgb);
this._graphics = Graphics.FromImage(this._buffer);
base.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
base.SetStyle(ControlStyles.DoubleBuffer, true);
base.SetStyle(ControlStyles.UserPaint, true);
base.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
base.UpdateStyles();
}
~ChannelAnalyzer()
{
this._buffer.Dispose();
this._graphics.Dispose();
}
public void Perform(List<ChannelAnalizerMemoryEntry> channelArray)
{
this._channelArray = channelArray;
if (this._drawBackgroundNeeded)
{
this.DrawBackground();
}
this.DrawForeground();
base.Invalidate();
this._drawBackgroundNeeded = false;
}
private void DrawBackground()
{
using (SolidBrush solidBrush = new SolidBrush(Color.Silver))
{
using (Pen pen = new Pen(Color.FromArgb(80, 80, 80)))
{
using (new Pen(Color.DarkGray))
{
using (Font font = new Font("Arial", 8f))
{
using (Graphics graphics = Graphics.FromImage(this._bkgBuffer))
{
ChannelAnalyzer.ConfigureGraphics(graphics);
graphics.Clear(Color.Black);
pen.DashStyle = DashStyle.Dash;
int num = 20;
Rectangle clientRectangle = base.ClientRectangle;
int num2 = (clientRectangle.Height - 4) / num;
for (int i = 1; i <= num2; i++)
{
Graphics graphics2 = graphics;
Pen pen2 = pen;
clientRectangle = base.ClientRectangle;
int y = clientRectangle.Height - 2 - i * num;
clientRectangle = base.ClientRectangle;
int x = clientRectangle.Width - 2;
clientRectangle = base.ClientRectangle;
graphics2.DrawLine(pen2, 2, y, x, clientRectangle.Height - 2 - i * num);
}
for (int j = 1; j <= num2; j++)
{
string text = (j * num / 2 - 10).ToString();
SizeF sizeF = graphics.MeasureString(text, font);
float width = sizeF.Width;
float height = sizeF.Height;
Graphics graphics3 = graphics;
string s = text;
Font font2 = font;
SolidBrush brush = solidBrush;
clientRectangle = base.ClientRectangle;
graphics3.DrawString(s, font2, brush, 4f, (float)(clientRectangle.Height - 2 - j * num) - height + 1f);
}
}
}
}
}
}
}
private string GetFrequencyDisplay(long frequency)
{
if (frequency == 0L)
{
return "DC";
}
if (Math.Abs(frequency) > 1500000000)
{
return $"{(double)frequency / 1000000000.0:#,0.000 000}GHz";
}
if (Math.Abs(frequency) > 30000000)
{
return $"{(double)frequency / 1000000.0:0,0.000###}MHz";
}
if (Math.Abs(frequency) > 1000)
{
return $"{(double)frequency / 1000.0:#,#.###}kHz";
}
return $"{frequency}Hz";
}
public static void ConfigureGraphics(Graphics graphics)
{
graphics.CompositingMode = CompositingMode.SourceOver;
graphics.CompositingQuality = CompositingQuality.HighSpeed;
graphics.SmoothingMode = SmoothingMode.None;
graphics.PixelOffsetMode = PixelOffsetMode.HighSpeed;
graphics.InterpolationMode = InterpolationMode.High;
}
private void DrawForeground()
{
Rectangle clientRectangle = base.ClientRectangle;
if (clientRectangle.Width > 2)
{
clientRectangle = base.ClientRectangle;
if (clientRectangle.Height > 2)
{
this.CopyBackground();
this.DrawSpectrum();
this.OnCustomPaint(new CustomPaintEventArgs(this._graphics));
}
}
}
private unsafe void CopyBackground()
{
BitmapData bitmapData = this._buffer.LockBits(base.ClientRectangle, ImageLockMode.WriteOnly, this._buffer.PixelFormat);
BitmapData bitmapData2 = this._bkgBuffer.LockBits(base.ClientRectangle, ImageLockMode.ReadOnly, this._bkgBuffer.PixelFormat);
Utils.Memcpy((void*)bitmapData.Scan0, (void*)bitmapData2.Scan0, Math.Abs(bitmapData.Stride) * bitmapData.Height);
this._buffer.UnlockBits(bitmapData);
this._bkgBuffer.UnlockBits(bitmapData2);
}
private void DrawSpectrum()
{
if (this._channelArray != null && this._channelArray.Count != 0)
{
Rectangle clientRectangle = base.ClientRectangle;
this._xIncrement = (float)(clientRectangle.Width - 4) / (float)this._channelArray.Count * (float)(this._zoom + 1);
this._yIncrement = 2f;
clientRectangle = base.ClientRectangle;
this._defXIncrement = (float)(clientRectangle.Width - 4) / (float)this._channelArray.Count;
float num = 0f;
float num2 = 0f;
this._playFrequencyIndex = -1;
using (Pen pen = new Pen(Color.SkyBlue))
{
using (Pen pen4 = new Pen(Color.DarkRed))
{
using (Pen pen5 = new Pen(Color.Yellow))
{
using (Pen pen3 = new Pen(Color.Green))
{
for (int i = 0; i < this._channelArray.Count; i++)
{
float num3 = (float)Math.Max((int)this._channelArray[i].Level, 4) * this._yIncrement;
float num4 = this._xIncrement - 1f;
if (this._xIncrement < 3f)
{
num4 = this._xIncrement;
}
float num5 = 2f + (float)i * this._xIncrement - (float)(this._zoomPosition * (this._zoom + 1)) + (float)this._zoomPosition + num4 * 0.5f;
clientRectangle = base.ClientRectangle;
float num6 = (float)Math.Max(2, (int)((float)(clientRectangle.Height - 2) - num3));
float val = num3;
clientRectangle = base.ClientRectangle;
num3 = Math.Min(val, (float)(clientRectangle.Height - 4));
if (!(num5 < 2f))
{
float num7 = num5;
clientRectangle = base.ClientRectangle;
if (!(num7 > (float)(clientRectangle.Width - 2)))
{
Pen pen2 = pen;
if (this._playFrequency > this._channelArray[i].Frequency - this._channelArray[i].StepSize / 2 && this._playFrequency < this._channelArray[i].Frequency + this._channelArray[i].StepSize / 2)
{
num = num5;
num2 = num6;
this._playFrequencyIndex = i;
}
if (this._channelArray[i].IsStore)
{
pen2 = pen3;
}
if (this._channelArray[i].Skipped)
{
pen2 = ((!this._channelArray[i].IsStore) ? pen4 : pen5);
}
pen2.Width = num4;
this._graphics.DrawLine(pen2, num5, num6, num5, num6 + num3);
}
}
}
}
}
}
}
using (SolidBrush brush = new SolidBrush(Color.White))
{
using (Pen pen6 = new Pen(Color.White))
{
using (Font font = new Font("Arial", 8f))
{
if (this._playFrequencyIndex >= 0 && this._playFrequencyIndex < this._channelArray.Count)
{
string str = this.GetFrequencyDisplay(this._channelArray[this._playFrequencyIndex].Frequency) + " ";
str = ((!this._channelArray[this._playFrequencyIndex].IsStore) ? (str + "Unknown") : (str + this._channelArray[this._playFrequencyIndex].StoreName));
SizeF sizeF = this._graphics.MeasureString(str, font);
float width = sizeF.Width;
float height = sizeF.Height;
float num8 = 0f;
int num9 = 62;
this._graphics.DrawLine(pen6, num, num2 - 10f, num, (float)num9 + height + 4f);
float num10 = num + width + 10f;
clientRectangle = base.ClientRectangle;
num8 = ((!(num10 > (float)clientRectangle.Width)) ? num : (num - width));
this._graphics.DrawLine(pen6, num8, (float)num9 + height + 4f, num8 + width, (float)num9 + height + 4f);
this._graphics.DrawString(str, font, brush, num8, (float)num9);
}
}
}
}
}
}
protected override void OnPaint(PaintEventArgs e)
{
ChannelAnalyzer.ConfigureGraphics(e.Graphics);
e.Graphics.DrawImageUnscaled(this._buffer, 0, 0);
}
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
Rectangle clientRectangle = base.ClientRectangle;
if (clientRectangle.Width > 0)
{
clientRectangle = base.ClientRectangle;
if (clientRectangle.Height > 0)
{
this._buffer.Dispose();
this._graphics.Dispose();
this._bkgBuffer.Dispose();
clientRectangle = base.ClientRectangle;
int width = clientRectangle.Width;
clientRectangle = base.ClientRectangle;
this._buffer = new Bitmap(width, clientRectangle.Height, PixelFormat.Format32bppPArgb);
this._graphics = Graphics.FromImage(this._buffer);
ChannelAnalyzer.ConfigureGraphics(this._graphics);
clientRectangle = base.ClientRectangle;
int width2 = clientRectangle.Width;
clientRectangle = base.ClientRectangle;
this._bkgBuffer = new Bitmap(width2, clientRectangle.Height, PixelFormat.Format32bppPArgb);
this._drawBackgroundNeeded = true;
this.Perform(this._channelArray);
}
}
}
protected virtual void OnCustomPaint(CustomPaintEventArgs e)
{
CustomPaintEventHandler customPaint = this.CustomPaint;
customPaint?.Invoke(this, e);
}
public int CurrentChannelIndex()
{
return this._playFrequencyIndex;
}
public int PointToChannel(float point)
{
int num = 0;
num = (int)(((float)(this._zoomPosition * (this._zoom + 1)) + point - (float)this._zoomPosition - 2f) / this._xIncrement);
if (num < 0)
{
num = 0;
}
if (num >= this._channelArray.Count)
{
num = this._channelArray.Count - 1;
}
return num;
}
private void InitializeComponent()
{
base.SuspendLayout();
this.AutoSize = true;
this.DoubleBuffered = true;
base.Name = "ChannelAnalyzer";
base.ResumeLayout(false);
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,25 @@
using System;
using System.Drawing;
namespace SDRSharp.FrequencyScanner
{
public class CustomPaintEventArgs : EventArgs
{
public Graphics Graphics
{
get;
private set;
}
public bool Cancel
{
get;
set;
}
public CustomPaintEventArgs(Graphics graphics)
{
this.Graphics = graphics;
}
}
}

View file

@ -0,0 +1,4 @@
namespace SDRSharp.FrequencyScanner
{
public delegate void CustomPaintEventHandler(object sender, CustomPaintEventArgs e);
}

View file

@ -0,0 +1,556 @@
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace SDRSharp.FrequencyScanner
{
public class DialogConfigure : Form
{
private FrequencyScannerPanel _frequencyScannerPanel;
private IContainer components;
private CheckBox autoSkipCheckBox;
private CheckBox autoLockCheckBox;
private CheckBox autoClearCheckBox;
private NumericUpDown LockIntervalNumericUpDown;
private NumericUpDown activityNumericUpDown;
private NumericUpDown autoClearIntervalNumericUpDown;
private NumericUpDown skipIntervalNumericUpDown;
private Label label1;
private Label label2;
private Button okButton;
private Label label3;
private Label label4;
private Label label5;
private CheckBox channelDetectMetodCheckBox;
private CheckBox useMuteCheckBox;
private NumericUpDown unMuteNumericUpDown;
private Label label7;
private CheckBox maximumChannelCheckBox;
private GroupBox groupBox2;
private CheckBox debugCheckBox;
private Label label8;
private NumericUpDown maxAlphaNumericUpDown;
private NumericUpDown minAlphaNumericUpDown;
private Label label6;
private Label label9;
private Label label10;
private ComboBox pluginPositionComboBox;
public DialogConfigure(FrequencyScannerPanel frequencyScannerPanel)
{
this.InitializeComponent();
this._frequencyScannerPanel = frequencyScannerPanel;
this.autoSkipCheckBox.Checked = this._frequencyScannerPanel.AutoSkipEnabled;
this.skipIntervalNumericUpDown.Value = this._frequencyScannerPanel.AutoSkipInterval;
this.autoLockCheckBox.Checked = this._frequencyScannerPanel.AutoLockEnabled;
this.LockIntervalNumericUpDown.Value = this._frequencyScannerPanel.AutoLockInterval;
this.autoClearCheckBox.Checked = this._frequencyScannerPanel.AutoClearEnabled;
this.activityNumericUpDown.Value = (decimal)this._frequencyScannerPanel.AutoClearActivityLevel;
this.autoClearIntervalNumericUpDown.Value = this._frequencyScannerPanel.AutoClearInterval;
this.channelDetectMetodCheckBox.Checked = this._frequencyScannerPanel.ChannelDetectMetod;
this.useMuteCheckBox.Checked = this._frequencyScannerPanel.UseMute;
this.unMuteNumericUpDown.Value = this._frequencyScannerPanel.UnMuteDelay;
this.maximumChannelCheckBox.Checked = this._frequencyScannerPanel.MaxLevelSelect;
this.debugCheckBox.Checked = this._frequencyScannerPanel.ShowDebugInfo;
this.maxAlphaNumericUpDown.Value = this._frequencyScannerPanel.MaxButtonsAlpha;
this.minAlphaNumericUpDown.Value = this._frequencyScannerPanel.MinButtonsAlpha;
this.pluginPositionComboBox.SelectedIndex = this._frequencyScannerPanel.ScannerPluginPosition;
}
private void okButton_Click(object sender, EventArgs e)
{
this._frequencyScannerPanel.AutoSkipEnabled = this.autoSkipCheckBox.Checked;
this._frequencyScannerPanel.AutoSkipInterval = (int)this.skipIntervalNumericUpDown.Value;
this._frequencyScannerPanel.AutoLockEnabled = this.autoLockCheckBox.Checked;
this._frequencyScannerPanel.AutoLockInterval = (int)this.LockIntervalNumericUpDown.Value;
this._frequencyScannerPanel.AutoClearEnabled = this.autoClearCheckBox.Checked;
this._frequencyScannerPanel.AutoClearActivityLevel = (float)this.activityNumericUpDown.Value;
this._frequencyScannerPanel.AutoClearInterval = (int)this.autoClearIntervalNumericUpDown.Value;
this._frequencyScannerPanel.ChannelDetectMetod = this.channelDetectMetodCheckBox.Checked;
this._frequencyScannerPanel.UseMute = this.useMuteCheckBox.Checked;
this._frequencyScannerPanel.UnMuteDelay = (int)this.unMuteNumericUpDown.Value;
this._frequencyScannerPanel.MaxLevelSelect = this.maximumChannelCheckBox.Checked;
this._frequencyScannerPanel.MaxButtonsAlpha = (int)this.maxAlphaNumericUpDown.Value;
this._frequencyScannerPanel.MinButtonsAlpha = (int)this.minAlphaNumericUpDown.Value;
this._frequencyScannerPanel.ScannerPluginPosition = this.pluginPositionComboBox.SelectedIndex;
}
private void useMuteCheckBox_CheckedChanged(object sender, EventArgs e)
{
this._frequencyScannerPanel.UseMute = this.useMuteCheckBox.Checked;
this.unMuteNumericUpDown.Enabled = this.useMuteCheckBox.Checked;
}
private void unMuteNumericUpDown_ValueChanged(object sender, EventArgs e)
{
this._frequencyScannerPanel.UnMuteDelay = (int)this.unMuteNumericUpDown.Value;
}
private void debugCheckBox_CheckedChanged(object sender, EventArgs e)
{
this._frequencyScannerPanel.ShowDebugInfo = this.debugCheckBox.Checked;
}
private void minAlphaNumericUpDown_ValueChanged(object sender, EventArgs e)
{
this._frequencyScannerPanel.MinButtonsAlpha = (int)this.minAlphaNumericUpDown.Value;
}
private void maxAlphaNumericUpDown_ValueChanged(object sender, EventArgs e)
{
this._frequencyScannerPanel.MaxButtonsAlpha = (int)this.maxAlphaNumericUpDown.Value;
}
private void label10_Click(object sender, EventArgs e)
{
}
protected override void Dispose(bool disposing)
{
if (disposing && this.components != null)
{
this.components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.autoSkipCheckBox = new CheckBox();
this.autoLockCheckBox = new CheckBox();
this.autoClearCheckBox = new CheckBox();
this.LockIntervalNumericUpDown = new NumericUpDown();
this.activityNumericUpDown = new NumericUpDown();
this.autoClearIntervalNumericUpDown = new NumericUpDown();
this.skipIntervalNumericUpDown = new NumericUpDown();
this.label1 = new Label();
this.label2 = new Label();
this.okButton = new Button();
this.label3 = new Label();
this.label4 = new Label();
this.label5 = new Label();
this.channelDetectMetodCheckBox = new CheckBox();
this.useMuteCheckBox = new CheckBox();
this.unMuteNumericUpDown = new NumericUpDown();
this.label7 = new Label();
this.maximumChannelCheckBox = new CheckBox();
this.groupBox2 = new GroupBox();
this.label9 = new Label();
this.label8 = new Label();
this.maxAlphaNumericUpDown = new NumericUpDown();
this.minAlphaNumericUpDown = new NumericUpDown();
this.label6 = new Label();
this.debugCheckBox = new CheckBox();
this.label10 = new Label();
this.pluginPositionComboBox = new ComboBox();
((ISupportInitialize)this.LockIntervalNumericUpDown).BeginInit();
((ISupportInitialize)this.activityNumericUpDown).BeginInit();
((ISupportInitialize)this.autoClearIntervalNumericUpDown).BeginInit();
((ISupportInitialize)this.skipIntervalNumericUpDown).BeginInit();
((ISupportInitialize)this.unMuteNumericUpDown).BeginInit();
this.groupBox2.SuspendLayout();
((ISupportInitialize)this.maxAlphaNumericUpDown).BeginInit();
((ISupportInitialize)this.minAlphaNumericUpDown).BeginInit();
base.SuspendLayout();
this.autoSkipCheckBox.AutoSize = true;
this.autoSkipCheckBox.Location = new Point(6, 19);
this.autoSkipCheckBox.Name = "autoSkipCheckBox";
this.autoSkipCheckBox.Size = new Size(70, 17);
this.autoSkipCheckBox.TabIndex = 0;
this.autoSkipCheckBox.Text = "Auto skip";
this.autoSkipCheckBox.UseVisualStyleBackColor = true;
this.autoLockCheckBox.AutoSize = true;
this.autoLockCheckBox.Location = new Point(6, 42);
this.autoLockCheckBox.Name = "autoLockCheckBox";
this.autoLockCheckBox.Size = new Size(71, 17);
this.autoLockCheckBox.TabIndex = 1;
this.autoLockCheckBox.Text = "Auto lock";
this.autoLockCheckBox.UseVisualStyleBackColor = true;
this.autoClearCheckBox.AutoSize = true;
this.autoClearCheckBox.Location = new Point(6, 65);
this.autoClearCheckBox.Name = "autoClearCheckBox";
this.autoClearCheckBox.Size = new Size(15, 14);
this.autoClearCheckBox.TabIndex = 2;
this.autoClearCheckBox.UseVisualStyleBackColor = true;
this.LockIntervalNumericUpDown.Location = new Point(82, 41);
this.LockIntervalNumericUpDown.Maximum = new decimal(new int[4]
{
3600,
0,
0,
0
});
this.LockIntervalNumericUpDown.Minimum = new decimal(new int[4]
{
1,
0,
0,
0
});
this.LockIntervalNumericUpDown.Name = "LockIntervalNumericUpDown";
this.LockIntervalNumericUpDown.Size = new Size(55, 20);
this.LockIntervalNumericUpDown.TabIndex = 3;
this.LockIntervalNumericUpDown.Value = new decimal(new int[4]
{
30,
0,
0,
0
});
this.activityNumericUpDown.DecimalPlaces = 1;
this.activityNumericUpDown.Increment = new decimal(new int[4]
{
1,
0,
0,
65536
});
this.activityNumericUpDown.Location = new Point(166, 63);
this.activityNumericUpDown.Maximum = new decimal(new int[4]
{
1000,
0,
0,
0
});
this.activityNumericUpDown.Minimum = new decimal(new int[4]
{
1,
0,
0,
65536
});
this.activityNumericUpDown.Name = "activityNumericUpDown";
this.activityNumericUpDown.Size = new Size(47, 20);
this.activityNumericUpDown.TabIndex = 4;
this.activityNumericUpDown.Value = new decimal(new int[4]
{
1,
0,
0,
0
});
this.autoClearIntervalNumericUpDown.Location = new Point(258, 63);
this.autoClearIntervalNumericUpDown.Maximum = new decimal(new int[4]
{
1000,
0,
0,
0
});
this.autoClearIntervalNumericUpDown.Minimum = new decimal(new int[4]
{
1,
0,
0,
0
});
this.autoClearIntervalNumericUpDown.Name = "autoClearIntervalNumericUpDown";
this.autoClearIntervalNumericUpDown.Size = new Size(43, 20);
this.autoClearIntervalNumericUpDown.TabIndex = 5;
this.autoClearIntervalNumericUpDown.Value = new decimal(new int[4]
{
1,
0,
0,
0
});
this.skipIntervalNumericUpDown.Location = new Point(82, 18);
this.skipIntervalNumericUpDown.Maximum = new decimal(new int[4]
{
3600,
0,
0,
0
});
this.skipIntervalNumericUpDown.Minimum = new decimal(new int[4]
{
1,
0,
0,
0
});
this.skipIntervalNumericUpDown.Name = "skipIntervalNumericUpDown";
this.skipIntervalNumericUpDown.Size = new Size(55, 20);
this.skipIntervalNumericUpDown.TabIndex = 6;
this.skipIntervalNumericUpDown.Value = new decimal(new int[4]
{
10,
0,
0,
0
});
this.label1.AutoSize = true;
this.label1.Location = new Point(27, 65);
this.label1.Name = "label1";
this.label1.Size = new Size(133, 13);
this.label1.TabIndex = 7;
this.label1.Text = "Delete rows with activity <";
this.label2.AutoSize = true;
this.label2.Location = new Point(219, 65);
this.label2.Name = "label2";
this.label2.Size = new Size(33, 13);
this.label2.TabIndex = 8;
this.label2.Text = "every";
this.okButton.DialogResult = DialogResult.OK;
this.okButton.Location = new Point(304, 253);
this.okButton.Name = "okButton";
this.okButton.Size = new Size(75, 23);
this.okButton.TabIndex = 9;
this.okButton.Text = "Ok";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += this.okButton_Click;
this.label3.AutoSize = true;
this.label3.Location = new Point(143, 20);
this.label3.Name = "label3";
this.label3.Size = new Size(47, 13);
this.label3.TabIndex = 10;
this.label3.Text = "seconds";
this.label4.AutoSize = true;
this.label4.Location = new Point(144, 43);
this.label4.Name = "label4";
this.label4.Size = new Size(47, 13);
this.label4.TabIndex = 11;
this.label4.Text = "seconds";
this.label5.AutoSize = true;
this.label5.Location = new Point(307, 65);
this.label5.Name = "label5";
this.label5.Size = new Size(47, 13);
this.label5.TabIndex = 12;
this.label5.Text = "seconds";
this.channelDetectMetodCheckBox.AutoSize = true;
this.channelDetectMetodCheckBox.Location = new Point(6, 89);
this.channelDetectMetodCheckBox.Name = "channelDetectMetodCheckBox";
this.channelDetectMetodCheckBox.Size = new Size(310, 17);
this.channelDetectMetodCheckBox.TabIndex = 13;
this.channelDetectMetodCheckBox.Text = "Detect channel only center frequency (default all bandwidth)";
this.channelDetectMetodCheckBox.UseVisualStyleBackColor = true;
this.useMuteCheckBox.AutoSize = true;
this.useMuteCheckBox.Location = new Point(6, 135);
this.useMuteCheckBox.Name = "useMuteCheckBox";
this.useMuteCheckBox.Size = new Size(100, 17);
this.useMuteCheckBox.TabIndex = 16;
this.useMuteCheckBox.Text = "Use audio mute";
this.useMuteCheckBox.UseVisualStyleBackColor = true;
this.useMuteCheckBox.CheckedChanged += this.useMuteCheckBox_CheckedChanged;
this.unMuteNumericUpDown.Location = new Point(230, 134);
this.unMuteNumericUpDown.Maximum = new decimal(new int[4]
{
20,
0,
0,
0
});
this.unMuteNumericUpDown.Name = "unMuteNumericUpDown";
this.unMuteNumericUpDown.Size = new Size(48, 20);
this.unMuteNumericUpDown.TabIndex = 17;
this.unMuteNumericUpDown.Value = new decimal(new int[4]
{
5,
0,
0,
0
});
this.unMuteNumericUpDown.ValueChanged += this.unMuteNumericUpDown_ValueChanged;
this.label7.AutoSize = true;
this.label7.Location = new Point(112, 136);
this.label7.Name = "label7";
this.label7.Size = new Size(112, 13);
this.label7.TabIndex = 18;
this.label7.Text = "Noise protection delay";
this.maximumChannelCheckBox.AutoSize = true;
this.maximumChannelCheckBox.Location = new Point(6, 112);
this.maximumChannelCheckBox.Name = "maximumChannelCheckBox";
this.maximumChannelCheckBox.Size = new Size(190, 17);
this.maximumChannelCheckBox.TabIndex = 23;
this.maximumChannelCheckBox.Text = "Select channel with maximum level";
this.maximumChannelCheckBox.UseVisualStyleBackColor = true;
this.groupBox2.Controls.Add(this.label10);
this.groupBox2.Controls.Add(this.label9);
this.groupBox2.Controls.Add(this.pluginPositionComboBox);
this.groupBox2.Controls.Add(this.label8);
this.groupBox2.Controls.Add(this.maxAlphaNumericUpDown);
this.groupBox2.Controls.Add(this.minAlphaNumericUpDown);
this.groupBox2.Controls.Add(this.label6);
this.groupBox2.Controls.Add(this.debugCheckBox);
this.groupBox2.Controls.Add(this.autoSkipCheckBox);
this.groupBox2.Controls.Add(this.autoLockCheckBox);
this.groupBox2.Controls.Add(this.channelDetectMetodCheckBox);
this.groupBox2.Controls.Add(this.maximumChannelCheckBox);
this.groupBox2.Controls.Add(this.autoClearCheckBox);
this.groupBox2.Controls.Add(this.useMuteCheckBox);
this.groupBox2.Controls.Add(this.LockIntervalNumericUpDown);
this.groupBox2.Controls.Add(this.unMuteNumericUpDown);
this.groupBox2.Controls.Add(this.activityNumericUpDown);
this.groupBox2.Controls.Add(this.label4);
this.groupBox2.Controls.Add(this.label7);
this.groupBox2.Controls.Add(this.autoClearIntervalNumericUpDown);
this.groupBox2.Controls.Add(this.label2);
this.groupBox2.Controls.Add(this.label5);
this.groupBox2.Controls.Add(this.label1);
this.groupBox2.Controls.Add(this.skipIntervalNumericUpDown);
this.groupBox2.Controls.Add(this.label3);
this.groupBox2.Location = new Point(12, 12);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new Size(370, 235);
this.groupBox2.TabIndex = 13;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Scanner settings";
this.label9.AutoSize = true;
this.label9.Location = new Point(80, 182);
this.label9.Name = "label9";
this.label9.Size = new Size(26, 13);
this.label9.TabIndex = 31;
this.label9.Text = "min.";
this.label8.AutoSize = true;
this.label8.Location = new Point(6, 182);
this.label8.Name = "label8";
this.label8.Size = new Size(72, 13);
this.label8.TabIndex = 30;
this.label8.Text = "Buttons alpha";
this.maxAlphaNumericUpDown.Location = new Point(208, 180);
this.maxAlphaNumericUpDown.Maximum = new decimal(new int[4]
{
255,
0,
0,
0
});
this.maxAlphaNumericUpDown.Minimum = new decimal(new int[4]
{
1,
0,
0,
0
});
this.maxAlphaNumericUpDown.Name = "maxAlphaNumericUpDown";
this.maxAlphaNumericUpDown.Size = new Size(55, 20);
this.maxAlphaNumericUpDown.TabIndex = 27;
this.maxAlphaNumericUpDown.Value = new decimal(new int[4]
{
150,
0,
0,
0
});
this.maxAlphaNumericUpDown.ValueChanged += this.maxAlphaNumericUpDown_ValueChanged;
this.minAlphaNumericUpDown.Location = new Point(112, 180);
this.minAlphaNumericUpDown.Maximum = new decimal(new int[4]
{
255,
0,
0,
0
});
this.minAlphaNumericUpDown.Minimum = new decimal(new int[4]
{
1,
0,
0,
0
});
this.minAlphaNumericUpDown.Name = "minAlphaNumericUpDown";
this.minAlphaNumericUpDown.Size = new Size(55, 20);
this.minAlphaNumericUpDown.TabIndex = 28;
this.minAlphaNumericUpDown.Value = new decimal(new int[4]
{
10,
0,
0,
0
});
this.minAlphaNumericUpDown.ValueChanged += this.minAlphaNumericUpDown_ValueChanged;
this.label6.AutoSize = true;
this.label6.Location = new Point(173, 182);
this.label6.Name = "label6";
this.label6.Size = new Size(29, 13);
this.label6.TabIndex = 29;
this.label6.Text = "max.";
this.debugCheckBox.AutoSize = true;
this.debugCheckBox.Location = new Point(6, 158);
this.debugCheckBox.Name = "debugCheckBox";
this.debugCheckBox.Size = new Size(106, 17);
this.debugCheckBox.TabIndex = 24;
this.debugCheckBox.Text = "Show debug info";
this.debugCheckBox.UseVisualStyleBackColor = true;
this.debugCheckBox.CheckedChanged += this.debugCheckBox_CheckedChanged;
this.label10.AutoSize = true;
this.label10.Location = new Point(6, 209);
this.label10.Name = "label10";
this.label10.Size = new Size(87, 13);
this.label10.TabIndex = 37;
this.label10.Text = "Panview position";
this.label10.Click += this.label10_Click;
this.pluginPositionComboBox.AutoCompleteCustomSource.AddRange(new string[3]
{
"Plugin panel",
"Main screen left",
"Main screen right"
});
this.pluginPositionComboBox.FormattingEnabled = true;
this.pluginPositionComboBox.Items.AddRange(new object[4]
{
"Main screen up",
"Main screen down",
"Main screen left",
"Main screen right"
});
this.pluginPositionComboBox.Location = new Point(97, 206);
this.pluginPositionComboBox.Name = "pluginPositionComboBox";
this.pluginPositionComboBox.Size = new Size(105, 21);
this.pluginPositionComboBox.TabIndex = 36;
base.AutoScaleDimensions = new SizeF(6f, 13f);
base.AutoScaleMode = AutoScaleMode.Font;
this.AutoSize = true;
base.AutoSizeMode = AutoSizeMode.GrowAndShrink;
base.ClientSize = new Size(391, 285);
base.ControlBox = false;
base.Controls.Add(this.groupBox2);
base.Controls.Add(this.okButton);
base.FormBorderStyle = FormBorderStyle.FixedToolWindow;
base.Name = "DialogConfigure";
base.ShowIcon = false;
base.ShowInTaskbar = false;
this.Text = "Configure scanner";
((ISupportInitialize)this.LockIntervalNumericUpDown).EndInit();
((ISupportInitialize)this.activityNumericUpDown).EndInit();
((ISupportInitialize)this.autoClearIntervalNumericUpDown).EndInit();
((ISupportInitialize)this.skipIntervalNumericUpDown).EndInit();
((ISupportInitialize)this.unMuteNumericUpDown).EndInit();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
((ISupportInitialize)this.maxAlphaNumericUpDown).EndInit();
((ISupportInitialize)this.minAlphaNumericUpDown).EndInit();
base.ResumeLayout(false);
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,303 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace SDRSharp.FrequencyScanner
{
public class DialogEditRange : Form
{
private List<MemoryEntryFrequencyRange> _memoryEntryFrequencyRange;
private readonly SortableBindingList<MemoryEntryFrequencyRange> _displayedEntries = new SortableBindingList<MemoryEntryFrequencyRange>();
private IContainer components;
private DataGridView editRangeDataGridView;
private Button cancelButton;
private Button okButton;
private Button deleteRangeButton;
private BindingSource editRangeBindingSource;
private DataGridViewTextBoxColumn rangeNameDataGridViewTextBoxColumn;
private DataGridViewTextBoxColumn startFrequencyDataGridViewTextBoxColumn;
private DataGridViewTextBoxColumn endFrequencyDataGridViewTextBoxColumn;
private DataGridViewTextBoxColumn rangeDetectorTypeDataGridViewTextBoxColumn;
private DataGridViewTextBoxColumn FilterBandwidth;
private DataGridViewTextBoxColumn StepSize;
public DialogEditRange()
{
this.InitializeComponent();
this.editRangeBindingSource.DataSource = this._displayedEntries;
this.editRangeDataGridView.CellEndEdit += this.ValidateForm;
this.editRangeDataGridView.CellBeginEdit += this.FormBegiEdit;
}
private void FormBegiEdit(object sender, DataGridViewCellCancelEventArgs e)
{
this.okButton.Enabled = false;
}
public List<MemoryEntryFrequencyRange> EditRange(List<MemoryEntryFrequencyRange> memoryEntry)
{
this._memoryEntryFrequencyRange = memoryEntry;
if (this._memoryEntryFrequencyRange != null)
{
foreach (MemoryEntryFrequencyRange item in this._memoryEntryFrequencyRange)
{
this._displayedEntries.Add(item);
}
}
return this._memoryEntryFrequencyRange;
}
private void editRangeDataGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
}
private string GetFrequencyDisplay(long frequency)
{
long num = Math.Abs(frequency);
if (num == 0L)
{
return "DC";
}
if (num > 1500000000)
{
return $"{(double)frequency / 1000000000.0:#,0.000 000} GHz";
}
if (num > 30000000)
{
return $"{(double)frequency / 1000000.0:0,0.000###} MHz";
}
if (num > 1000)
{
return $"{(double)frequency / 1000.0:#,#.###} kHz";
}
return frequency.ToString();
}
private void okButton_Click(object sender, EventArgs e)
{
if (this.editRangeBindingSource != null)
{
this._memoryEntryFrequencyRange.Clear();
foreach (MemoryEntryFrequencyRange item in this.editRangeBindingSource)
{
this._memoryEntryFrequencyRange.Add(item);
}
}
base.DialogResult = DialogResult.OK;
}
private void ValidateForm(object sender, DataGridViewCellEventArgs e)
{
bool flag = true;
foreach (MemoryEntryFrequencyRange item in this.editRangeBindingSource)
{
int row = this.editRangeBindingSource.IndexOf(item);
bool flag2 = item.RangeName != null && !"".Equals(item.RangeName.Trim());
this.IndicateErrorCells(0, row, flag2);
bool flag3 = item.StartFrequency < item.EndFrequency && item.StartFrequency != 0L && item.EndFrequency != 0;
this.IndicateErrorCells(1, row, flag3);
this.IndicateErrorCells(2, row, flag3);
bool flag4 = item.FilterBandwidth != 0;
this.IndicateErrorCells(4, row, flag4);
bool flag5 = item.StepSize != 0;
this.IndicateErrorCells(5, row, flag5);
flag = (flag & flag2 & flag3 & flag4 & flag5);
}
this.okButton.Enabled = flag;
}
private void IndicateErrorCells(int collumn, int row, bool valid)
{
if (valid)
{
this.editRangeDataGridView[collumn, row].Style.BackColor = this.editRangeDataGridView.DefaultCellStyle.BackColor;
}
else
{
this.editRangeDataGridView[collumn, row].Style.BackColor = Color.LightPink;
}
}
private void cancelButton_Click(object sender, EventArgs e)
{
base.DialogResult = DialogResult.Cancel;
}
private void deleteRangeButton_Click(object sender, EventArgs e)
{
if (this.editRangeBindingSource.IndexOf(this.editRangeBindingSource.Current) > -1)
{
this.editRangeBindingSource.RemoveCurrent();
this.ValidateForm(null, null);
}
}
protected override void Dispose(bool disposing)
{
if (disposing && this.components != null)
{
this.components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.components = new Container();
DataGridViewCellStyle dataGridViewCellStyle = new DataGridViewCellStyle();
DataGridViewCellStyle dataGridViewCellStyle2 = new DataGridViewCellStyle();
DataGridViewCellStyle dataGridViewCellStyle3 = new DataGridViewCellStyle();
DataGridViewCellStyle dataGridViewCellStyle4 = new DataGridViewCellStyle();
DataGridViewCellStyle dataGridViewCellStyle5 = new DataGridViewCellStyle();
DataGridViewCellStyle dataGridViewCellStyle6 = new DataGridViewCellStyle();
this.editRangeDataGridView = new DataGridView();
this.rangeNameDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
this.startFrequencyDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
this.endFrequencyDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
this.rangeDetectorTypeDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
this.FilterBandwidth = new DataGridViewTextBoxColumn();
this.StepSize = new DataGridViewTextBoxColumn();
this.editRangeBindingSource = new BindingSource(this.components);
this.cancelButton = new Button();
this.okButton = new Button();
this.deleteRangeButton = new Button();
((ISupportInitialize)this.editRangeDataGridView).BeginInit();
((ISupportInitialize)this.editRangeBindingSource).BeginInit();
base.SuspendLayout();
this.editRangeDataGridView.AutoGenerateColumns = false;
this.editRangeDataGridView.Columns.AddRange(this.rangeNameDataGridViewTextBoxColumn, this.startFrequencyDataGridViewTextBoxColumn, this.endFrequencyDataGridViewTextBoxColumn, this.rangeDetectorTypeDataGridViewTextBoxColumn, this.FilterBandwidth, this.StepSize);
this.editRangeDataGridView.DataSource = this.editRangeBindingSource;
this.editRangeDataGridView.Location = new Point(15, 15);
this.editRangeDataGridView.Margin = new Padding(4, 4, 4, 4);
this.editRangeDataGridView.MultiSelect = false;
this.editRangeDataGridView.Name = "editRangeDataGridView";
this.editRangeDataGridView.RowHeadersVisible = false;
this.editRangeDataGridView.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing;
this.editRangeDataGridView.SelectionMode = DataGridViewSelectionMode.CellSelect;
this.editRangeDataGridView.ShowEditingIcon = false;
this.editRangeDataGridView.ShowRowErrors = false;
this.editRangeDataGridView.Size = new Size(912, 351);
this.editRangeDataGridView.TabIndex = 0;
this.rangeNameDataGridViewTextBoxColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
this.rangeNameDataGridViewTextBoxColumn.DataPropertyName = "RangeName";
dataGridViewCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
this.rangeNameDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle;
this.rangeNameDataGridViewTextBoxColumn.HeaderText = "Name";
this.rangeNameDataGridViewTextBoxColumn.MinimumWidth = 110;
this.rangeNameDataGridViewTextBoxColumn.Name = "rangeNameDataGridViewTextBoxColumn";
this.startFrequencyDataGridViewTextBoxColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
this.startFrequencyDataGridViewTextBoxColumn.DataPropertyName = "StartFrequency";
dataGridViewCellStyle2.Alignment = DataGridViewContentAlignment.MiddleRight;
dataGridViewCellStyle2.Format = "N0";
dataGridViewCellStyle2.NullValue = null;
this.startFrequencyDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle2;
this.startFrequencyDataGridViewTextBoxColumn.HeaderText = "Start";
this.startFrequencyDataGridViewTextBoxColumn.MinimumWidth = 80;
this.startFrequencyDataGridViewTextBoxColumn.Name = "startFrequencyDataGridViewTextBoxColumn";
this.startFrequencyDataGridViewTextBoxColumn.Resizable = DataGridViewTriState.True;
this.endFrequencyDataGridViewTextBoxColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
this.endFrequencyDataGridViewTextBoxColumn.DataPropertyName = "EndFrequency";
dataGridViewCellStyle3.Alignment = DataGridViewContentAlignment.MiddleRight;
dataGridViewCellStyle3.Format = "N0";
dataGridViewCellStyle3.NullValue = null;
this.endFrequencyDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle3;
this.endFrequencyDataGridViewTextBoxColumn.HeaderText = "End";
this.endFrequencyDataGridViewTextBoxColumn.MinimumWidth = 80;
this.endFrequencyDataGridViewTextBoxColumn.Name = "endFrequencyDataGridViewTextBoxColumn";
this.rangeDetectorTypeDataGridViewTextBoxColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
this.rangeDetectorTypeDataGridViewTextBoxColumn.DataPropertyName = "RangeDetectorType";
dataGridViewCellStyle4.Alignment = DataGridViewContentAlignment.MiddleRight;
dataGridViewCellStyle4.NullValue = null;
this.rangeDetectorTypeDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle4;
this.rangeDetectorTypeDataGridViewTextBoxColumn.FillWeight = 10f;
this.rangeDetectorTypeDataGridViewTextBoxColumn.HeaderText = "Detector";
this.rangeDetectorTypeDataGridViewTextBoxColumn.MinimumWidth = 60;
this.rangeDetectorTypeDataGridViewTextBoxColumn.Name = "rangeDetectorTypeDataGridViewTextBoxColumn";
this.rangeDetectorTypeDataGridViewTextBoxColumn.Resizable = DataGridViewTriState.False;
this.rangeDetectorTypeDataGridViewTextBoxColumn.Width = 60;
this.FilterBandwidth.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
this.FilterBandwidth.DataPropertyName = "FilterBandwidth";
dataGridViewCellStyle5.Alignment = DataGridViewContentAlignment.MiddleRight;
dataGridViewCellStyle5.Format = "N0";
dataGridViewCellStyle5.NullValue = null;
this.FilterBandwidth.DefaultCellStyle = dataGridViewCellStyle5;
this.FilterBandwidth.HeaderText = "Bandwidth";
this.FilterBandwidth.Name = "FilterBandwidth";
this.FilterBandwidth.Width = 80;
this.StepSize.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
this.StepSize.DataPropertyName = "StepSize";
dataGridViewCellStyle6.Alignment = DataGridViewContentAlignment.MiddleRight;
dataGridViewCellStyle6.Format = "N0";
dataGridViewCellStyle6.NullValue = null;
this.StepSize.DefaultCellStyle = dataGridViewCellStyle6;
this.StepSize.HeaderText = "Step size";
this.StepSize.Name = "StepSize";
this.StepSize.Width = 80;
this.editRangeBindingSource.DataSource = typeof(MemoryEntryFrequencyRange);
this.cancelButton.DialogResult = DialogResult.Cancel;
this.cancelButton.Location = new Point(833, 372);
this.cancelButton.Margin = new Padding(4, 4, 4, 4);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new Size(100, 28);
this.cancelButton.TabIndex = 1;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += this.cancelButton_Click;
this.okButton.Location = new Point(725, 372);
this.okButton.Margin = new Padding(4, 4, 4, 4);
this.okButton.Name = "okButton";
this.okButton.Size = new Size(100, 28);
this.okButton.TabIndex = 2;
this.okButton.Text = "Ok";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += this.okButton_Click;
this.deleteRangeButton.Location = new Point(15, 370);
this.deleteRangeButton.Margin = new Padding(4, 4, 4, 4);
this.deleteRangeButton.Name = "deleteRangeButton";
this.deleteRangeButton.Size = new Size(100, 28);
this.deleteRangeButton.TabIndex = 3;
this.deleteRangeButton.Text = "Delete rows";
this.deleteRangeButton.UseVisualStyleBackColor = true;
this.deleteRangeButton.Click += this.deleteRangeButton_Click;
base.AcceptButton = this.okButton;
base.AutoScaleDimensions = new SizeF(8f, 16f);
base.AutoScaleMode = AutoScaleMode.Font;
this.AutoSize = true;
base.AutoSizeMode = AutoSizeMode.GrowAndShrink;
this.BackColor = SystemColors.Control;
base.CancelButton = this.cancelButton;
base.ClientSize = new Size(932, 407);
base.ControlBox = false;
base.Controls.Add(this.deleteRangeButton);
base.Controls.Add(this.okButton);
base.Controls.Add(this.cancelButton);
base.Controls.Add(this.editRangeDataGridView);
base.FormBorderStyle = FormBorderStyle.FixedSingle;
base.Margin = new Padding(4, 4, 4, 4);
base.MaximizeBox = false;
base.MinimizeBox = false;
base.Name = "DialogEditRange";
base.ShowIcon = false;
base.ShowInTaskbar = false;
this.Text = "Edit Range";
((ISupportInitialize)this.editRangeDataGridView).EndInit();
((ISupportInitialize)this.editRangeBindingSource).EndInit();
base.ResumeLayout(false);
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,149 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="btnDelete.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wgAADsIBFShKgAAAAgVJREFUOE9jAAEvLy8DNy/PPZ6enk719fVMYEFiQWhoKLOTk2u6o6PLfydn52/e
3t6BIDGoNAqwt7dnCQoKUnJ3d82DCkEEHR2dk2ztHbaZW9r+19LS+uPu7lmFboi8vD2Hpa2jk7eX13d7
e8c5UGEIsLV1l7S3d7FwcHDZZmVj/9/O3uG/v4/nRldXV26QvIWFBae7u/sKeXmn36am5t1AS3jAGtEB
0FY2JyeXAnkH5992dk7/gd5ZZm5uo2dpaTfZ1sbmv56ByWQlJWN+qHKcgNHOzkXT1tbpvJm59X99ff3v
hsZG79W0dNfJyFhwQtUQBvr6xg56+iY/La2A4aJvdE9GRksIKkUY6JubK6ioaF3S1TP8p29g8t/E1OK/
lrbOLag0fmBoaCivpq59VU1d64+GpuYaYWEJE1lZlW0Ghsb/VdS0M6HKsANg6ErIyiufklNU/a+tZ3BI
RkZGSFxcnBuE5RTVphsYGH9R1taWhSpHBfL29hwyiqqLJKSlP2ppGT7R0jLQgkqBEgEHA4MQn7a+wVkJ
KflJQBHMhCYtJ+ctJqHwX1VNG+hUjVYGBnFwGkACTMrKWirKysr3BQQE5EF8iDAEsAkLi7YKCYv/l5dX
3sXGxqsGFMOWJ5hNTS0nc/JxmgLZqPKScspGrKzsE4FMOyDmBQtiByxAzAVhDjxgYAAAJT51jooYX84A
AAAASUVORK5CYII=
</value>
</data>
<data name="btnNewEntry.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wgAADsIBFShKgAAAAaNJREFUOE+NkUtLAlEUxy9BK2nVNugDtGpRm6h95aZ1y/oSQuAHqE1FQU+iDLRA
6AFR0IsKMgkJKyytQUyjfGSlafP6d+7MHTWiwT8czuWc+/vfOWeYpUxmsKwoAxHMMSDMoCj9UjLplEXb
XlrEsSm7CMQUsE351jwbtUL3mrj2v9SI47ICLFFsMPNMtfxdF/wH1/DthuDZCmBlKzAqsKrkMbo8RTHO
IS6v+SWzFF6rBsyvH6Gzb/iviXTLFLe7WccEXab58dgIHFIutwOJFoHTG55d7J1dGybLm+djAqcRVGew
MgJ/kV6v7ARuA+aaXN4xYCsETgaFnuMKsEA51mCczdoMZw0pqmaYWEYCN6Vn2ka0aNM0/AQ9tQJZF/2B
OYECuq6jWJLxki0aBh29Q78NLC36TwTyW9+yitx7CfHnd3uDWd+BQKpSNR0fxW+k0gXcx3P2BtOrewKr
qlRWkH77gpTMIxxN2xvwZq344vKfZSRePhCRsgjePNdvULu4WOINV3evOA091W9Qu7ibhwwC4RT2L+L1
GfBsF7YGvFlPMMbYD0+fNqe/2VNCAAAAAElFTkSuQmCC
</value>
</data>
</root>

View file

@ -0,0 +1,149 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="btnDelete.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wgAADsIBFShKgAAAAgVJREFUOE9jAAEvLy8DNy/PPZ6enk719fVMYEFiQWhoKLOTk2u6o6PLfydn52/e
3t6BIDGoNAqwt7dnCQoKUnJ3d82DCkEEHR2dk2ztHbaZW9r+19LS+uPu7lmFboi8vD2Hpa2jk7eX13d7
e8c5UGEIsLV1l7S3d7FwcHDZZmVj/9/O3uG/v4/nRldXV26QvIWFBae7u/sKeXmn36am5t1AS3jAGtEB
0FY2JyeXAnkH5992dk7/gd5ZZm5uo2dpaTfZ1sbmv56ByWQlJWN+qHKcgNHOzkXT1tbpvJm59X99ff3v
hsZG79W0dNfJyFhwQtUQBvr6xg56+iY/La2A4aJvdE9GRksIKkUY6JubK6ioaF3S1TP8p29g8t/E1OK/
lrbOLag0fmBoaCivpq59VU1d64+GpuYaYWEJE1lZlW0Ghsb/VdS0M6HKsANg6ErIyiufklNU/a+tZ3BI
RkZGSFxcnBuE5RTVphsYGH9R1taWhSpHBfL29hwyiqqLJKSlP2ppGT7R0jLQgkqBEgEHA4MQn7a+wVkJ
KflJQBHMhCYtJ+ctJqHwX1VNG+hUjVYGBnFwGkACTMrKWirKysr3BQQE5EF8iDAEsAkLi7YKCYv/l5dX
3sXGxqsGFMOWJ5hNTS0nc/JxmgLZqPKScspGrKzsE4FMOyDmBQtiByxAzAVhDjxgYAAAJT51jooYX84A
AAAASUVORK5CYII=
</value>
</data>
<data name="btnNewEntry.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wgAADsIBFShKgAAAAaNJREFUOE+NkUtLAlEUxy9BK2nVNugDtGpRm6h95aZ1y/oSQuAHqE1FQU+iDLRA
6AFR0IsKMgkJKyytQUyjfGSlafP6d+7MHTWiwT8czuWc+/vfOWeYpUxmsKwoAxHMMSDMoCj9UjLplEXb
XlrEsSm7CMQUsE351jwbtUL3mrj2v9SI47ICLFFsMPNMtfxdF/wH1/DthuDZCmBlKzAqsKrkMbo8RTHO
IS6v+SWzFF6rBsyvH6Gzb/iviXTLFLe7WccEXab58dgIHFIutwOJFoHTG55d7J1dGybLm+djAqcRVGew
MgJ/kV6v7ARuA+aaXN4xYCsETgaFnuMKsEA51mCczdoMZw0pqmaYWEYCN6Vn2ka0aNM0/AQ9tQJZF/2B
OYECuq6jWJLxki0aBh29Q78NLC36TwTyW9+yitx7CfHnd3uDWd+BQKpSNR0fxW+k0gXcx3P2BtOrewKr
qlRWkH77gpTMIxxN2xvwZq344vKfZSRePhCRsgjePNdvULu4WOINV3evOA091W9Qu7ibhwwC4RT2L+L1
GfBsF7YGvFlPMMbYD0+fNqe/2VNCAAAAAElFTkSuQmCC
</value>
</data>
</root>

View file

@ -0,0 +1,33 @@
using SDRSharp.Common;
using System.Windows.Forms;
namespace SDRSharp.FrequencyScanner
{
public class FrequencyScannerPlugin : ISharpPlugin
{
private const string _displayName = "Frequency Scanner";
private ISharpControl _controlInterface;
private FrequencyScannerPanel _frequencyScannerPanel;
public UserControl Gui => this._frequencyScannerPanel;
public string DisplayName => "Frequency Scanner";
public void Close()
{
if (this._frequencyScannerPanel != null)
{
this._frequencyScannerPanel.ScanStop();
this._frequencyScannerPanel.SaveSettings();
}
}
public void Initialize(ISharpControl control)
{
this._controlInterface = control;
this._frequencyScannerPanel = new FrequencyScannerPanel(this._controlInterface);
}
}
}

View file

@ -0,0 +1,47 @@
using SDRSharp.Radio;
namespace SDRSharp.FrequencyScanner
{
public class IFProcessor : IIQProcessor, IBaseProcessor
{
public unsafe delegate void IQReadyDelegate(Complex* buffer, int length);
private double _sampleRate;
private bool _enabled;
public double SampleRate
{
get
{
return this._sampleRate;
}
set
{
this._sampleRate = value;
}
}
public bool Enabled
{
get
{
return this._enabled;
}
set
{
this._enabled = value;
}
}
public event IQReadyDelegate IQReady;
public unsafe void Process(Complex* buffer, int length)
{
if (this.IQReady != null)
{
this.IQReady(buffer, length);
}
}
}
}

View file

@ -0,0 +1,135 @@
using SDRSharp.Radio;
namespace SDRSharp.FrequencyScanner
{
public class MemoryEntry
{
private long _frequency;
private DetectorType _detectorType;
private string _name;
private long _shift;
private long _centerFrequency;
private string _groupName;
private long _filterBandwidth;
private bool _isFavourite;
public bool IsFavourite
{
get
{
return this._isFavourite;
}
set
{
this._isFavourite = value;
}
}
public string Name
{
get
{
return this._name;
}
set
{
this._name = value;
}
}
public string GroupName
{
get
{
return this._groupName;
}
set
{
this._groupName = value;
}
}
public long Frequency
{
get
{
return this._frequency;
}
set
{
this._frequency = value;
}
}
public DetectorType DetectorType
{
get
{
return this._detectorType;
}
set
{
this._detectorType = value;
}
}
public long Shift
{
get
{
return this._shift;
}
set
{
this._shift = value;
}
}
public long FilterBandwidth
{
get
{
return this._filterBandwidth;
}
set
{
this._filterBandwidth = value;
}
}
public long CenterFrequency
{
get
{
return this._centerFrequency;
}
set
{
this._centerFrequency = value;
}
}
public MemoryEntry()
{
}
public MemoryEntry(MemoryEntry memoryEntry)
{
this._name = memoryEntry._name;
this._groupName = memoryEntry._groupName;
this._detectorType = memoryEntry._detectorType;
this._frequency = memoryEntry._frequency;
this._shift = memoryEntry._shift;
this._centerFrequency = memoryEntry._centerFrequency;
this._filterBandwidth = memoryEntry._filterBandwidth;
this._isFavourite = memoryEntry._isFavourite;
}
}
}

View file

@ -0,0 +1,136 @@
using SDRSharp.Radio;
using System.Drawing;
namespace SDRSharp.FrequencyScanner
{
public class MemoryEntryFrequencyRange
{
private long _startFrequency;
private long _endFrequency;
private string _rangeName;
private DetectorType _detectorType;
private int _stepSize;
private int _filterBandwidth;
private Point _lastLocation;
private Size _lastSize;
public int StepSize
{
get
{
return this._stepSize;
}
set
{
this._stepSize = value;
}
}
public int FilterBandwidth
{
get
{
return this._filterBandwidth;
}
set
{
this._filterBandwidth = value;
}
}
public Size LastSize
{
get
{
return this._lastSize;
}
set
{
this._lastSize = value;
}
}
public Point LastLocation
{
get
{
return this._lastLocation;
}
set
{
this._lastLocation = value;
}
}
public long StartFrequency
{
get
{
return this._startFrequency;
}
set
{
this._startFrequency = value;
}
}
public long EndFrequency
{
get
{
return this._endFrequency;
}
set
{
this._endFrequency = value;
}
}
public string RangeName
{
get
{
return this._rangeName;
}
set
{
this._rangeName = value;
}
}
public DetectorType RangeDetectorType
{
get
{
return this._detectorType;
}
set
{
this._detectorType = value;
}
}
public MemoryEntryFrequencyRange()
{
}
public MemoryEntryFrequencyRange(MemoryEntryFrequencyRange memoryEntryFrequencyRange)
{
this._startFrequency = memoryEntryFrequencyRange._startFrequency;
this._endFrequency = memoryEntryFrequencyRange._endFrequency;
this._rangeName = memoryEntryFrequencyRange._rangeName;
this._detectorType = memoryEntryFrequencyRange._detectorType;
this._lastLocation = memoryEntryFrequencyRange._lastLocation;
this._lastSize = memoryEntryFrequencyRange._lastSize;
this._stepSize = memoryEntryFrequencyRange._stepSize;
this._filterBandwidth = memoryEntryFrequencyRange._filterBandwidth;
}
}
}

View file

@ -0,0 +1,58 @@
namespace SDRSharp.FrequencyScanner
{
public class MemoryEntryNewFrequency
{
private long _frequency;
private float _activity;
private long _centerFrequency;
public long Frequency
{
get
{
return this._frequency;
}
set
{
this._frequency = value;
}
}
public long CenterFrequency
{
get
{
return this._centerFrequency;
}
set
{
this._centerFrequency = value;
}
}
public float Activity
{
get
{
return this._activity;
}
set
{
this._activity = value;
}
}
public MemoryEntryNewFrequency()
{
}
public MemoryEntryNewFrequency(MemoryEntryNewFrequency memoryEntryNewFrequency)
{
this._frequency = memoryEntryNewFrequency._frequency;
this._activity = memoryEntryNewFrequency._activity;
this._centerFrequency = memoryEntryNewFrequency._centerFrequency;
}
}
}

View file

@ -0,0 +1,128 @@
using System.Collections.Generic;
using System.Drawing;
namespace SDRSharp.FrequencyScanner
{
public class MemoryEntryNewSkipAndRangeFrequency
{
private List<long> _skipFrequencyArray;
private List<MemoryEntryFrequencyRange> _scanFrequencyRange;
private List<MemoryEntryNewFrequency> _newFrequency;
private Point _lastLocationScreen;
private Size _lastSizeScreen;
private Point _lastLocationMultiSelect;
private Size _lastSizeMultiSelect;
public List<long> SkipFrequencyArray
{
get
{
return this._skipFrequencyArray;
}
set
{
this._skipFrequencyArray = value;
}
}
public List<MemoryEntryFrequencyRange> FrequencyRange
{
get
{
return this._scanFrequencyRange;
}
set
{
this._scanFrequencyRange = value;
}
}
public List<MemoryEntryNewFrequency> NewFrequency
{
get
{
return this._newFrequency;
}
set
{
this._newFrequency = value;
}
}
public Size LastSizeScreen
{
get
{
return this._lastSizeScreen;
}
set
{
this._lastSizeScreen = value;
}
}
public Point LastLocationScreen
{
get
{
return this._lastLocationScreen;
}
set
{
this._lastLocationScreen = value;
}
}
public Size LastSizeMultiSelect
{
get
{
return this._lastSizeMultiSelect;
}
set
{
this._lastSizeMultiSelect = value;
}
}
public Point LastLocationMultiSelect
{
get
{
return this._lastLocationMultiSelect;
}
set
{
this._lastLocationMultiSelect = value;
}
}
public MemoryEntryNewSkipAndRangeFrequency()
{
this._scanFrequencyRange = new List<MemoryEntryFrequencyRange>();
this._newFrequency = new List<MemoryEntryNewFrequency>();
this._skipFrequencyArray = new List<long>();
this._lastLocationScreen = default(Point);
this._lastSizeScreen = default(Size);
this._lastLocationMultiSelect = default(Point);
this._lastSizeMultiSelect = default(Size);
}
public MemoryEntryNewSkipAndRangeFrequency(MemoryEntryNewSkipAndRangeFrequency memoryEntry)
{
this._skipFrequencyArray = memoryEntry._skipFrequencyArray;
this._scanFrequencyRange = memoryEntry._scanFrequencyRange;
this._newFrequency = memoryEntry._newFrequency;
this._lastLocationScreen = memoryEntry._lastLocationScreen;
this._lastSizeScreen = memoryEntry._lastSizeScreen;
this._lastLocationMultiSelect = memoryEntry._lastLocationMultiSelect;
this._lastSizeMultiSelect = memoryEntry._lastSizeMultiSelect;
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,74 @@
using System;
using System.Collections.Generic;
namespace SDRSharp.FrequencyScanner
{
[Serializable]
public class SerializableDictionary<TKey, TValue>
{
private List<TKey> _keys = new List<TKey>();
private List<TValue> _values = new List<TValue>();
public TValue this[TKey index]
{
get
{
int num = this._keys.IndexOf(index);
if (num != -1)
{
return this._values[num];
}
throw new KeyNotFoundException();
}
set
{
int num = this._keys.IndexOf(index);
if (num == -1)
{
this._keys.Add(index);
this._values.Add(value);
}
else
{
this._values[num] = value;
}
}
}
public List<TKey> Keys
{
get
{
return this._keys;
}
set
{
this._keys = value;
}
}
public List<TValue> Values
{
get
{
return this._values;
}
set
{
this._values = value;
}
}
public bool ContainsKey(TKey key)
{
return this._keys.IndexOf(key) != -1;
}
public void Clear()
{
this._keys.Clear();
this._values.Clear();
}
}
}

View file

@ -0,0 +1,73 @@
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
using System.Xml.Serialization;
namespace SDRSharp.FrequencyScanner
{
public class SettingsPersister
{
private const string FilenameScannerSettings = "scanner_entryes.xml";
private const string FilenameFrequencyManager = "frequencies.xml";
private readonly string _settingsFolder;
public SettingsPersister()
{
this._settingsFolder = Path.GetDirectoryName(Application.ExecutablePath);
}
public MemoryEntryNewSkipAndRangeFrequency ReadStored()
{
MemoryEntryNewSkipAndRangeFrequency memoryEntryNewSkipAndRangeFrequency = this.ReadObject<MemoryEntryNewSkipAndRangeFrequency>("scanner_entryes.xml");
if (memoryEntryNewSkipAndRangeFrequency != null)
{
return memoryEntryNewSkipAndRangeFrequency;
}
return new MemoryEntryNewSkipAndRangeFrequency();
}
public void PersistStored(MemoryEntryNewSkipAndRangeFrequency entries)
{
this.WriteObject(entries, "scanner_entryes.xml");
}
public List<MemoryEntry> ReadStoredFrequencies()
{
List<MemoryEntry> list = this.ReadObject<List<MemoryEntry>>("frequencies.xml");
if (list != null)
{
list.Sort((MemoryEntry e1, MemoryEntry e2) => e1.Frequency.CompareTo(e2.Frequency));
return list;
}
return new List<MemoryEntry>();
}
public void PersistStoredFrequencies(List<MemoryEntry> entries)
{
this.WriteObject(entries, "frequencies.xml");
}
private T ReadObject<T>(string fileName)
{
string path = Path.Combine(this._settingsFolder, fileName);
if (File.Exists(path))
{
using (FileStream stream = new FileStream(path, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite))
{
return (T)new XmlSerializer(typeof(T)).Deserialize(stream);
}
}
return default(T);
}
private void WriteObject<T>(T obj, string fileName)
{
using (FileStream stream = new FileStream(Path.Combine(this._settingsFolder, fileName), FileMode.Create))
{
new XmlSerializer(obj.GetType()).Serialize(stream, obj);
}
}
}
}

View file

@ -0,0 +1,40 @@
using System.Collections.Generic;
using System.ComponentModel;
namespace SDRSharp.FrequencyScanner
{
public class SortableBindingList<T> : BindingList<T>
{
private bool _isSorted;
private PropertyDescriptor _sortProperty;
private ListSortDirection _sortDirection;
protected override bool SupportsSortingCore => true;
protected override ListSortDirection SortDirectionCore => this._sortDirection;
protected override PropertyDescriptor SortPropertyCore => this._sortProperty;
protected override bool IsSortedCore => this._isSorted;
protected override void ApplySortCore(PropertyDescriptor property, ListSortDirection direction)
{
List<T> list = (List<T>)base.Items;
if (list != null)
{
SortableBindingListComparer<T> comparer = new SortableBindingListComparer<T>(property.Name, direction);
list.Sort(comparer);
this._isSorted = true;
}
else
{
this._isSorted = false;
}
this._sortProperty = property;
this._sortDirection = direction;
this.OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1));
}
}
}

View file

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Reflection;
namespace SDRSharp.FrequencyScanner
{
public class SortableBindingListComparer<T> : IComparer<T>
{
private PropertyInfo _sortProperty;
private ListSortDirection _sortDirection;
public SortableBindingListComparer(string sortProperty, ListSortDirection sortDirection)
{
this._sortProperty = typeof(T).GetProperty(sortProperty);
this._sortDirection = sortDirection;
}
public int Compare(T x, T y)
{
IComparable comparable = (IComparable)this._sortProperty.GetValue(x, null);
IComparable comparable2 = (IComparable)this._sortProperty.GetValue(y, null);
if (this._sortDirection == ListSortDirection.Ascending)
{
return comparable.CompareTo(comparable2);
}
return comparable2.CompareTo(comparable);
}
}
}

View file

@ -0,0 +1,21 @@
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security.Permissions;
[assembly: AssemblyCopyright("Copyright © Youssef Touil 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyDescription("Noise Blanker Plugin")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SDR#")]
[assembly: Guid("dfd7918b-ff74-4825-a628-ac87c85d5e9f")]
[assembly: AssemblyTitle("SDRSharp.NoiseBlanker")]
[assembly: ComVisible(false)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: CompilationRelaxations(8)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]

View file

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{19B5337B-ECFD-460C-B48F-53747F45F37E}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<OutputType>Library</OutputType>
<AssemblyName>SDRSharp.NoiseBlanker</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'x86' ">
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>bin\Debug\</OutputPath>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>bin\Release\</OutputPath>
<DebugSymbols>true</DebugSymbols>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
</PropertyGroup>
<ItemGroup>
<Reference Include="SDRSharp.Radio">
<HintPath>C:\Users\James\Downloads\RTL-SDR Stuff\SDRSharper_06l\SDRSharp.Radio.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms">
<HintPath>C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll</HintPath>
</Reference>
<Reference Include="SDRSharp.Common">
<HintPath>C:\Users\James\Downloads\RTL-SDR Stuff\SDRSharper_06l\SDRSharp.Common.dll</HintPath>
</Reference>
<Reference Include="System">
<HintPath>C:\Windows\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll</HintPath>
</Reference>
<Reference Include="System.Core">
<HintPath>C:\Windows\assembly\GAC_MSIL\System.Core\3.5.0.0__b77a5c561934e089\System.Core.dll</HintPath>
</Reference>
<Reference Include="System.Drawing">
<HintPath>C:\Windows\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SDRSharp.NoiseBlanker\ComplexHelper.cs" />
<Compile Include="SDRSharp.NoiseBlanker\NoiseBlankerPlugin.cs" />
<Compile Include="SDRSharp.NoiseBlanker\NoiseBlankerProcessor.cs" />
<Compile Include="SDRSharp.NoiseBlanker\ProcessorPanel.cs">
<SubType>UserControl</SubType>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View file

@ -0,0 +1,15 @@
using SDRSharp.Radio;
using System;
namespace SDRSharp.NoiseBlanker
{
internal static class ComplexHelper
{
public static float FastMagnitude(this Complex c)
{
float val = Math.Abs(c.Real);
float val2 = Math.Abs(c.Imag);
return Math.Max(val, val2);
}
}
}

View file

@ -0,0 +1,41 @@
using SDRSharp.Common;
using SDRSharp.Radio;
using System.Windows.Forms;
namespace SDRSharp.NoiseBlanker
{
public class NoiseBlankerPlugin : ISharpPlugin
{
private const string _displayName = "Noise Blanker";
private ISharpControl _control;
private NoiseBlankerProcessor _processor;
private ProcessorPanel _guiControl;
public string DisplayName => "Noise Blanker";
public bool HasGui => true;
public UserControl GuiControl => this._guiControl;
public void Initialize(ISharpControl control)
{
this._control = control;
this._processor = new NoiseBlankerProcessor();
this._processor.Enabled = Utils.GetBooleanSetting("NBEnabled");
this._processor.NoiseThreshold = Utils.GetIntSetting("NBThreshold", 80);
this._processor.PulseWidth = Utils.GetDoubleSetting("NBPulseWidth", 10.0);
this._guiControl = new ProcessorPanel(this._processor);
this._control.RegisterStreamHook(this._processor, ProcessorType.RawIQ);
}
public void Close()
{
Utils.SaveSetting("NBEnabled", this._processor.Enabled);
Utils.SaveSetting("NBThreshold", this._processor.NoiseThreshold);
Utils.SaveSetting("NBPulseWidth", this._processor.PulseWidth);
}
}
}

View file

@ -0,0 +1,138 @@
using SDRSharp.Radio;
using System;
namespace SDRSharp.NoiseBlanker
{
public class NoiseBlankerProcessor : IIQProcessor, IBaseProcessor
{
private const int SizeFactor = 2;
private static readonly int AveragingWindow = 1000;
private double _sampleRate;
private bool _enabled;
private bool _needConfigure;
private int _averagingWindowLength;
private int _blankingWindowLength;
private int _index;
private int _threshold;
private double _pulseWidth;
private float _ratio;
private float _sum;
private float _norm;
private float _alpha;
private UnsafeBuffer _delay;
private unsafe Complex* _delayPtr;
public double SampleRate
{
get
{
return this._sampleRate;
}
set
{
this._sampleRate = value;
this._needConfigure = true;
}
}
public bool Enabled
{
get
{
return this._enabled;
}
set
{
this._enabled = value;
}
}
public int NoiseThreshold
{
get
{
return this._threshold;
}
set
{
this._threshold = value;
this._ratio = ((float)(100 - this._threshold) * 0.1f + 1f) * this._norm;
}
}
public double PulseWidth
{
get
{
return this._pulseWidth;
}
set
{
this._pulseWidth = value;
double num = Math.Min(Math.Max(this._pulseWidth * 1E-06 * this._sampleRate, 1.0), (double)this._averagingWindowLength);
this._blankingWindowLength = (int)num;
this._alpha = 1f / (float)this._blankingWindowLength;
}
}
private unsafe void Configure()
{
this._index = 0;
this._sum = 0f;
this._averagingWindowLength = (int)((double)NoiseBlankerProcessor.AveragingWindow * 1E-06 * this._sampleRate);
this._norm = 1f / (float)this._averagingWindowLength;
this._ratio = ((float)(100 - this._threshold) * 0.1f + 1f) * this._norm;
this._delay = UnsafeBuffer.Create((2 * this._averagingWindowLength + 1) * 2, sizeof(Complex));
this._delayPtr = (Complex*)(void*)this._delay;
double num = Math.Min(Math.Max(this._pulseWidth * 1E-06 * this._sampleRate, 1.0), (double)this._averagingWindowLength);
this._blankingWindowLength = (int)num;
this._alpha = 1f / (float)this._blankingWindowLength;
}
public unsafe void Process(Complex* buffer, int length)
{
if (this._needConfigure)
{
this.Configure();
this._needConfigure = false;
}
for (int i = 0; i < length; i++)
{
Complex* ptr = this._delayPtr + this._index;
*ptr = buffer[i];
float num = ptr[this._averagingWindowLength].FastMagnitude();
this._sum -= num;
this._sum += (*ptr).FastMagnitude();
if (num > this._ratio * this._sum)
{
Complex* ptr2 = ptr + this._averagingWindowLength;
for (int j = 0; j < this._blankingWindowLength; j++)
{
Complex.Mul(ref ptr2[j], (float)j * this._alpha);
}
}
buffer[i] = ptr[this._averagingWindowLength * 2];
if (--this._index < 0)
{
this._index = 2 * this._averagingWindowLength + 1;
Utils.Memcpy(this._delayPtr + this._index + 1, this._delayPtr, 2 * this._averagingWindowLength * sizeof(Complex));
}
}
}
}
}

View file

@ -0,0 +1,69 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace SDRSharp.NoiseBlanker {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class ProcessorPanel {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
private NoiseBlankerProcessor _processor;
public ProcessorPanel(NoiseBlankerProcessor processor)
{
_processor = processor;
}
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal ProcessorPanel() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SDRSharp.NoiseBlanker.ProcessorPanel", typeof(ProcessorPanel).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

View file

@ -0,0 +1,154 @@
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace SDRSharp.NoiseBlanker
{
public class ProcessorPanel : UserControl
{
private IContainer components;
private CheckBox enableCheckBox;
private Label thresholdLabel;
private TrackBar thresholdTrackBar;
private Label pulseWidthLabel;
private TrackBar pulseWidthTrackBar;
private Label label2;
private NoiseBlankerProcessor _processor;
protected override void Dispose(bool disposing)
{
if (disposing && this.components != null)
{
this.components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.enableCheckBox = new CheckBox();
this.thresholdLabel = new Label();
this.thresholdTrackBar = new TrackBar();
this.pulseWidthLabel = new Label();
this.pulseWidthTrackBar = new TrackBar();
this.label2 = new Label();
((ISupportInitialize)this.thresholdTrackBar).BeginInit();
((ISupportInitialize)this.pulseWidthTrackBar).BeginInit();
base.SuspendLayout();
this.enableCheckBox.Anchor = AnchorStyles.Top;
this.enableCheckBox.AutoSize = true;
this.enableCheckBox.Location = new Point(6, 3);
this.enableCheckBox.Name = "enableCheckBox";
this.enableCheckBox.Size = new Size(65, 17);
this.enableCheckBox.TabIndex = 0;
this.enableCheckBox.Text = "Enabled";
this.enableCheckBox.UseVisualStyleBackColor = true;
this.enableCheckBox.CheckedChanged += this.enableCheckBox_CheckedChanged;
this.thresholdLabel.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
this.thresholdLabel.ForeColor = SystemColors.ControlText;
this.thresholdLabel.Location = new Point(91, 3);
this.thresholdLabel.Name = "thresholdLabel";
this.thresholdLabel.Size = new Size(87, 23);
this.thresholdLabel.TabIndex = 6;
this.thresholdLabel.Text = "50";
this.thresholdLabel.TextAlign = ContentAlignment.MiddleRight;
this.thresholdLabel.Click += this.thresholdLabel_Click;
this.thresholdTrackBar.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
this.thresholdTrackBar.Location = new Point(0, 29);
this.thresholdTrackBar.Maximum = 100;
this.thresholdTrackBar.Name = "thresholdTrackBar";
this.thresholdTrackBar.Size = new Size(198, 45);
this.thresholdTrackBar.TabIndex = 1;
this.thresholdTrackBar.TickFrequency = 5;
this.thresholdTrackBar.Value = 20;
this.thresholdTrackBar.Scroll += this.thresholdTrackBar_Scroll;
this.pulseWidthLabel.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
this.pulseWidthLabel.ForeColor = SystemColors.ControlText;
this.pulseWidthLabel.Location = new Point(91, 57);
this.pulseWidthLabel.Name = "pulseWidthLabel";
this.pulseWidthLabel.Size = new Size(87, 23);
this.pulseWidthLabel.TabIndex = 8;
this.pulseWidthLabel.Text = "50";
this.pulseWidthLabel.TextAlign = ContentAlignment.MiddleRight;
this.pulseWidthLabel.Click += this.pulseWidthLabel_Click;
this.pulseWidthTrackBar.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
this.pulseWidthTrackBar.Location = new Point(6, 75);
this.pulseWidthTrackBar.Maximum = 1000;
this.pulseWidthTrackBar.Minimum = 1;
this.pulseWidthTrackBar.Name = "pulseWidthTrackBar";
this.pulseWidthTrackBar.Size = new Size(198, 45);
this.pulseWidthTrackBar.TabIndex = 2;
this.pulseWidthTrackBar.TickFrequency = 50;
this.pulseWidthTrackBar.Value = 100;
this.pulseWidthTrackBar.Scroll += this.pulseWidthTrackBar_Scroll;
this.label2.AutoSize = true;
this.label2.Location = new Point(-7, 63);
this.label2.Name = "label2";
this.label2.Size = new Size(61, 13);
this.label2.TabIndex = 9;
this.label2.Text = "Pulse width";
this.label2.Click += this.label2_Click;
this.BackColor = SystemColors.ControlLight;
base.Controls.Add(this.label2);
base.Controls.Add(this.pulseWidthLabel);
base.Controls.Add(this.pulseWidthTrackBar);
base.Controls.Add(this.thresholdLabel);
base.Controls.Add(this.thresholdTrackBar);
base.Controls.Add(this.enableCheckBox);
base.Name = "ProcessorPanel";
base.Size = new Size(204, 134);
((ISupportInitialize)this.thresholdTrackBar).EndInit();
((ISupportInitialize)this.pulseWidthTrackBar).EndInit();
base.ResumeLayout(false);
base.PerformLayout();
}
public ProcessorPanel(NoiseBlankerProcessor processor)
{
this._processor = processor;
this.InitializeComponent();
this.enableCheckBox.Checked = this._processor.Enabled;
this.thresholdTrackBar.Value = this._processor.NoiseThreshold;
this.pulseWidthTrackBar.Value = (int)(this._processor.PulseWidth * 10.0);
this.thresholdTrackBar_Scroll(null, null);
this.pulseWidthTrackBar_Scroll(null, null);
}
private void enableCheckBox_CheckedChanged(object sender, EventArgs e)
{
this._processor.Enabled = this.enableCheckBox.Checked;
}
private void thresholdTrackBar_Scroll(object sender, EventArgs e)
{
this._processor.NoiseThreshold = this.thresholdTrackBar.Value;
this.thresholdLabel.Text = this._processor.NoiseThreshold.ToString();
}
private void pulseWidthTrackBar_Scroll(object sender, EventArgs e)
{
this._processor.PulseWidth = (double)((float)this.pulseWidthTrackBar.Value * 0.1f);
this.pulseWidthLabel.Text = this._processor.PulseWidth.ToString("0.00") + " µS";
}
private void pulseWidthLabel_Click(object sender, EventArgs e)
{
}
private void label2_Click(object sender, EventArgs e)
{
}
private void thresholdLabel_Click(object sender, EventArgs e)
{
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,21 @@
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security.Permissions;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyTrademark("")]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyDescription("IAudioInterceptor Test Plugin")]
[assembly: ComVisible(false)]
[assembly: CompilationRelaxations(8)]
[assembly: AssemblyCopyright("Copyright © Youssef TOUIL and Ian Gilmour 2013")]
[assembly: AssemblyTitle("AudioInterceptorTest")]
[assembly: AssemblyProduct("SDR#")]
[assembly: Guid("dfd7918b-ff74-4825-a628-ac37c85d5e9f")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]

View file

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{A7EBED63-F37F-4F46-AAC3-5DA5794200C7}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<OutputType>Library</OutputType>
<AssemblyName>SDRSharp.NoiseReduction</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'x86' ">
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>bin\Debug\</OutputPath>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>bin\Release\</OutputPath>
<DebugSymbols>true</DebugSymbols>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
</PropertyGroup>
<ItemGroup>
<Reference Include="SDRSharp.Radio">
<HintPath>C:\Users\James\Downloads\RTL-SDR Stuff\SDRSharper_06l\SDRSharp.Radio.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms">
<HintPath>C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll</HintPath>
</Reference>
<Reference Include="SDRSharp.Common">
<HintPath>C:\Users\James\Downloads\RTL-SDR Stuff\SDRSharper_06l\SDRSharp.Common.dll</HintPath>
</Reference>
<Reference Include="System">
<HintPath>C:\Windows\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll</HintPath>
</Reference>
<Reference Include="SDRSharp.Controls">
<HintPath>C:\Users\James\Downloads\RTL-SDR Stuff\SDRSharper_06l\SDRSharp.Controls.dll</HintPath>
</Reference>
<Reference Include="System.Core">
<HintPath>C:\Windows\assembly\GAC_MSIL\System.Core\3.5.0.0__b77a5c561934e089\System.Core.dll</HintPath>
</Reference>
<Reference Include="System.Drawing">
<HintPath>C:\Windows\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SDRSharp.NoiseReduction\AFProcessor.cs" />
<Compile Include="SDRSharp.NoiseReduction\ComplexHelper.cs" />
<Compile Include="SDRSharp.NoiseReduction\IFProcessor.cs" />
<Compile Include="SDRSharp.NoiseReduction\INoiseProcessor.cs" />
<Compile Include="SDRSharp.NoiseReduction\NoiseBlankerProcessor.cs" />
<Compile Include="SDRSharp.NoiseReduction\NoiseFilter.cs" />
<Compile Include="SDRSharp.NoiseReduction\NoiseReductionPanel.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="SDRSharp.NoiseReduction\NoiseReductionPlugin.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View file

@ -0,0 +1,62 @@
using SDRSharp.Radio;
namespace SDRSharp.NoiseReduction
{
public class AFProcessor : INoiseProcessor, IRealProcessor, IBaseProcessor
{
private double _sampleRate;
private bool _enabled;
private NoiseFilter _filter1;
private NoiseFilter _filter2;
private bool _needNewFilters;
public double SampleRate
{
get
{
return this._sampleRate;
}
set
{
this._sampleRate = value;
this._needNewFilters = true;
}
}
public bool Enabled
{
get
{
return this._enabled;
}
set
{
this._enabled = value;
}
}
public int NoiseThreshold
{
get;
set;
}
public unsafe void Process(float* buffer, int length)
{
if (this._needNewFilters)
{
this._filter1 = new NoiseFilter(4096);
this._filter2 = new NoiseFilter(4096);
this._needNewFilters = false;
}
this._filter1.NoiseThreshold = (float)this.NoiseThreshold;
this._filter2.NoiseThreshold = (float)this.NoiseThreshold;
this._filter1.Process(buffer, length, 2);
this._filter2.Process(buffer + 1, length, 2);
}
}
}

View file

@ -0,0 +1,15 @@
using SDRSharp.Radio;
using System;
namespace SDRSharp.NoiseReduction
{
internal static class ComplexHelper
{
public static float FastMagnitude(this Complex c)
{
float val = Math.Abs(c.Real);
float val2 = Math.Abs(c.Imag);
return Math.Max(val, val2);
}
}
}

View file

@ -0,0 +1,57 @@
using SDRSharp.Radio;
namespace SDRSharp.NoiseReduction
{
public class IFProcessor : INoiseProcessor, IIQProcessor, IBaseProcessor
{
private double _sampleRate;
private bool _enabled;
private NoiseFilter _filter;
private bool _needNewFilter;
public double SampleRate
{
get
{
return this._sampleRate;
}
set
{
this._sampleRate = value;
this._needNewFilter = true;
}
}
public bool Enabled
{
get
{
return this._enabled;
}
set
{
this._enabled = value;
}
}
public int NoiseThreshold
{
get;
set;
}
public unsafe void Process(Complex* buffer, int length)
{
if (this._needNewFilter)
{
this._filter = new NoiseFilter(4096);
this._needNewFilter = false;
}
this._filter.NoiseThreshold = (float)this.NoiseThreshold;
this._filter.Process(buffer, length);
}
}
}

View file

@ -0,0 +1,13 @@
using SDRSharp.Radio;
namespace SDRSharp.NoiseReduction
{
public interface INoiseProcessor : IBaseProcessor
{
int NoiseThreshold
{
get;
set;
}
}
}

View file

@ -0,0 +1,141 @@
using SDRSharp.Radio;
using System;
namespace SDRSharp.NoiseReduction
{
public class NoiseBlankerProcessor : IIQProcessor, IBaseProcessor
{
private const int SizeFactor = 2;
private static readonly int AveragingWindow = 1000;
private double _sampleRate;
private bool _enabled;
private bool _needConfigure;
private int _averagingWindowLength;
private int _blankingWindowLength;
private int _index;
private int _threshold;
private double _pulseWidth;
private float _ratio;
private float _sum;
private float _norm;
private float _alpha;
private UnsafeBuffer _delay;
private unsafe Complex* _delayPtr;
public double SampleRate
{
get
{
return this._sampleRate;
}
set
{
this._sampleRate = value;
this._needConfigure = true;
}
}
public bool Enabled
{
get
{
return this._enabled;
}
set
{
this._enabled = value;
}
}
public int NoiseThreshold
{
get
{
return this._threshold;
}
set
{
this._threshold = value;
this._ratio = ((float)(100 - this._threshold) * 0.1f + 1f) * this._norm;
}
}
public double PulseWidth
{
get
{
return this._pulseWidth;
}
set
{
this._pulseWidth = value;
double num = Math.Min(Math.Max(this._pulseWidth * 1E-06 * this._sampleRate, 1.0), (double)this._averagingWindowLength);
this._blankingWindowLength = (int)num;
this._alpha = 1f / (float)this._blankingWindowLength;
}
}
private unsafe void Configure()
{
this._index = 0;
this._sum = 0f;
this._averagingWindowLength = (int)((double)NoiseBlankerProcessor.AveragingWindow * 1E-06 * this._sampleRate);
this._norm = 1f / (float)this._averagingWindowLength;
this._ratio = ((float)(100 - this._threshold) * 0.1f + 1f) * this._norm;
this._delay = UnsafeBuffer.Create((2 * this._averagingWindowLength + 1) * 2, sizeof(Complex));
this._delayPtr = (Complex*)(void*)this._delay;
double num = Math.Min(Math.Max(this._pulseWidth * 1E-06 * this._sampleRate, 1.0), (double)this._averagingWindowLength);
this._blankingWindowLength = (int)num;
this._alpha = 1f / (float)this._blankingWindowLength;
}
public unsafe void Process(Complex* buffer, int length)
{
if (this._needConfigure)
{
this.Configure();
this._needConfigure = false;
}
if (this.SampleRate != 0.0)
{
for (int i = 0; i < length; i++)
{
Complex* ptr = this._delayPtr + this._index;
*ptr = buffer[i];
float num = ptr[this._averagingWindowLength].FastMagnitude();
this._sum -= num;
this._sum += (*ptr).FastMagnitude();
if (num > this._ratio * this._sum)
{
Complex* ptr2 = ptr + this._averagingWindowLength;
for (int j = 0; j < this._blankingWindowLength; j++)
{
Complex.Mul(ref ptr2[j], (float)j * this._alpha);
}
}
buffer[i] = ptr[this._averagingWindowLength * 2];
if (--this._index < 0)
{
this._index = 2 * this._averagingWindowLength + 1;
Utils.Memcpy(this._delayPtr + this._index + 1, this._delayPtr, 2 * this._averagingWindowLength * sizeof(Complex));
}
}
}
}
}
}

View file

@ -0,0 +1,82 @@
using SDRSharp.Radio;
namespace SDRSharp.NoiseReduction
{
public class NoiseFilter : FftProcessor
{
private const int WindowSize = 32;
private const int FftSize = 4096;
private const float OverlapRatio = 0.2f;
private float _noiseThreshold;
private readonly UnsafeBuffer _gainBuffer;
private unsafe readonly float* _gainPtr;
private readonly UnsafeBuffer _smoothedGainBuffer;
private unsafe readonly float* _smoothedGainPtr;
private readonly UnsafeBuffer _powerBuffer;
private unsafe readonly float* _powerPtr;
public float NoiseThreshold
{
get
{
return this._noiseThreshold;
}
set
{
this._noiseThreshold = value;
}
}
public unsafe NoiseFilter(int fftSize = 4096)
: base(fftSize, 0.2f)
{
this._gainBuffer = UnsafeBuffer.Create(fftSize, 4);
this._gainPtr = (float*)(void*)this._gainBuffer;
this._smoothedGainBuffer = UnsafeBuffer.Create(fftSize, 4);
this._smoothedGainPtr = (float*)(void*)this._smoothedGainBuffer;
this._powerBuffer = UnsafeBuffer.Create(fftSize, 4);
this._powerPtr = (float*)(void*)this._powerBuffer;
}
protected unsafe override void ProcessFft(Complex* buffer, int length)
{
Fourier.SpectrumPower(buffer, this._powerPtr, length, 0f, false);
for (int i = 0; i < length; i++)
{
this._gainPtr[i] = ((this._powerPtr[i] > this._noiseThreshold) ? 1f : 0f);
}
for (int j = 0; j < length; j++)
{
float num = 0f;
for (int k = -16; k < 16; k++)
{
int num2 = j + k;
if (num2 >= length)
{
num2 -= length;
}
if (num2 < 0)
{
num2 += length;
}
num += this._gainPtr[num2];
}
float num3 = num / 32f;
this._smoothedGainPtr[j] = num3;
}
for (int l = 0; l < length; l++)
{
Complex.Mul(ref buffer[l], this._smoothedGainPtr[l]);
}
}
}
}

View file

@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace SDRSharp.NoiseReduction {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class NoiseReductionPanel {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
private AFProcessor _audioProcessor;
private NoiseBlankerProcessor _noiseProcessor;
public NoiseReductionPanel(IFProcessor _ifProcessor, AFProcessor audioProcessor, NoiseBlankerProcessor noiseProcessor) : this(_ifProcessor)
{
_audioProcessor = audioProcessor;
_noiseProcessor = noiseProcessor;
}
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal NoiseReductionPanel(IFProcessor _ifProcessor) {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SDRSharp.NoiseReduction.NoiseReductionPanel", typeof(NoiseReductionPanel).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

View file

@ -0,0 +1,336 @@
using SDRSharp.Controls;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace SDRSharp.NoiseReduction
{
public class NoiseReductionPanel : UserControl
{
private INoiseProcessor _aControl;
private INoiseProcessor _iControl;
private NoiseBlankerProcessor _processor;
private IContainer components;
private Label ifThresholdLabel;
private Label audioThresholdLabel;
private gSliderH ifThresholdTrackBar;
private gSliderH audioThresholdTrackBar;
private Label label3;
private Label pulseWidthLabel;
private Label thresholdLabel;
private gSliderH thresholdTrackBar;
private gSliderH pulseWidthTrackBar;
private gButton ifEnableCheckBox;
private gButton audioEnableCheckbox;
private gButton enableCheckBox;
private Panel panel1;
private Panel panel2;
public NoiseReductionPanel(INoiseProcessor iControl, INoiseProcessor aControl, NoiseBlankerProcessor processor)
{
this._iControl = iControl;
this._aControl = aControl;
this._processor = processor;
this.InitializeComponent();
this.ifThresholdTrackBar.Value = this._iControl.NoiseThreshold;
this.ifEnableCheckBox.Checked = this._iControl.Enabled;
this.audioThresholdTrackBar.Value = this._aControl.NoiseThreshold;
this.audioEnableCheckbox.Checked = this._aControl.Enabled;
this.ifThresholdTrackBar_Scroll(null, null);
this.audioThresholdTrackBar_Scroll(null, null);
this.thresholdTrackBar.Value = this._processor.NoiseThreshold;
this.pulseWidthTrackBar.Value = (int)(this._processor.PulseWidth * 10.0);
this.enableCheckBox.Checked = this._processor.Enabled;
this.thresholdTrackBar_Scroll(null, null);
this.pulseWidthTrackBar_Scroll(null, null);
}
private void ifEnableCheckBox_CheckedChanged(object sender, EventArgs e)
{
this._iControl.Enabled = this.ifEnableCheckBox.Checked;
this.ifThresholdTrackBar_Scroll(null, null);
}
private void audioEnableCheckbox_CheckedChanged(object sender, EventArgs e)
{
this._aControl.Enabled = this.audioEnableCheckbox.Checked;
this.audioThresholdTrackBar_Scroll(null, null);
}
private void ifThresholdTrackBar_Scroll(object sender, EventArgs e)
{
this.ifThresholdLabel.Text = this.ifThresholdTrackBar.Value + " dB";
this._iControl.NoiseThreshold = this.ifThresholdTrackBar.Value;
}
private void audioThresholdTrackBar_Scroll(object sender, EventArgs e)
{
this.audioThresholdLabel.Text = this.audioThresholdTrackBar.Value + " dB";
this._aControl.NoiseThreshold = this.audioThresholdTrackBar.Value;
}
private void enableCheckBox_CheckedChanged(object sender, EventArgs e)
{
this._processor.Enabled = this.enableCheckBox.Checked;
this.thresholdTrackBar_Scroll(null, null);
this.pulseWidthTrackBar_Scroll(null, null);
}
private void thresholdTrackBar_Scroll(object sender, EventArgs e)
{
this._processor.NoiseThreshold = this.thresholdTrackBar.Value;
this.thresholdLabel.Text = this._processor.NoiseThreshold.ToString();
}
private void pulseWidthTrackBar_Scroll(object sender, EventArgs e)
{
this._processor.PulseWidth = (double)((float)this.pulseWidthTrackBar.Value * 0.1f);
this.pulseWidthLabel.Text = this._processor.PulseWidth.ToString("0.0") + " µs";
}
protected override void Dispose(bool disposing)
{
if (disposing && this.components != null)
{
this.components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.ifThresholdLabel = new Label();
this.audioThresholdLabel = new Label();
this.label3 = new Label();
this.pulseWidthLabel = new Label();
this.thresholdLabel = new Label();
this.panel1 = new Panel();
this.panel2 = new Panel();
this.thresholdTrackBar = new gSliderH();
this.enableCheckBox = new gButton();
this.pulseWidthTrackBar = new gSliderH();
this.ifThresholdTrackBar = new gSliderH();
this.audioEnableCheckbox = new gButton();
this.ifEnableCheckBox = new gButton();
this.audioThresholdTrackBar = new gSliderH();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
base.SuspendLayout();
this.ifThresholdLabel.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
this.ifThresholdLabel.ForeColor = Color.Yellow;
this.ifThresholdLabel.Location = new Point(45, 8);
this.ifThresholdLabel.Name = "ifThresholdLabel";
this.ifThresholdLabel.Size = new Size(44, 23);
this.ifThresholdLabel.TabIndex = 6;
this.ifThresholdLabel.Text = "-5 dB";
this.ifThresholdLabel.TextAlign = ContentAlignment.MiddleCenter;
this.audioThresholdLabel.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
this.audioThresholdLabel.ForeColor = Color.Yellow;
this.audioThresholdLabel.Location = new Point(45, 34);
this.audioThresholdLabel.Name = "audioThresholdLabel";
this.audioThresholdLabel.Size = new Size(44, 23);
this.audioThresholdLabel.TabIndex = 6;
this.audioThresholdLabel.Text = "-5 dB";
this.audioThresholdLabel.TextAlign = ContentAlignment.MiddleCenter;
this.label3.ForeColor = Color.Orange;
this.label3.Location = new Point(7, 32);
this.label3.Name = "label3";
this.label3.Size = new Size(37, 30);
this.label3.TabIndex = 17;
this.label3.Text = "Pulse width";
this.pulseWidthLabel.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
this.pulseWidthLabel.ForeColor = Color.Yellow;
this.pulseWidthLabel.Location = new Point(46, 31);
this.pulseWidthLabel.Name = "pulseWidthLabel";
this.pulseWidthLabel.Size = new Size(44, 23);
this.pulseWidthLabel.TabIndex = 16;
this.pulseWidthLabel.Text = "50";
this.pulseWidthLabel.TextAlign = ContentAlignment.MiddleCenter;
this.thresholdLabel.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
this.thresholdLabel.ForeColor = Color.Yellow;
this.thresholdLabel.Location = new Point(46, 6);
this.thresholdLabel.Name = "thresholdLabel";
this.thresholdLabel.Size = new Size(44, 23);
this.thresholdLabel.TabIndex = 15;
this.thresholdLabel.Text = "50";
this.thresholdLabel.TextAlign = ContentAlignment.MiddleCenter;
this.panel1.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
this.panel1.BackColor = Color.FromArgb(64, 64, 64);
this.panel1.Controls.Add(this.ifThresholdTrackBar);
this.panel1.Controls.Add(this.audioEnableCheckbox);
this.panel1.Controls.Add(this.ifEnableCheckBox);
this.panel1.Controls.Add(this.audioThresholdTrackBar);
this.panel1.Controls.Add(this.ifThresholdLabel);
this.panel1.Controls.Add(this.audioThresholdLabel);
this.panel1.Location = new Point(0, 2);
this.panel1.Name = "panel1";
this.panel1.Size = new Size(198, 62);
this.panel1.TabIndex = 71;
this.panel2.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
this.panel2.BackColor = Color.FromArgb(64, 64, 64);
this.panel2.Controls.Add(this.thresholdTrackBar);
this.panel2.Controls.Add(this.enableCheckBox);
this.panel2.Controls.Add(this.pulseWidthTrackBar);
this.panel2.Controls.Add(this.label3);
this.panel2.Controls.Add(this.thresholdLabel);
this.panel2.Controls.Add(this.pulseWidthLabel);
this.panel2.Location = new Point(0, 63);
this.panel2.Name = "panel2";
this.panel2.Size = new Size(198, 62);
this.panel2.TabIndex = 72;
this.thresholdTrackBar.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
this.thresholdTrackBar.Button = false;
this.thresholdTrackBar.Checked = false;
this.thresholdTrackBar.ColorFactor = 0.5f;
this.thresholdTrackBar.ForeColor = Color.Black;
this.thresholdTrackBar.Location = new Point(89, 10);
this.thresholdTrackBar.Margin = new Padding(4);
this.thresholdTrackBar.Maximum = 100;
this.thresholdTrackBar.Minimum = 0;
this.thresholdTrackBar.Name = "thresholdTrackBar";
this.thresholdTrackBar.Size = new Size(107, 16);
this.thresholdTrackBar.TabIndex = 8;
this.thresholdTrackBar.TickColor = Color.Silver;
this.thresholdTrackBar.Ticks = 8;
this.thresholdTrackBar.ToolTip = null;
this.thresholdTrackBar.Value = 20;
this.thresholdTrackBar.ValueChanged += this.thresholdTrackBar_Scroll;
this.enableCheckBox.Arrow = 99;
this.enableCheckBox.Checked = false;
this.enableCheckBox.Edge = 0.15f;
this.enableCheckBox.EndColor = Color.White;
this.enableCheckBox.EndFactor = 0.2f;
this.enableCheckBox.Font = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Regular, GraphicsUnit.Point, 0);
this.enableCheckBox.ForeColor = Color.Orange;
this.enableCheckBox.Location = new Point(2, 6);
this.enableCheckBox.Name = "enableCheckBox";
this.enableCheckBox.NoBorder = false;
this.enableCheckBox.NoLed = false;
this.enableCheckBox.RadioButton = false;
this.enableCheckBox.Radius = 6;
this.enableCheckBox.RadiusB = 0;
this.enableCheckBox.Size = new Size(44, 24);
this.enableCheckBox.StartColor = Color.Black;
this.enableCheckBox.StartFactor = 0.35f;
this.enableCheckBox.TabIndex = 70;
this.enableCheckBox.Text = "N-Bl.";
this.enableCheckBox.CheckedChanged += this.enableCheckBox_CheckedChanged;
this.pulseWidthTrackBar.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
this.pulseWidthTrackBar.Button = false;
this.pulseWidthTrackBar.Checked = false;
this.pulseWidthTrackBar.ColorFactor = 0.5f;
this.pulseWidthTrackBar.ForeColor = Color.Black;
this.pulseWidthTrackBar.Location = new Point(89, 36);
this.pulseWidthTrackBar.Margin = new Padding(4);
this.pulseWidthTrackBar.Maximum = 999;
this.pulseWidthTrackBar.Minimum = 1;
this.pulseWidthTrackBar.Name = "pulseWidthTrackBar";
this.pulseWidthTrackBar.Size = new Size(107, 16);
this.pulseWidthTrackBar.TabIndex = 12;
this.pulseWidthTrackBar.TickColor = Color.Silver;
this.pulseWidthTrackBar.Ticks = 8;
this.pulseWidthTrackBar.ToolTip = null;
this.pulseWidthTrackBar.Value = 100;
this.pulseWidthTrackBar.ValueChanged += this.pulseWidthTrackBar_Scroll;
this.ifThresholdTrackBar.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
this.ifThresholdTrackBar.Button = false;
this.ifThresholdTrackBar.Checked = false;
this.ifThresholdTrackBar.ColorFactor = 0.5f;
this.ifThresholdTrackBar.ForeColor = Color.Black;
this.ifThresholdTrackBar.Location = new Point(90, 10);
this.ifThresholdTrackBar.Margin = new Padding(4);
this.ifThresholdTrackBar.Maximum = 20;
this.ifThresholdTrackBar.Minimum = -80;
this.ifThresholdTrackBar.Name = "ifThresholdTrackBar";
this.ifThresholdTrackBar.Size = new Size(105, 16);
this.ifThresholdTrackBar.TabIndex = 7;
this.ifThresholdTrackBar.TickColor = Color.Silver;
this.ifThresholdTrackBar.Ticks = 8;
this.ifThresholdTrackBar.ToolTip = null;
this.ifThresholdTrackBar.Value = -30;
this.ifThresholdTrackBar.ValueChanged += this.ifThresholdTrackBar_Scroll;
this.audioEnableCheckbox.Arrow = 99;
this.audioEnableCheckbox.Checked = false;
this.audioEnableCheckbox.Edge = 0.15f;
this.audioEnableCheckbox.EndColor = Color.White;
this.audioEnableCheckbox.EndFactor = 0.2f;
this.audioEnableCheckbox.Font = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Regular, GraphicsUnit.Point, 0);
this.audioEnableCheckbox.ForeColor = Color.Orange;
this.audioEnableCheckbox.Location = new Point(2, 33);
this.audioEnableCheckbox.Name = "audioEnableCheckbox";
this.audioEnableCheckbox.NoBorder = false;
this.audioEnableCheckbox.NoLed = false;
this.audioEnableCheckbox.RadioButton = false;
this.audioEnableCheckbox.Radius = 6;
this.audioEnableCheckbox.RadiusB = 0;
this.audioEnableCheckbox.Size = new Size(44, 24);
this.audioEnableCheckbox.StartColor = Color.Black;
this.audioEnableCheckbox.StartFactor = 0.35f;
this.audioEnableCheckbox.TabIndex = 69;
this.audioEnableCheckbox.Text = "A.F.";
this.audioEnableCheckbox.CheckedChanged += this.audioEnableCheckbox_CheckedChanged;
this.ifEnableCheckBox.Arrow = 99;
this.ifEnableCheckBox.Checked = false;
this.ifEnableCheckBox.Edge = 0.15f;
this.ifEnableCheckBox.EndColor = Color.White;
this.ifEnableCheckBox.EndFactor = 0.2f;
this.ifEnableCheckBox.Font = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Regular, GraphicsUnit.Point, 0);
this.ifEnableCheckBox.ForeColor = Color.Orange;
this.ifEnableCheckBox.Location = new Point(2, 6);
this.ifEnableCheckBox.Name = "ifEnableCheckBox";
this.ifEnableCheckBox.NoBorder = false;
this.ifEnableCheckBox.NoLed = false;
this.ifEnableCheckBox.RadioButton = false;
this.ifEnableCheckBox.Radius = 6;
this.ifEnableCheckBox.RadiusB = 0;
this.ifEnableCheckBox.Size = new Size(44, 24);
this.ifEnableCheckBox.StartColor = Color.Black;
this.ifEnableCheckBox.StartFactor = 0.35f;
this.ifEnableCheckBox.TabIndex = 68;
this.ifEnableCheckBox.Text = "I.F.";
this.ifEnableCheckBox.CheckedChanged += this.ifEnableCheckBox_CheckedChanged;
this.audioThresholdTrackBar.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
this.audioThresholdTrackBar.Button = false;
this.audioThresholdTrackBar.Checked = false;
this.audioThresholdTrackBar.ColorFactor = 0.5f;
this.audioThresholdTrackBar.ForeColor = Color.Black;
this.audioThresholdTrackBar.Location = new Point(90, 36);
this.audioThresholdTrackBar.Margin = new Padding(4);
this.audioThresholdTrackBar.Maximum = 20;
this.audioThresholdTrackBar.Minimum = -120;
this.audioThresholdTrackBar.Name = "audioThresholdTrackBar";
this.audioThresholdTrackBar.Size = new Size(105, 16);
this.audioThresholdTrackBar.TabIndex = 8;
this.audioThresholdTrackBar.TickColor = Color.Silver;
this.audioThresholdTrackBar.Ticks = 8;
this.audioThresholdTrackBar.ToolTip = null;
this.audioThresholdTrackBar.Value = -30;
this.audioThresholdTrackBar.ValueChanged += this.audioThresholdTrackBar_Scroll;
base.Controls.Add(this.panel2);
base.Controls.Add(this.panel1);
base.Name = "NoiseReductionPanel";
base.Size = new Size(198, 145);
this.panel1.ResumeLayout(false);
this.panel2.ResumeLayout(false);
base.ResumeLayout(false);
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,57 @@
using SDRSharp.Common;
using SDRSharp.Radio;
using System.Windows.Forms;
namespace SDRSharp.NoiseReduction
{
public class NoiseReductionPlugin : ISharpPlugin
{
private const string _displayName = "Noise Reduction";
private ISharpControl _control;
private AFProcessor _audioProcessor;
private IFProcessor _ifProcessor;
private NoiseBlankerProcessor _noiseProcessor;
private NoiseReductionPanel _guiControl;
public string DisplayName => "Noise Reduction";
public bool HasGui => true;
public UserControl GuiControl => this._guiControl;
public void Initialize(ISharpControl control)
{
this._control = control;
this._audioProcessor = new AFProcessor();
this._control.RegisterStreamHook(this._audioProcessor, ProcessorType.FilteredAudioOutput);
this._ifProcessor = new IFProcessor();
this._control.RegisterStreamHook(this._ifProcessor, ProcessorType.DecimatedAndFilteredIQ);
this._ifProcessor.NoiseThreshold = Utils.GetIntSetting("DNRIThreshold", -30);
this._ifProcessor.Enabled = Utils.GetBooleanSetting("DNRIEnabled");
this._audioProcessor.NoiseThreshold = Utils.GetIntSetting("DNRAThreshold", -70);
this._audioProcessor.Enabled = Utils.GetBooleanSetting("DNRAEnabled");
this._noiseProcessor = new NoiseBlankerProcessor();
this._noiseProcessor.Enabled = Utils.GetBooleanSetting("NBEnabled");
this._noiseProcessor.NoiseThreshold = Utils.GetIntSetting("NBThreshold", 80);
this._noiseProcessor.PulseWidth = Utils.GetDoubleSetting("NBPulseWidth", 10.0);
this._control.RegisterStreamHook(this._noiseProcessor, ProcessorType.RawIQ);
this._guiControl = new NoiseReductionPanel(this._ifProcessor, this._audioProcessor, this._noiseProcessor);
}
public void Close()
{
Utils.SaveSetting("DNRIThreshold", this._ifProcessor.NoiseThreshold);
Utils.SaveSetting("DNRIEnabled", this._ifProcessor.Enabled);
Utils.SaveSetting("DNRAThreshold", this._audioProcessor.NoiseThreshold);
Utils.SaveSetting("DNRAEnabled", this._audioProcessor.Enabled);
Utils.SaveSetting("NBEnabled", this._noiseProcessor.Enabled);
Utils.SaveSetting("NBThreshold", this._noiseProcessor.NoiseThreshold);
Utils.SaveSetting("NBPulseWidth", this._noiseProcessor.PulseWidth);
}
}
}

View file

@ -0,0 +1,14 @@
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security.Permissions;
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyProduct("SDR#")]
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyCopyright("Copyright © Youssef TOUIL 2012")]
[assembly: AssemblyTitle("RTL-SDR Controller")]
[assembly: AssemblyDescription("USB interface for RTL2832U based DVB-T dongles")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]

View file

@ -0,0 +1,49 @@
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Resources;
using System.Runtime.CompilerServices;
namespace SDRSharp.FUNcube.Properties
{
[DebuggerNonUserCode]
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[CompilerGenerated]
internal class Resources
{
private static ResourceManager resourceMan;
private static CultureInfo resourceCulture;
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static ResourceManager ResourceManager
{
get
{
if (object.ReferenceEquals(Resources.resourceMan, null))
{
ResourceManager resourceManager = Resources.resourceMan = new ResourceManager("SDRSharp.FUNcube.Properties.Resources", typeof(Resources).Assembly);
}
return Resources.resourceMan;
}
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static CultureInfo Culture
{
get
{
return Resources.resourceCulture;
}
set
{
Resources.resourceCulture = value;
}
}
internal Resources()
{
}
}
}

View file

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{64A9B07D-E5C2-4BF8-8D74-51EAC433ED57}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<OutputType>Library</OutputType>
<AssemblyName>SDRSharp.RTLSDR</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>bin\Debug\</OutputPath>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>bin\Release\</OutputPath>
<DebugSymbols>true</DebugSymbols>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Release\</OutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System.Windows.Forms">
<HintPath>C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll</HintPath>
</Reference>
<Reference Include="SDRSharp.Radio">
<HintPath>C:\Users\James\Downloads\RTL-SDR Stuff\SDRSharper_06l\SDRSharp.Radio.dll</HintPath>
</Reference>
<Reference Include="System">
<HintPath>C:\Windows\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll</HintPath>
</Reference>
<Reference Include="System.Drawing">
<HintPath>C:\Windows\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SDRSharp.FUNcube.Properties\Resources.cs" />
<Compile Include="SDRSharp.RTLSDR\DeviceDisplay.cs" />
<Compile Include="SDRSharp.RTLSDR\NativeMethods.cs" />
<Compile Include="SDRSharp.RTLSDR\RtlDevice.cs" />
<Compile Include="SDRSharp.RTLSDR\RtlSdrControllerDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="SDRSharp.RTLSDR\RtlSdrIO.cs" />
<Compile Include="SDRSharp.RTLSDR\RtlSdrReadAsyncDelegate.cs" />
<Compile Include="SDRSharp.RTLSDR\RtlSdrTunerType.cs" />
<Compile Include="SDRSharp.RTLSDR\SamplesAvailableDelegate.cs" />
<Compile Include="SDRSharp.RTLSDR\SamplesAvailableEventArgs.cs" />
<Compile Include="SDRSharp.RTLSDR\SamplingMode.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View file

@ -0,0 +1,38 @@
namespace SDRSharp.RTLSDR
{
public class DeviceDisplay
{
public uint Index
{
get;
private set;
}
public string Name
{
get;
set;
}
public static DeviceDisplay[] GetActiveDevices()
{
uint num = NativeMethods.rtlsdr_get_device_count();
DeviceDisplay[] array = new DeviceDisplay[num];
for (uint num2 = 0u; num2 < num; num2++)
{
string name = NativeMethods.rtlsdr_get_device_name(num2);
array[num2] = new DeviceDisplay
{
Index = num2,
Name = name
};
}
return array;
}
public override string ToString()
{
return this.Name;
}
}
}

View file

@ -0,0 +1,101 @@
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace SDRSharp.RTLSDR
{
public class NativeMethods
{
private const string LibRtlSdr = "rtlsdr";
[DllImport("rtlsdr", CallingConvention = CallingConvention.Cdecl)]
public static extern uint rtlsdr_get_device_count();
[DllImport("rtlsdr", CallingConvention = CallingConvention.Cdecl, EntryPoint = "rtlsdr_get_device_name")]
private static extern IntPtr rtlsdr_get_device_name_native(uint index);
public static string rtlsdr_get_device_name(uint index)
{
IntPtr ptr = NativeMethods.rtlsdr_get_device_name_native(index);
return Marshal.PtrToStringAnsi(ptr);
}
[DllImport("rtlsdr", CallingConvention = CallingConvention.Cdecl)]
public static extern int rtlsdr_get_device_usb_strings(uint index, StringBuilder manufact, StringBuilder product, StringBuilder serial);
[DllImport("rtlsdr", CallingConvention = CallingConvention.Cdecl)]
public static extern int rtlsdr_open(out IntPtr dev, uint index);
[DllImport("rtlsdr", CallingConvention = CallingConvention.Cdecl)]
public static extern int rtlsdr_close(IntPtr dev);
[DllImport("rtlsdr", CallingConvention = CallingConvention.Cdecl)]
public static extern int rtlsdr_set_xtal_freq(IntPtr dev, uint rtlFreq, uint tunerFreq);
[DllImport("rtlsdr", CallingConvention = CallingConvention.Cdecl)]
public static extern int rtlsdr_get_xtal_freq(IntPtr dev, out uint rtlFreq, out uint tunerFreq);
[DllImport("rtlsdr", CallingConvention = CallingConvention.Cdecl)]
public static extern int rtlsdr_get_usb_strings(IntPtr dev, StringBuilder manufact, StringBuilder product, StringBuilder serial);
[DllImport("rtlsdr", CallingConvention = CallingConvention.Cdecl)]
public static extern int rtlsdr_set_center_freq(IntPtr dev, uint freq);
[DllImport("rtlsdr", CallingConvention = CallingConvention.Cdecl)]
public static extern uint rtlsdr_get_center_freq(IntPtr dev);
[DllImport("rtlsdr", CallingConvention = CallingConvention.Cdecl)]
public static extern int rtlsdr_set_freq_correction(IntPtr dev, int ppm);
[DllImport("rtlsdr", CallingConvention = CallingConvention.Cdecl)]
public static extern int rtlsdr_get_freq_correction(IntPtr dev);
[DllImport("rtlsdr", CallingConvention = CallingConvention.Cdecl)]
public static extern int rtlsdr_get_tuner_gains(IntPtr dev, [In] [Out] int[] gains);
[DllImport("rtlsdr", CallingConvention = CallingConvention.Cdecl)]
public static extern RtlSdrTunerType rtlsdr_get_tuner_type(IntPtr dev);
[DllImport("rtlsdr", CallingConvention = CallingConvention.Cdecl)]
public static extern int rtlsdr_set_tuner_gain(IntPtr dev, int gain);
[DllImport("rtlsdr", CallingConvention = CallingConvention.Cdecl)]
public static extern int rtlsdr_get_tuner_gain(IntPtr dev);
[DllImport("rtlsdr", CallingConvention = CallingConvention.Cdecl)]
public static extern int rtlsdr_set_tuner_gain_mode(IntPtr dev, int manual);
[DllImport("rtlsdr", CallingConvention = CallingConvention.Cdecl)]
public static extern int rtlsdr_set_agc_mode(IntPtr dev, int on);
[DllImport("rtlsdr", CallingConvention = CallingConvention.Cdecl)]
public static extern int rtlsdr_set_direct_sampling(IntPtr dev, int on);
[DllImport("rtlsdr", CallingConvention = CallingConvention.Cdecl)]
public static extern int rtlsdr_set_offset_tuning(IntPtr dev, int on);
[DllImport("rtlsdr", CallingConvention = CallingConvention.Cdecl)]
public static extern int rtlsdr_set_sample_rate(IntPtr dev, uint rate);
[DllImport("rtlsdr", CallingConvention = CallingConvention.Cdecl)]
public static extern uint rtlsdr_get_sample_rate(IntPtr dev);
[DllImport("rtlsdr", CallingConvention = CallingConvention.Cdecl)]
public static extern int rtlsdr_set_testmode(IntPtr dev, int on);
[DllImport("rtlsdr", CallingConvention = CallingConvention.Cdecl)]
public static extern int rtlsdr_reset_buffer(IntPtr dev);
[DllImport("rtlsdr", CallingConvention = CallingConvention.Cdecl)]
public static extern int rtlsdr_read_sync(IntPtr dev, IntPtr buf, int len, out int nRead);
[DllImport("rtlsdr", CallingConvention = CallingConvention.Cdecl)]
public static extern int rtlsdr_wait_async(IntPtr dev, RtlSdrReadAsyncDelegate cb, IntPtr ctx);
[DllImport("rtlsdr", CallingConvention = CallingConvention.Cdecl)]
public static extern int rtlsdr_read_async(IntPtr dev, RtlSdrReadAsyncDelegate cb, IntPtr ctx, uint bufNum, uint bufLen);
[DllImport("rtlsdr", CallingConvention = CallingConvention.Cdecl)]
public static extern int rtlsdr_cancel_async(IntPtr dev);
}
}

View file

@ -0,0 +1,333 @@
using SDRSharp.Radio;
using System;
using System.Runtime.InteropServices;
using System.Threading;
namespace SDRSharp.RTLSDR
{
public sealed class RtlDevice : IDisposable
{
private const uint DefaultFrequency = 105500000u;
private const int DefaultSamplerate = 2048000;
private readonly uint _index;
private IntPtr _dev;
private readonly string _name;
private readonly int[] _supportedGains;
private bool _useTunerAGC = true;
private bool _useRtlAGC;
private int _tunerGain;
private uint _centerFrequency = 105500000u;
private uint _sampleRate = 2048000u;
private int _frequencyCorrection;
private SamplingMode _samplingMode;
private bool _useOffsetTuning;
private readonly bool _supportsOffsetTuning;
private GCHandle _gcHandle;
private UnsafeBuffer _iqBuffer;
private unsafe Complex* _iqPtr;
private Thread _worker;
private readonly SamplesAvailableEventArgs _eventArgs = new SamplesAvailableEventArgs();
private unsafe static readonly RtlSdrReadAsyncDelegate _rtlCallback = RtlDevice.RtlSdrSamplesAvailable; //EDITHERE
private static readonly uint _readLength = (uint)Utils.GetIntSetting("RTLBufferLength", 16384);
public uint Index => this._index;
public string Name => this._name;
public uint Samplerate
{
get
{
return this._sampleRate;
}
set
{
this._sampleRate = value;
if (this._dev != IntPtr.Zero)
{
NativeMethods.rtlsdr_set_sample_rate(this._dev, this._sampleRate);
}
}
}
public uint Frequency
{
get
{
return this._centerFrequency;
}
set
{
this._centerFrequency = value;
if (this._dev != IntPtr.Zero)
{
NativeMethods.rtlsdr_set_center_freq(this._dev, this._centerFrequency);
}
}
}
public bool UseRtlAGC
{
get
{
return this._useRtlAGC;
}
set
{
this._useRtlAGC = value;
if (this._dev != IntPtr.Zero)
{
NativeMethods.rtlsdr_set_agc_mode(this._dev, this._useRtlAGC ? 1 : 0);
}
}
}
public bool UseTunerAGC
{
get
{
return this._useTunerAGC;
}
set
{
this._useTunerAGC = value;
if (this._dev != IntPtr.Zero)
{
NativeMethods.rtlsdr_set_tuner_gain_mode(this._dev, (!this._useTunerAGC) ? 1 : 0);
}
}
}
public SamplingMode SamplingMode
{
get
{
return this._samplingMode;
}
set
{
this._samplingMode = value;
if (this._dev != IntPtr.Zero)
{
NativeMethods.rtlsdr_set_direct_sampling(this._dev, (int)this._samplingMode);
}
}
}
public bool SupportsOffsetTuning => this._supportsOffsetTuning;
public bool UseOffsetTuning
{
get
{
return this._useOffsetTuning;
}
set
{
this._useOffsetTuning = value;
if (this._dev != IntPtr.Zero)
{
NativeMethods.rtlsdr_set_offset_tuning(this._dev, this._useOffsetTuning ? 1 : 0);
}
}
}
public int[] SupportedGains => this._supportedGains;
public int Gain
{
get
{
return this._tunerGain;
}
set
{
this._tunerGain = value;
if (this._dev != IntPtr.Zero)
{
NativeMethods.rtlsdr_set_tuner_gain(this._dev, this._tunerGain);
}
}
}
public int FrequencyCorrection
{
get
{
return this._frequencyCorrection;
}
set
{
this._frequencyCorrection = value;
if (this._dev != IntPtr.Zero)
{
NativeMethods.rtlsdr_set_freq_correction(this._dev, this._frequencyCorrection);
}
}
}
public RtlSdrTunerType TunerType
{
get
{
if (!(this._dev == IntPtr.Zero))
{
return NativeMethods.rtlsdr_get_tuner_type(this._dev);
}
return RtlSdrTunerType.Unknown;
}
}
public bool IsStreaming => this._worker != null;
public event SamplesAvailableDelegate SamplesAvailable;
public RtlDevice(uint index)
{
this._index = index;
if (NativeMethods.rtlsdr_open(out this._dev, this._index) != 0)
{
throw new ApplicationException("Cannot open RTL device. Is the device locked somewhere?");
}
int num = (!(this._dev == IntPtr.Zero)) ? NativeMethods.rtlsdr_get_tuner_gains(this._dev, null) : 0;
if (num < 0)
{
num = 0;
}
this._supportsOffsetTuning = (NativeMethods.rtlsdr_set_offset_tuning(this._dev, 0) != -2);
this._supportedGains = new int[num];
if (num >= 0)
{
NativeMethods.rtlsdr_get_tuner_gains(this._dev, this._supportedGains);
}
this._name = NativeMethods.rtlsdr_get_device_name(this._index);
this._gcHandle = GCHandle.Alloc(this);
}
~RtlDevice()
{
this.Dispose();
}
public void Dispose()
{
this.Stop();
NativeMethods.rtlsdr_close(this._dev);
if (this._gcHandle.IsAllocated)
{
this._gcHandle.Free();
}
this._dev = IntPtr.Zero;
GC.SuppressFinalize(this);
}
public void Start()
{
if (this._worker != null)
{
throw new ApplicationException("Already running");
}
if (NativeMethods.rtlsdr_set_sample_rate(this._dev, this._sampleRate) != 0)
{
throw new ApplicationException("Cannot access RTL device");
}
if (NativeMethods.rtlsdr_set_center_freq(this._dev, this._centerFrequency) != 0)
{
throw new ApplicationException("Cannot access RTL device");
}
if (NativeMethods.rtlsdr_set_tuner_gain_mode(this._dev, (!this._useTunerAGC) ? 1 : 0) != 0)
{
throw new ApplicationException("Cannot access RTL device");
}
if (!this._useTunerAGC && NativeMethods.rtlsdr_set_tuner_gain(this._dev, this._tunerGain) != 0)
{
throw new ApplicationException("Cannot access RTL device");
}
if (NativeMethods.rtlsdr_reset_buffer(this._dev) != 0)
{
throw new ApplicationException("Cannot access RTL device");
}
this._worker = new Thread(this.StreamProc);
this._worker.Priority = ThreadPriority.Highest;
this._worker.Start();
}
public void Stop()
{
if (this._worker != null)
{
NativeMethods.rtlsdr_cancel_async(this._dev);
if (this._worker.ThreadState == ThreadState.Running)
{
this._worker.Join();
}
this._worker = null;
}
}
private unsafe void StreamProc()
{
NativeMethods.rtlsdr_read_async(this._dev, RtlDevice._rtlCallback, (IntPtr)this._gcHandle, 0u, RtlDevice._readLength);
}
private unsafe void ComplexSamplesAvailable(Complex* buffer, int length)
{
if (this.SamplesAvailable != null)
{
this._eventArgs.Buffer = buffer;
this._eventArgs.Length = length;
this.SamplesAvailable(this, this._eventArgs);
}
}
private unsafe static void RtlSdrSamplesAvailable(byte* buf, uint len, IntPtr ctx)
{
GCHandle gCHandle = GCHandle.FromIntPtr(ctx);
if (gCHandle.IsAllocated)
{
RtlDevice rtlDevice = (RtlDevice)gCHandle.Target;
int num = (int)len / 2;
if (rtlDevice._iqBuffer == null || rtlDevice._iqBuffer.Length != num)
{
rtlDevice._iqBuffer = UnsafeBuffer.Create(num, sizeof(Complex));
rtlDevice._iqPtr = (Complex*)(void*)rtlDevice._iqBuffer;
}
Complex* ptr = rtlDevice._iqPtr;
for (int i = 0; i < num; i++)
{
Complex* intPtr = ptr;
byte* intPtr2 = buf;
buf = intPtr2 + 1;
intPtr->Imag = (float)(*intPtr2 - 128) * 0.0078125f;
Complex* intPtr3 = ptr;
byte* intPtr4 = buf;
buf = intPtr4 + 1;
intPtr3->Real = (float)(*intPtr4 - 128) * 0.0078125f;
ptr++;
}
rtlDevice.ComplexSamplesAvailable(rtlDevice._iqPtr, rtlDevice._iqBuffer.Length);
}
}
}
}

View file

@ -0,0 +1,274 @@
namespace SDRSharp.RTLSDR
{
// Token: 0x02000003 RID: 3
public partial class RtlSdrControllerDialog : global::System.Windows.Forms.Form
{
// Token: 0x06000014 RID: 20 RVA: 0x000028C2 File Offset: 0x00000AC2
protected override void Dispose(bool disposing)
{
if (disposing && this.components != null)
{
this.components.Dispose();
}
base.Dispose(disposing);
}
// Token: 0x06000015 RID: 21 RVA: 0x000028E4 File Offset: 0x00000AE4
private void InitializeComponent()
{
this.components = new global::System.ComponentModel.Container();
this.refreshTimer = new global::System.Windows.Forms.Timer(this.components);
this.closeButton = new global::System.Windows.Forms.Button();
this.deviceComboBox = new global::System.Windows.Forms.ComboBox();
this.label1 = new global::System.Windows.Forms.Label();
this.tunerGainTrackBar = new global::System.Windows.Forms.TrackBar();
this.label2 = new global::System.Windows.Forms.Label();
this.label3 = new global::System.Windows.Forms.Label();
this.samplerateComboBox = new global::System.Windows.Forms.ComboBox();
this.tunerAgcCheckBox = new global::System.Windows.Forms.CheckBox();
this.gainLabel = new global::System.Windows.Forms.Label();
this.frequencyCorrectionNumericUpDown = new global::System.Windows.Forms.NumericUpDown();
this.label4 = new global::System.Windows.Forms.Label();
this.tunerTypeLabel = new global::System.Windows.Forms.Label();
this.rtlAgcCheckBox = new global::System.Windows.Forms.CheckBox();
this.label5 = new global::System.Windows.Forms.Label();
this.samplingModeComboBox = new global::System.Windows.Forms.ComboBox();
this.offsetTuningCheckBox = new global::System.Windows.Forms.CheckBox();
((global::System.ComponentModel.ISupportInitialize)this.tunerGainTrackBar).BeginInit();
((global::System.ComponentModel.ISupportInitialize)this.frequencyCorrectionNumericUpDown).BeginInit();
base.SuspendLayout();
this.refreshTimer.Interval = 1000;
this.refreshTimer.Tick += new global::System.EventHandler(this.refreshTimer_Tick);
this.closeButton.DialogResult = global::System.Windows.Forms.DialogResult.Cancel;
this.closeButton.Location = new global::System.Drawing.Point(184, 306);
this.closeButton.Name = "closeButton";
this.closeButton.Size = new global::System.Drawing.Size(75, 23);
this.closeButton.TabIndex = 8;
this.closeButton.Text = "Close";
this.closeButton.UseVisualStyleBackColor = true;
this.closeButton.Click += new global::System.EventHandler(this.closeButton_Click);
this.deviceComboBox.DropDownStyle = global::System.Windows.Forms.ComboBoxStyle.DropDownList;
this.deviceComboBox.FormattingEnabled = true;
this.deviceComboBox.Location = new global::System.Drawing.Point(12, 26);
this.deviceComboBox.Name = "deviceComboBox";
this.deviceComboBox.Size = new global::System.Drawing.Size(247, 21);
this.deviceComboBox.TabIndex = 0;
this.deviceComboBox.SelectedIndexChanged += new global::System.EventHandler(this.deviceComboBox_SelectedIndexChanged);
this.label1.AutoSize = true;
this.label1.Location = new global::System.Drawing.Point(12, 9);
this.label1.Name = "label1";
this.label1.Size = new global::System.Drawing.Size(41, 13);
this.label1.TabIndex = 20;
this.label1.Text = "Device";
this.tunerGainTrackBar.Enabled = false;
this.tunerGainTrackBar.Location = new global::System.Drawing.Point(3, 229);
this.tunerGainTrackBar.Maximum = 10000;
this.tunerGainTrackBar.Name = "tunerGainTrackBar";
this.tunerGainTrackBar.Size = new global::System.Drawing.Size(267, 45);
this.tunerGainTrackBar.TabIndex = 6;
this.tunerGainTrackBar.Scroll += new global::System.EventHandler(this.tunerGainTrackBar_Scroll);
this.label2.AutoSize = true;
this.label2.Location = new global::System.Drawing.Point(12, 213);
this.label2.Name = "label2";
this.label2.Size = new global::System.Drawing.Size(46, 13);
this.label2.TabIndex = 22;
this.label2.Text = "RF Gain";
this.label3.AutoSize = true;
this.label3.Location = new global::System.Drawing.Point(12, 53);
this.label3.Name = "label3";
this.label3.Size = new global::System.Drawing.Size(68, 13);
this.label3.TabIndex = 24;
this.label3.Text = "Sample Rate";
this.samplerateComboBox.DropDownStyle = global::System.Windows.Forms.ComboBoxStyle.DropDownList;
this.samplerateComboBox.FormattingEnabled = true;
this.samplerateComboBox.Items.AddRange(new object[]
{
"3.2 MSPS",
"2.8 MSPS",
"2.4 MSPS",
"2.048 MSPS",
"1.92 MSPS",
"1.8 MSPS",
"1.4 MSPS",
"1.024 MSPS",
"0.900001 MSPS",
"0.25 MSPS"
});
this.samplerateComboBox.Location = new global::System.Drawing.Point(12, 70);
this.samplerateComboBox.Name = "samplerateComboBox";
this.samplerateComboBox.Size = new global::System.Drawing.Size(247, 21);
this.samplerateComboBox.TabIndex = 1;
this.samplerateComboBox.SelectedIndexChanged += new global::System.EventHandler(this.samplerateComboBox_SelectedIndexChanged);
this.tunerAgcCheckBox.AutoSize = true;
this.tunerAgcCheckBox.Checked = true;
this.tunerAgcCheckBox.CheckState = global::System.Windows.Forms.CheckState.Checked;
this.tunerAgcCheckBox.Location = new global::System.Drawing.Point(12, 193);
this.tunerAgcCheckBox.Name = "tunerAgcCheckBox";
this.tunerAgcCheckBox.Size = new global::System.Drawing.Size(79, 17);
this.tunerAgcCheckBox.TabIndex = 5;
this.tunerAgcCheckBox.Text = "Tuner AGC";
this.tunerAgcCheckBox.UseVisualStyleBackColor = true;
this.tunerAgcCheckBox.CheckedChanged += new global::System.EventHandler(this.tunerAgcCheckBox_CheckedChanged);
this.gainLabel.Location = new global::System.Drawing.Point(191, 213);
this.gainLabel.Name = "gainLabel";
this.gainLabel.Size = new global::System.Drawing.Size(68, 13);
this.gainLabel.TabIndex = 26;
this.gainLabel.Text = "1000dB";
this.gainLabel.TextAlign = global::System.Drawing.ContentAlignment.MiddleRight;
this.gainLabel.Visible = false;
this.frequencyCorrectionNumericUpDown.Location = new global::System.Drawing.Point(169, 275);
global::System.Windows.Forms.NumericUpDown numericUpDown = this.frequencyCorrectionNumericUpDown;
int[] array = new int[4];
array[0] = 1000;
numericUpDown.Maximum = new decimal(array);
this.frequencyCorrectionNumericUpDown.Minimum = new decimal(new int[]
{
1000,
0,
0,
int.MinValue
});
this.frequencyCorrectionNumericUpDown.Name = "frequencyCorrectionNumericUpDown";
this.frequencyCorrectionNumericUpDown.Size = new global::System.Drawing.Size(90, 20);
this.frequencyCorrectionNumericUpDown.TabIndex = 7;
this.frequencyCorrectionNumericUpDown.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Right;
this.frequencyCorrectionNumericUpDown.ValueChanged += new global::System.EventHandler(this.frequencyCorrectionNumericUpDown_ValueChanged);
this.label4.AutoSize = true;
this.label4.Location = new global::System.Drawing.Point(12, 277);
this.label4.Name = "label4";
this.label4.Size = new global::System.Drawing.Size(136, 13);
this.label4.TabIndex = 28;
this.label4.Text = "Frequency correction (ppm)";
this.tunerTypeLabel.Location = new global::System.Drawing.Point(166, 9);
this.tunerTypeLabel.Name = "tunerTypeLabel";
this.tunerTypeLabel.Size = new global::System.Drawing.Size(93, 13);
this.tunerTypeLabel.TabIndex = 29;
this.tunerTypeLabel.Text = "E4000";
this.tunerTypeLabel.TextAlign = global::System.Drawing.ContentAlignment.MiddleRight;
this.rtlAgcCheckBox.AutoSize = true;
this.rtlAgcCheckBox.Location = new global::System.Drawing.Point(12, 170);
this.rtlAgcCheckBox.Name = "rtlAgcCheckBox";
this.rtlAgcCheckBox.Size = new global::System.Drawing.Size(72, 17);
this.rtlAgcCheckBox.TabIndex = 4;
this.rtlAgcCheckBox.Text = "RTL AGC";
this.rtlAgcCheckBox.UseVisualStyleBackColor = true;
this.rtlAgcCheckBox.CheckedChanged += new global::System.EventHandler(this.rtlAgcCheckBox_CheckedChanged);
this.label5.AutoSize = true;
this.label5.Location = new global::System.Drawing.Point(12, 97);
this.label5.Name = "label5";
this.label5.Size = new global::System.Drawing.Size(80, 13);
this.label5.TabIndex = 31;
this.label5.Text = "Sampling Mode";
this.samplingModeComboBox.DropDownStyle = global::System.Windows.Forms.ComboBoxStyle.DropDownList;
this.samplingModeComboBox.FormattingEnabled = true;
this.samplingModeComboBox.Items.AddRange(new object[]
{
"Quadrature sampling",
"Direct sampling (I branch)",
"Direct sampling (Q branch)"
});
this.samplingModeComboBox.Location = new global::System.Drawing.Point(12, 114);
this.samplingModeComboBox.Name = "samplingModeComboBox";
this.samplingModeComboBox.Size = new global::System.Drawing.Size(247, 21);
this.samplingModeComboBox.TabIndex = 2;
this.samplingModeComboBox.SelectedIndexChanged += new global::System.EventHandler(this.samplingModeComboBox_SelectedIndexChanged);
this.offsetTuningCheckBox.AutoSize = true;
this.offsetTuningCheckBox.Location = new global::System.Drawing.Point(12, 147);
this.offsetTuningCheckBox.Name = "offsetTuningCheckBox";
this.offsetTuningCheckBox.Size = new global::System.Drawing.Size(90, 17);
this.offsetTuningCheckBox.TabIndex = 3;
this.offsetTuningCheckBox.Text = "Offset Tuning";
this.offsetTuningCheckBox.UseVisualStyleBackColor = true;
this.offsetTuningCheckBox.CheckedChanged += new global::System.EventHandler(this.offsetTuningCheckBox_CheckedChanged);
base.AutoScaleDimensions = new global::System.Drawing.SizeF(6f, 13f);
base.AutoScaleMode = global::System.Windows.Forms.AutoScaleMode.Font;
base.CancelButton = this.closeButton;
base.ClientSize = new global::System.Drawing.Size(271, 342);
base.Controls.Add(this.offsetTuningCheckBox);
base.Controls.Add(this.label5);
base.Controls.Add(this.samplingModeComboBox);
base.Controls.Add(this.rtlAgcCheckBox);
base.Controls.Add(this.tunerTypeLabel);
base.Controls.Add(this.label4);
base.Controls.Add(this.frequencyCorrectionNumericUpDown);
base.Controls.Add(this.gainLabel);
base.Controls.Add(this.tunerAgcCheckBox);
base.Controls.Add(this.label3);
base.Controls.Add(this.samplerateComboBox);
base.Controls.Add(this.label2);
base.Controls.Add(this.tunerGainTrackBar);
base.Controls.Add(this.label1);
base.Controls.Add(this.deviceComboBox);
base.Controls.Add(this.closeButton);
base.FormBorderStyle = global::System.Windows.Forms.FormBorderStyle.FixedDialog;
base.MaximizeBox = false;
base.MinimizeBox = false;
base.Name = "RtlSdrControllerDialog";
base.ShowIcon = false;
base.ShowInTaskbar = false;
base.StartPosition = global::System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "RTL-SDR Controller";
base.TopMost = true;
base.FormClosing += new global::System.Windows.Forms.FormClosingEventHandler(this.RtlSdrControllerDialog_FormClosing);
base.VisibleChanged += new global::System.EventHandler(this.RtlSdrControllerDialog_VisibleChanged);
((global::System.ComponentModel.ISupportInitialize)this.tunerGainTrackBar).EndInit();
((global::System.ComponentModel.ISupportInitialize)this.frequencyCorrectionNumericUpDown).EndInit();
base.ResumeLayout(false);
base.PerformLayout();
}
// Token: 0x04000005 RID: 5
private global::System.ComponentModel.IContainer components;
// Token: 0x04000006 RID: 6
private global::System.Windows.Forms.Timer refreshTimer;
// Token: 0x04000007 RID: 7
private global::System.Windows.Forms.Button closeButton;
// Token: 0x04000008 RID: 8
private global::System.Windows.Forms.ComboBox deviceComboBox;
// Token: 0x04000009 RID: 9
private global::System.Windows.Forms.Label label1;
// Token: 0x0400000A RID: 10
private global::System.Windows.Forms.TrackBar tunerGainTrackBar;
// Token: 0x0400000B RID: 11
private global::System.Windows.Forms.Label label2;
// Token: 0x0400000C RID: 12
private global::System.Windows.Forms.Label label3;
// Token: 0x0400000D RID: 13
private global::System.Windows.Forms.ComboBox samplerateComboBox;
// Token: 0x0400000E RID: 14
private global::System.Windows.Forms.CheckBox tunerAgcCheckBox;
// Token: 0x0400000F RID: 15
private global::System.Windows.Forms.Label gainLabel;
// Token: 0x04000010 RID: 16
private global::System.Windows.Forms.NumericUpDown frequencyCorrectionNumericUpDown;
// Token: 0x04000011 RID: 17
private global::System.Windows.Forms.Label label4;
// Token: 0x04000012 RID: 18
private global::System.Windows.Forms.Label tunerTypeLabel;
// Token: 0x04000013 RID: 19
private global::System.Windows.Forms.CheckBox rtlAgcCheckBox;
// Token: 0x04000014 RID: 20
private global::System.Windows.Forms.Label label5;
// Token: 0x04000015 RID: 21
private global::System.Windows.Forms.ComboBox samplingModeComboBox;
// Token: 0x04000016 RID: 22
private global::System.Windows.Forms.CheckBox offsetTuningCheckBox;
}
}

View file

@ -0,0 +1,482 @@
using SDRSharp.Radio;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Globalization;
using System.Windows.Forms;
namespace SDRSharp.RTLSDR
{
public class RtlSdrControllerDialog : Form
{
private readonly RtlSdrIO _owner;
private bool _initialized;
private IContainer components;
private Timer refreshTimer;
private Button closeButton;
private ComboBox deviceComboBox;
private Label label1;
private TrackBar tunerGainTrackBar;
private Label label2;
private Label label3;
private ComboBox samplerateComboBox;
private CheckBox tunerAgcCheckBox;
private Label gainLabel;
private NumericUpDown frequencyCorrectionNumericUpDown;
private Label label4;
private Label tunerTypeLabel;
private CheckBox rtlAgcCheckBox;
private Label label5;
private ComboBox samplingModeComboBox;
private CheckBox offsetTuningCheckBox;
public RtlSdrControllerDialog(RtlSdrIO owner)
{
this.InitializeComponent();
this._owner = owner;
DeviceDisplay[] activeDevices = DeviceDisplay.GetActiveDevices();
this.deviceComboBox.Items.Clear();
this.deviceComboBox.Items.AddRange(activeDevices);
this.frequencyCorrectionNumericUpDown.Value = Utils.GetIntSetting("RTLFrequencyCorrection", 0);
this.samplerateComboBox.SelectedIndex = Utils.GetIntSetting("RTLSampleRate", 3);
this.samplingModeComboBox.SelectedIndex = Utils.GetIntSetting("RTLSamplingMode", 0);
this.offsetTuningCheckBox.Checked = Utils.GetBooleanSetting("RTLOffsetTuning");
this.rtlAgcCheckBox.Checked = Utils.GetBooleanSetting("RTLChipAgc");
this.tunerAgcCheckBox.Checked = Utils.GetBooleanSetting("RTLTunerAgc");
this.tunerGainTrackBar.Value = Utils.GetIntSetting("RTLTunerGain", 0);
this.tunerAgcCheckBox.Enabled = (this.samplingModeComboBox.SelectedIndex == 0);
this.gainLabel.Visible = (this.tunerAgcCheckBox.Enabled && !this.tunerAgcCheckBox.Checked);
this.tunerGainTrackBar.Enabled = (this.tunerAgcCheckBox.Enabled && !this.tunerAgcCheckBox.Checked);
this.offsetTuningCheckBox.Enabled = (this.samplingModeComboBox.SelectedIndex == 0);
this._initialized = true;
}
private void closeButton_Click(object sender, EventArgs e)
{
base.Close();
}
private void RtlSdrControllerDialog_FormClosing(object sender, FormClosingEventArgs e)
{
e.Cancel = true;
base.Hide();
}
private void RtlSdrControllerDialog_VisibleChanged(object sender, EventArgs e)
{
this.refreshTimer.Enabled = base.Visible;
if (base.Visible)
{
this.samplerateComboBox.Enabled = !this._owner.Device.IsStreaming;
this.deviceComboBox.Enabled = !this._owner.Device.IsStreaming;
this.samplingModeComboBox.Enabled = !this._owner.Device.IsStreaming;
if (!this._owner.Device.IsStreaming)
{
DeviceDisplay[] activeDevices = DeviceDisplay.GetActiveDevices();
this.deviceComboBox.Items.Clear();
this.deviceComboBox.Items.AddRange(activeDevices);
int num = 0;
while (true)
{
if (num < activeDevices.Length)
{
if (activeDevices[num].Index != ((DeviceDisplay)this.deviceComboBox.Items[num]).Index)
{
num++;
continue;
}
break;
}
return;
}
this._initialized = false;
this.deviceComboBox.SelectedIndex = num;
this._initialized = true;
}
}
}
private void refreshTimer_Tick(object sender, EventArgs e)
{
this.samplerateComboBox.Enabled = !this._owner.Device.IsStreaming;
this.deviceComboBox.Enabled = !this._owner.Device.IsStreaming;
this.samplingModeComboBox.Enabled = !this._owner.Device.IsStreaming;
}
private void deviceComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (this._initialized)
{
DeviceDisplay deviceDisplay = (DeviceDisplay)this.deviceComboBox.SelectedItem;
if (deviceDisplay != null)
{
try
{
this._owner.SelectDevice(deviceDisplay.Index);
}
catch (Exception ex)
{
this.deviceComboBox.SelectedIndex = -1;
MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
}
}
}
}
private void tunerGainTrackBar_Scroll(object sender, EventArgs e)
{
if (this._initialized)
{
int num = this._owner.Device.SupportedGains[this.tunerGainTrackBar.Value];
this._owner.Device.Gain = num;
this.gainLabel.Text = (double)num / 10.0 + " dB";
Utils.SaveSetting("RTLTunerGain", this.tunerGainTrackBar.Value);
}
}
private void samplerateComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (this._initialized)
{
string s = this.samplerateComboBox.Items[this.samplerateComboBox.SelectedIndex].ToString().Split(' ')[0];
double num = double.Parse(s, CultureInfo.InvariantCulture);
this._owner.Device.Samplerate = (uint)(num * 1000000.0);
Utils.SaveSetting("RTLSampleRate", this.samplerateComboBox.SelectedIndex);
}
}
private void tunerAgcCheckBox_CheckedChanged(object sender, EventArgs e)
{
if (this._initialized)
{
this.tunerGainTrackBar.Enabled = (this.tunerAgcCheckBox.Enabled && !this.tunerAgcCheckBox.Checked);
this._owner.Device.UseTunerAGC = this.tunerAgcCheckBox.Checked;
this.gainLabel.Visible = (this.tunerAgcCheckBox.Enabled && !this.tunerAgcCheckBox.Checked);
if (!this.tunerAgcCheckBox.Checked)
{
this.tunerGainTrackBar_Scroll(null, null);
}
Utils.SaveSetting("RTLTunerAgc", this.tunerAgcCheckBox.Checked);
}
}
private void frequencyCorrectionNumericUpDown_ValueChanged(object sender, EventArgs e)
{
if (this._initialized)
{
this._owner.Device.FrequencyCorrection = (int)this.frequencyCorrectionNumericUpDown.Value;
Utils.SaveSetting("RTLFrequencyCorrection", this.frequencyCorrectionNumericUpDown.Value.ToString());
}
}
private void rtlAgcCheckBox_CheckedChanged(object sender, EventArgs e)
{
if (this._initialized)
{
this._owner.Device.UseRtlAGC = this.rtlAgcCheckBox.Checked;
Utils.SaveSetting("RTLChipAgc", this.rtlAgcCheckBox.Checked);
}
}
private void samplingModeComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (this._initialized)
{
this.tunerAgcCheckBox.Enabled = (this.samplingModeComboBox.SelectedIndex == 0);
this.gainLabel.Visible = (this.tunerAgcCheckBox.Enabled && !this.tunerAgcCheckBox.Checked);
this.tunerGainTrackBar.Enabled = (this.tunerAgcCheckBox.Enabled && !this.tunerAgcCheckBox.Checked);
this.offsetTuningCheckBox.Enabled = (this.samplingModeComboBox.SelectedIndex == 0);
if (this.samplingModeComboBox.SelectedIndex == 0)
{
this.offsetTuningCheckBox_CheckedChanged(null, null);
}
else
{
this._owner.Device.UseOffsetTuning = false;
}
this._owner.Device.SamplingMode = (SamplingMode)this.samplingModeComboBox.SelectedIndex;
Utils.SaveSetting("RTLSamplingMode", this.samplingModeComboBox.SelectedIndex);
}
}
private void offsetTuningCheckBox_CheckedChanged(object sender, EventArgs e)
{
if (this._initialized)
{
this._owner.Device.UseOffsetTuning = this.offsetTuningCheckBox.Checked;
Utils.SaveSetting("RTLOffsetTuning", this.offsetTuningCheckBox.Checked);
}
}
public void ConfigureGUI()
{
this.tunerTypeLabel.Text = this._owner.Device.TunerType.ToString();
this.tunerGainTrackBar.Maximum = this._owner.Device.SupportedGains.Length - 1;
this.offsetTuningCheckBox.Enabled = this._owner.Device.SupportsOffsetTuning;
int num = 0;
while (true)
{
if (num < this.deviceComboBox.Items.Count)
{
DeviceDisplay deviceDisplay = (DeviceDisplay)this.deviceComboBox.Items[num];
if (deviceDisplay.Index != this._owner.Device.Index)
{
num++;
continue;
}
break;
}
return;
}
this.deviceComboBox.SelectedIndex = num;
}
public void ConfigureDevice()
{
this.samplerateComboBox_SelectedIndexChanged(null, null);
this.samplingModeComboBox_SelectedIndexChanged(null, null);
this.offsetTuningCheckBox_CheckedChanged(null, null);
this.frequencyCorrectionNumericUpDown_ValueChanged(null, null);
this.rtlAgcCheckBox_CheckedChanged(null, null);
this.tunerAgcCheckBox_CheckedChanged(null, null);
if (!this.tunerAgcCheckBox.Checked)
{
this.tunerGainTrackBar_Scroll(null, null);
}
}
protected override void Dispose(bool disposing)
{
if (disposing && this.components != null)
{
this.components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.components = new Container();
this.refreshTimer = new Timer(this.components);
this.closeButton = new Button();
this.deviceComboBox = new ComboBox();
this.label1 = new Label();
this.tunerGainTrackBar = new TrackBar();
this.label2 = new Label();
this.label3 = new Label();
this.samplerateComboBox = new ComboBox();
this.tunerAgcCheckBox = new CheckBox();
this.gainLabel = new Label();
this.frequencyCorrectionNumericUpDown = new NumericUpDown();
this.label4 = new Label();
this.tunerTypeLabel = new Label();
this.rtlAgcCheckBox = new CheckBox();
this.label5 = new Label();
this.samplingModeComboBox = new ComboBox();
this.offsetTuningCheckBox = new CheckBox();
((ISupportInitialize)this.tunerGainTrackBar).BeginInit();
((ISupportInitialize)this.frequencyCorrectionNumericUpDown).BeginInit();
base.SuspendLayout();
this.refreshTimer.Interval = 1000;
this.refreshTimer.Tick += this.refreshTimer_Tick;
this.closeButton.DialogResult = DialogResult.Cancel;
this.closeButton.Location = new Point(184, 306);
this.closeButton.Name = "closeButton";
this.closeButton.Size = new Size(75, 23);
this.closeButton.TabIndex = 8;
this.closeButton.Text = "Close";
this.closeButton.UseVisualStyleBackColor = true;
this.closeButton.Click += this.closeButton_Click;
this.deviceComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
this.deviceComboBox.FormattingEnabled = true;
this.deviceComboBox.Location = new Point(12, 26);
this.deviceComboBox.Name = "deviceComboBox";
this.deviceComboBox.Size = new Size(247, 21);
this.deviceComboBox.TabIndex = 0;
this.deviceComboBox.SelectedIndexChanged += this.deviceComboBox_SelectedIndexChanged;
this.label1.AutoSize = true;
this.label1.Location = new Point(12, 9);
this.label1.Name = "label1";
this.label1.Size = new Size(41, 13);
this.label1.TabIndex = 20;
this.label1.Text = "Device";
this.tunerGainTrackBar.Enabled = false;
this.tunerGainTrackBar.Location = new Point(3, 229);
this.tunerGainTrackBar.Maximum = 10000;
this.tunerGainTrackBar.Name = "tunerGainTrackBar";
this.tunerGainTrackBar.Size = new Size(267, 45);
this.tunerGainTrackBar.TabIndex = 6;
this.tunerGainTrackBar.Scroll += this.tunerGainTrackBar_Scroll;
this.label2.AutoSize = true;
this.label2.Location = new Point(12, 213);
this.label2.Name = "label2";
this.label2.Size = new Size(46, 13);
this.label2.TabIndex = 22;
this.label2.Text = "RF Gain";
this.label3.AutoSize = true;
this.label3.Location = new Point(12, 53);
this.label3.Name = "label3";
this.label3.Size = new Size(68, 13);
this.label3.TabIndex = 24;
this.label3.Text = "Sample Rate";
this.samplerateComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
this.samplerateComboBox.FormattingEnabled = true;
this.samplerateComboBox.Items.AddRange(new object[10]
{
"3.2 MSPS",
"2.8 MSPS",
"2.4 MSPS",
"2.048 MSPS",
"1.92 MSPS",
"1.8 MSPS",
"1.4 MSPS",
"1.024 MSPS",
"0.900001 MSPS",
"0.25 MSPS"
});
this.samplerateComboBox.Location = new Point(12, 70);
this.samplerateComboBox.Name = "samplerateComboBox";
this.samplerateComboBox.Size = new Size(247, 21);
this.samplerateComboBox.TabIndex = 1;
this.samplerateComboBox.SelectedIndexChanged += this.samplerateComboBox_SelectedIndexChanged;
this.tunerAgcCheckBox.AutoSize = true;
this.tunerAgcCheckBox.Checked = true;
this.tunerAgcCheckBox.CheckState = CheckState.Checked;
this.tunerAgcCheckBox.Location = new Point(12, 193);
this.tunerAgcCheckBox.Name = "tunerAgcCheckBox";
this.tunerAgcCheckBox.Size = new Size(79, 17);
this.tunerAgcCheckBox.TabIndex = 5;
this.tunerAgcCheckBox.Text = "Tuner AGC";
this.tunerAgcCheckBox.UseVisualStyleBackColor = true;
this.tunerAgcCheckBox.CheckedChanged += this.tunerAgcCheckBox_CheckedChanged;
this.gainLabel.Location = new Point(191, 213);
this.gainLabel.Name = "gainLabel";
this.gainLabel.Size = new Size(68, 13);
this.gainLabel.TabIndex = 26;
this.gainLabel.Text = "1000dB";
this.gainLabel.TextAlign = ContentAlignment.MiddleRight;
this.gainLabel.Visible = false;
this.frequencyCorrectionNumericUpDown.Location = new Point(169, 275);
this.frequencyCorrectionNumericUpDown.Maximum = new decimal(new int[4]
{
1000,
0,
0,
0
});
this.frequencyCorrectionNumericUpDown.Minimum = new decimal(new int[4]
{
1000,
0,
0,
-2147483648
});
this.frequencyCorrectionNumericUpDown.Name = "frequencyCorrectionNumericUpDown";
this.frequencyCorrectionNumericUpDown.Size = new Size(90, 20);
this.frequencyCorrectionNumericUpDown.TabIndex = 7;
this.frequencyCorrectionNumericUpDown.TextAlign = HorizontalAlignment.Right;
this.frequencyCorrectionNumericUpDown.ValueChanged += this.frequencyCorrectionNumericUpDown_ValueChanged;
this.label4.AutoSize = true;
this.label4.Location = new Point(12, 277);
this.label4.Name = "label4";
this.label4.Size = new Size(136, 13);
this.label4.TabIndex = 28;
this.label4.Text = "Frequency correction (ppm)";
this.tunerTypeLabel.Location = new Point(166, 9);
this.tunerTypeLabel.Name = "tunerTypeLabel";
this.tunerTypeLabel.Size = new Size(93, 13);
this.tunerTypeLabel.TabIndex = 29;
this.tunerTypeLabel.Text = "E4000";
this.tunerTypeLabel.TextAlign = ContentAlignment.MiddleRight;
this.rtlAgcCheckBox.AutoSize = true;
this.rtlAgcCheckBox.Location = new Point(12, 170);
this.rtlAgcCheckBox.Name = "rtlAgcCheckBox";
this.rtlAgcCheckBox.Size = new Size(72, 17);
this.rtlAgcCheckBox.TabIndex = 4;
this.rtlAgcCheckBox.Text = "RTL AGC";
this.rtlAgcCheckBox.UseVisualStyleBackColor = true;
this.rtlAgcCheckBox.CheckedChanged += this.rtlAgcCheckBox_CheckedChanged;
this.label5.AutoSize = true;
this.label5.Location = new Point(12, 97);
this.label5.Name = "label5";
this.label5.Size = new Size(80, 13);
this.label5.TabIndex = 31;
this.label5.Text = "Sampling Mode";
this.samplingModeComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
this.samplingModeComboBox.FormattingEnabled = true;
this.samplingModeComboBox.Items.AddRange(new object[3]
{
"Quadrature sampling",
"Direct sampling (I branch)",
"Direct sampling (Q branch)"
});
this.samplingModeComboBox.Location = new Point(12, 114);
this.samplingModeComboBox.Name = "samplingModeComboBox";
this.samplingModeComboBox.Size = new Size(247, 21);
this.samplingModeComboBox.TabIndex = 2;
this.samplingModeComboBox.SelectedIndexChanged += this.samplingModeComboBox_SelectedIndexChanged;
this.offsetTuningCheckBox.AutoSize = true;
this.offsetTuningCheckBox.Location = new Point(12, 147);
this.offsetTuningCheckBox.Name = "offsetTuningCheckBox";
this.offsetTuningCheckBox.Size = new Size(90, 17);
this.offsetTuningCheckBox.TabIndex = 3;
this.offsetTuningCheckBox.Text = "Offset Tuning";
this.offsetTuningCheckBox.UseVisualStyleBackColor = true;
this.offsetTuningCheckBox.CheckedChanged += this.offsetTuningCheckBox_CheckedChanged;
base.AutoScaleDimensions = new SizeF(6f, 13f);
base.AutoScaleMode = AutoScaleMode.Font;
base.CancelButton = this.closeButton;
base.ClientSize = new Size(271, 342);
base.Controls.Add(this.offsetTuningCheckBox);
base.Controls.Add(this.label5);
base.Controls.Add(this.samplingModeComboBox);
base.Controls.Add(this.rtlAgcCheckBox);
base.Controls.Add(this.tunerTypeLabel);
base.Controls.Add(this.label4);
base.Controls.Add(this.frequencyCorrectionNumericUpDown);
base.Controls.Add(this.gainLabel);
base.Controls.Add(this.tunerAgcCheckBox);
base.Controls.Add(this.label3);
base.Controls.Add(this.samplerateComboBox);
base.Controls.Add(this.label2);
base.Controls.Add(this.tunerGainTrackBar);
base.Controls.Add(this.label1);
base.Controls.Add(this.deviceComboBox);
base.Controls.Add(this.closeButton);
base.FormBorderStyle = FormBorderStyle.FixedDialog;
base.MaximizeBox = false;
base.MinimizeBox = false;
base.Name = "RtlSdrControllerDialog";
base.ShowIcon = false;
base.ShowInTaskbar = false;
base.StartPosition = FormStartPosition.CenterParent;
this.Text = "RTL-SDR Controller";
base.TopMost = true;
base.FormClosing += this.RtlSdrControllerDialog_FormClosing;
base.VisibleChanged += this.RtlSdrControllerDialog_VisibleChanged;
((ISupportInitialize)this.tunerGainTrackBar).EndInit();
((ISupportInitialize)this.frequencyCorrectionNumericUpDown).EndInit();
base.ResumeLayout(false);
base.PerformLayout();
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,154 @@
using SDRSharp.Radio;
using System;
using System.Windows.Forms;
namespace SDRSharp.RTLSDR
{
public class RtlSdrIO : IFrontendController, IDisposable
{
private readonly RtlSdrControllerDialog _gui;
private RtlDevice _rtlDevice;
private uint _frequency = 105500000u;
private SDRSharp.Radio.SamplesAvailableDelegate _callback;
public RtlDevice Device => this._rtlDevice;
public bool IsSoundCardBased => false;
public string SoundCardHint => string.Empty;
public double Samplerate
{
get
{
if (this._rtlDevice != null)
{
return (double)this._rtlDevice.Samplerate;
}
return 0.0;
}
}
public long Frequency
{
get
{
return this._frequency;
}
set
{
this._frequency = (uint)value;
if (this._rtlDevice != null)
{
this._rtlDevice.Frequency = this._frequency;
}
}
}
public RtlSdrIO()
{
this._gui = new RtlSdrControllerDialog(this);
}
~RtlSdrIO()
{
this.Dispose();
}
public void Dispose()
{
if (this._gui != null)
{
this._gui.Dispose();
}
GC.SuppressFinalize(this);
}
public void SelectDevice(uint index)
{
this.Close();
this._rtlDevice = new RtlDevice(index);
this._rtlDevice.SamplesAvailable += this.rtlDevice_SamplesAvailable;
this._rtlDevice.Frequency = this._frequency;
this._gui.ConfigureGUI();
this._gui.ConfigureDevice();
}
public void Open()
{
DeviceDisplay[] activeDevices = DeviceDisplay.GetActiveDevices();
DeviceDisplay[] array = activeDevices;
foreach (DeviceDisplay deviceDisplay in array)
{
try
{
this.SelectDevice(deviceDisplay.Index);
return;
}
catch (ApplicationException)
{
}
}
if (activeDevices.Length > 0)
{
throw new ApplicationException(activeDevices.Length + " compatible devices have been found but are all busy");
}
throw new ApplicationException("No compatible devices found");
}
public void Close()
{
if (this._rtlDevice != null)
{
this._rtlDevice.Stop();
this._rtlDevice.SamplesAvailable -= this.rtlDevice_SamplesAvailable;
this._rtlDevice.Dispose();
this._rtlDevice = null;
}
}
public unsafe void Start(SDRSharp.Radio.SamplesAvailableDelegate callback)
{
if (this._rtlDevice == null)
{
throw new ApplicationException("No device selected");
}
this._callback = callback;
try
{
this._rtlDevice.Start();
}
catch
{
this.Open();
this._rtlDevice.Start();
}
}
public void Stop()
{
if (this._rtlDevice != null)
{
this._rtlDevice.Stop();
}
}
public void ShowSettingGUI(IWin32Window parent)
{
this._gui.Show();
}
public void HideSettingGUI()
{
this._gui.Hide();
}
private unsafe void rtlDevice_SamplesAvailable(object sender, SamplesAvailableEventArgs e)
{
this._callback(this, e.Buffer, e.Length);
}
}
}

View file

@ -0,0 +1,8 @@
using System;
using System.Runtime.InteropServices;
namespace SDRSharp.RTLSDR
{
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public unsafe delegate void RtlSdrReadAsyncDelegate(byte* buf, uint len, IntPtr ctx);
}

View file

@ -0,0 +1,12 @@
namespace SDRSharp.RTLSDR
{
public enum RtlSdrTunerType
{
Unknown,
E4000,
FC0012,
FC0013,
FC2580,
R820T
}
}

View file

@ -0,0 +1,4 @@
namespace SDRSharp.RTLSDR
{
public delegate void SamplesAvailableDelegate(object sender, SamplesAvailableEventArgs e);
}

View file

@ -0,0 +1,20 @@
using SDRSharp.Radio;
using System;
namespace SDRSharp.RTLSDR
{
public sealed class SamplesAvailableEventArgs : EventArgs
{
public int Length
{
get;
set;
}
public unsafe Complex* Buffer
{
get;
set;
}
}
}

View file

@ -0,0 +1,9 @@
namespace SDRSharp.RTLSDR
{
public enum SamplingMode
{
Quadrature,
DirectSamplingI,
DirectSamplingQ
}
}

View file

@ -0,0 +1,14 @@
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security.Permissions;
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyProduct("SDR#")]
[assembly: CompilationRelaxations(8)]
[assembly: AssemblyCopyright("Copyright © Youssef TOUIL 2012")]
[assembly: AssemblyTitle("RTL-SDR Controller")]
[assembly: AssemblyDescription("USB interface for RTL2832U based DVB-T dongles")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]

View file

@ -0,0 +1,38 @@
namespace SDRSharp.RTLSDR
{
public class DeviceDisplay
{
public uint Index
{
get;
private set;
}
public string Name
{
get;
set;
}
public static DeviceDisplay[] GetActiveDevices()
{
uint num = NativeMethods.rtlsdr_get_device_count();
DeviceDisplay[] array = new DeviceDisplay[num];
for (uint num2 = 0u; num2 < num; num2++)
{
string name = NativeMethods.rtlsdr_get_device_name(num2);
array[num2] = new DeviceDisplay
{
Index = num2,
Name = name
};
}
return array;
}
public override string ToString()
{
return this.Name;
}
}
}

Some files were not shown because too many files have changed in this diff Show more