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

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);
}
}
}