
7 changed files with 665 additions and 3 deletions
-
2XCoder/FrmMDI.cs
-
10XCoder/XCoder.csproj
-
177XCoder/XNet/FrmModbusSlave.cs
-
329XCoder/XNet/FrmModbusSlave.designer.cs
-
129XCoder/XNet/FrmModbusSlave.resx
-
15XCoder/XNet/RegisterUnit.cs
-
6XCoderWpf/XCoderWpf.csproj
@ -0,0 +1,177 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel; |
||||
|
using System.Windows.Forms; |
||||
|
using NewLife; |
||||
|
using NewLife.Log; |
||||
|
using NewLife.Net; |
||||
|
using NewLife.Security; |
||||
|
using NewLife.Threading; |
||||
|
using XCoder; |
||||
|
using XCoder.Common; |
||||
|
using XCoder.XNet; |
||||
|
|
||||
|
namespace XNet |
||||
|
{ |
||||
|
[Category("网络通信")] |
||||
|
[DisplayName("ModbusSlave")] |
||||
|
public partial class FrmModbusSlave : Form, IXForm |
||||
|
{ |
||||
|
private ControlConfig _config; |
||||
|
private ILog _log; |
||||
|
private NetServer _Server; |
||||
|
private RegisterUnit[] _data; |
||||
|
|
||||
|
#region 窗体
|
||||
|
public FrmModbusSlave() |
||||
|
{ |
||||
|
InitializeComponent(); |
||||
|
|
||||
|
// 动态调节宽度高度,兼容高DPI
|
||||
|
this.FixDpi(); |
||||
|
|
||||
|
Icon = IcoHelper.GetIcon("Modbus"); |
||||
|
} |
||||
|
|
||||
|
private void FrmMain_Load(Object sender, EventArgs e) |
||||
|
{ |
||||
|
_log = new TextControlLog { Control = txtReceive }; |
||||
|
|
||||
|
_config = new ControlConfig { Control = this, FileName = "ModbusSlave.json" }; |
||||
|
_config.Load(); |
||||
|
|
||||
|
if (cbMode.SelectedIndex < 0) cbMode.SelectedIndex = 0; |
||||
|
|
||||
|
txtReceive.SetDefaultStyle(12); |
||||
|
|
||||
|
// 加载保存的颜色
|
||||
|
UIConfig.Apply(txtReceive); |
||||
|
} |
||||
|
#endregion
|
||||
|
|
||||
|
#region 收发数据
|
||||
|
private void btnConnect_Click(Object sender, EventArgs e) |
||||
|
{ |
||||
|
var btn = sender as Button; |
||||
|
if (btn.Text == "开始") |
||||
|
{ |
||||
|
var svr = new NetServer((Int32)numPort.Value) |
||||
|
{ |
||||
|
Log = _log |
||||
|
}; |
||||
|
svr.Received += OnReceived; |
||||
|
svr.Start(); |
||||
|
|
||||
|
_Server = svr; |
||||
|
|
||||
|
ShowData(); |
||||
|
|
||||
|
pnlSetting.Enabled = false; |
||||
|
btn.Text = "停止"; |
||||
|
|
||||
|
_config.Save(); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
_Server.TryDispose(); |
||||
|
_Server = null; |
||||
|
_timer.TryDispose(); |
||||
|
|
||||
|
pnlSetting.Enabled = true; |
||||
|
btn.Text = "开始"; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private void ShowData() |
||||
|
{ |
||||
|
var addr = (Int32)numAddress.Value; |
||||
|
var count = (Int32)numCount.Value; |
||||
|
var mode = cbMode.SelectedItem + ""; |
||||
|
|
||||
|
var list = new List<RegisterUnit>(count); |
||||
|
|
||||
|
switch (mode) |
||||
|
{ |
||||
|
case "0x0000": |
||||
|
for (var i = 0; i < count; i++) |
||||
|
{ |
||||
|
list.Add(new RegisterUnit { Address = addr + i, Value = 0 }); |
||||
|
} |
||||
|
break; |
||||
|
case "0x7777": |
||||
|
for (var i = 0; i < count; i++) |
||||
|
{ |
||||
|
list.Add(new RegisterUnit { Address = addr + i, Value = 0x7777 }); |
||||
|
} |
||||
|
break; |
||||
|
case "0xFFFF": |
||||
|
for (var i = 0; i < count; i++) |
||||
|
{ |
||||
|
list.Add(new RegisterUnit { Address = addr + i, Value = 0xFFFF }); |
||||
|
} |
||||
|
break; |
||||
|
case "递增": |
||||
|
for (var i = 0; i < count; i++) |
||||
|
{ |
||||
|
list.Add(new RegisterUnit { Address = addr + i, Value = (UInt16)i }); |
||||
|
} |
||||
|
break; |
||||
|
case "静态随机": |
||||
|
case "动态随机": |
||||
|
default: |
||||
|
for (var i = 0; i < count; i++) |
||||
|
{ |
||||
|
list.Add(new RegisterUnit { Address = addr + i, Value = (UInt16)Rand.Next(UInt16.MaxValue) }); |
||||
|
} |
||||
|
break; |
||||
|
} |
||||
|
|
||||
|
if (mode == "动态随机") _timer = new TimerX(DoRefreshData, null, 1_000, 1_000); |
||||
|
|
||||
|
_data = list.ToArray(); |
||||
|
|
||||
|
dataGridView1.DataSource = _data; |
||||
|
} |
||||
|
|
||||
|
private TimerX _timer; |
||||
|
private void DoRefreshData(Object state) |
||||
|
{ |
||||
|
if (_data == null) return; |
||||
|
|
||||
|
for (var i = 0; i < _data.Length; i++) |
||||
|
{ |
||||
|
var x = (Rand.Next(20) - 10) / 100.0; |
||||
|
_data[i].Value = (UInt16)(_data[i].Value * (1 + x)); |
||||
|
} |
||||
|
//dataGridView1.DataSource = _data;
|
||||
|
dataGridView1.Refresh(); |
||||
|
} |
||||
|
|
||||
|
private void OnReceived(Object sender, ReceivedEventArgs e) |
||||
|
{ |
||||
|
var session = sender as ISocketSession; |
||||
|
if (session == null) |
||||
|
{ |
||||
|
var ns = sender as INetSession; |
||||
|
if (ns == null) return; |
||||
|
session = ns.Session; |
||||
|
} |
||||
|
|
||||
|
if (NetConfig.Current.ShowReceiveString) |
||||
|
{ |
||||
|
var line = e.Packet.ToStr(); |
||||
|
|
||||
|
_log.Info(line); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private Int32 _pColor = 0; |
||||
|
private void timer1_Tick(Object sender, EventArgs e) |
||||
|
{ |
||||
|
var cfg = NetConfig.Current; |
||||
|
if (cfg.ColorLog) txtReceive.ColourDefault(_pColor); |
||||
|
_pColor = txtReceive.TextLength; |
||||
|
} |
||||
|
#endregion
|
||||
|
} |
||||
|
} |
@ -0,0 +1,329 @@ |
|||||
|
namespace XNet |
||||
|
{ |
||||
|
partial class FrmModbusSlave |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 必需的设计器变量。
|
||||
|
/// </summary>
|
||||
|
private System.ComponentModel.IContainer components = null; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 清理所有正在使用的资源。
|
||||
|
/// </summary>
|
||||
|
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
|
protected override void Dispose(bool disposing) |
||||
|
{ |
||||
|
if (disposing && (components != null)) |
||||
|
{ |
||||
|
components.Dispose(); |
||||
|
} |
||||
|
base.Dispose(disposing); |
||||
|
} |
||||
|
|
||||
|
#region Windows 窗体设计器生成的代码
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 设计器支持所需的方法 - 不要
|
||||
|
/// 使用代码编辑器修改此方法的内容。
|
||||
|
/// </summary>
|
||||
|
private void InitializeComponent() |
||||
|
{ |
||||
|
this.components = new System.ComponentModel.Container(); |
||||
|
this.txtReceive = new System.Windows.Forms.RichTextBox(); |
||||
|
this.btnConnect = new System.Windows.Forms.Button(); |
||||
|
this.timer1 = new System.Windows.Forms.Timer(this.components); |
||||
|
this.label1 = new System.Windows.Forms.Label(); |
||||
|
this.lbLocal = new System.Windows.Forms.Label(); |
||||
|
this.cbMode = new System.Windows.Forms.ComboBox(); |
||||
|
this.numPort = new System.Windows.Forms.NumericUpDown(); |
||||
|
this.pnlSetting = new System.Windows.Forms.Panel(); |
||||
|
this.numHost = new System.Windows.Forms.NumericUpDown(); |
||||
|
this.label4 = new System.Windows.Forms.Label(); |
||||
|
this.label3 = new System.Windows.Forms.Label(); |
||||
|
this.numCount = new System.Windows.Forms.NumericUpDown(); |
||||
|
this.numAddress = new System.Windows.Forms.NumericUpDown(); |
||||
|
this.label2 = new System.Windows.Forms.Label(); |
||||
|
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); |
||||
|
this.dataGridView1 = new System.Windows.Forms.DataGridView(); |
||||
|
((System.ComponentModel.ISupportInitialize)(this.numPort)).BeginInit(); |
||||
|
this.pnlSetting.SuspendLayout(); |
||||
|
((System.ComponentModel.ISupportInitialize)(this.numHost)).BeginInit(); |
||||
|
((System.ComponentModel.ISupportInitialize)(this.numCount)).BeginInit(); |
||||
|
((System.ComponentModel.ISupportInitialize)(this.numAddress)).BeginInit(); |
||||
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); |
||||
|
this.SuspendLayout(); |
||||
|
//
|
||||
|
// txtReceive
|
||||
|
//
|
||||
|
this.txtReceive.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) |
||||
|
| System.Windows.Forms.AnchorStyles.Left) |
||||
|
| System.Windows.Forms.AnchorStyles.Right))); |
||||
|
this.txtReceive.HideSelection = false; |
||||
|
this.txtReceive.Location = new System.Drawing.Point(468, 55); |
||||
|
this.txtReceive.Margin = new System.Windows.Forms.Padding(4); |
||||
|
this.txtReceive.Name = "txtReceive"; |
||||
|
this.txtReceive.Size = new System.Drawing.Size(404, 407); |
||||
|
this.txtReceive.TabIndex = 1; |
||||
|
this.txtReceive.Text = ""; |
||||
|
//
|
||||
|
// btnConnect
|
||||
|
//
|
||||
|
this.btnConnect.Location = new System.Drawing.Point(783, 11); |
||||
|
this.btnConnect.Margin = new System.Windows.Forms.Padding(4); |
||||
|
this.btnConnect.Name = "btnConnect"; |
||||
|
this.btnConnect.Size = new System.Drawing.Size(89, 36); |
||||
|
this.btnConnect.TabIndex = 3; |
||||
|
this.btnConnect.Text = "开始"; |
||||
|
this.btnConnect.UseVisualStyleBackColor = true; |
||||
|
this.btnConnect.Click += new System.EventHandler(this.btnConnect_Click); |
||||
|
//
|
||||
|
// timer1
|
||||
|
//
|
||||
|
this.timer1.Enabled = true; |
||||
|
this.timer1.Interval = 300; |
||||
|
this.timer1.Tick += new System.EventHandler(this.timer1_Tick); |
||||
|
//
|
||||
|
// label1
|
||||
|
//
|
||||
|
this.label1.AutoSize = true; |
||||
|
this.label1.Location = new System.Drawing.Point(7, 11); |
||||
|
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); |
||||
|
this.label1.Name = "label1"; |
||||
|
this.label1.Size = new System.Drawing.Size(37, 15); |
||||
|
this.label1.TabIndex = 6; |
||||
|
this.label1.Text = "模式"; |
||||
|
//
|
||||
|
// lbLocal
|
||||
|
//
|
||||
|
this.lbLocal.AutoSize = true; |
||||
|
this.lbLocal.Location = new System.Drawing.Point(467, 11); |
||||
|
this.lbLocal.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); |
||||
|
this.lbLocal.Name = "lbLocal"; |
||||
|
this.lbLocal.Size = new System.Drawing.Size(52, 15); |
||||
|
this.lbLocal.TabIndex = 7; |
||||
|
this.lbLocal.Text = "地址:"; |
||||
|
//
|
||||
|
// cbMode
|
||||
|
//
|
||||
|
this.cbMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; |
||||
|
this.cbMode.FormattingEnabled = true; |
||||
|
this.cbMode.Items.AddRange(new object[] { |
||||
|
"0x0000", |
||||
|
"0x7777", |
||||
|
"0xFFFF", |
||||
|
"递增", |
||||
|
"静态随机", |
||||
|
"动态随机"}); |
||||
|
this.cbMode.Location = new System.Drawing.Point(55, 7); |
||||
|
this.cbMode.Margin = new System.Windows.Forms.Padding(4); |
||||
|
this.cbMode.Name = "cbMode"; |
||||
|
this.cbMode.Size = new System.Drawing.Size(123, 23); |
||||
|
this.cbMode.TabIndex = 9; |
||||
|
//
|
||||
|
// numPort
|
||||
|
//
|
||||
|
this.numPort.Location = new System.Drawing.Point(246, 6); |
||||
|
this.numPort.Margin = new System.Windows.Forms.Padding(4); |
||||
|
this.numPort.Maximum = new decimal(new int[] { |
||||
|
65535, |
||||
|
0, |
||||
|
0, |
||||
|
0}); |
||||
|
this.numPort.Minimum = new decimal(new int[] { |
||||
|
1, |
||||
|
0, |
||||
|
0, |
||||
|
0}); |
||||
|
this.numPort.Name = "numPort"; |
||||
|
this.numPort.Size = new System.Drawing.Size(68, 25); |
||||
|
this.numPort.TabIndex = 11; |
||||
|
this.numPort.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; |
||||
|
this.toolTip1.SetToolTip(this.numPort, "端口"); |
||||
|
this.numPort.Value = new decimal(new int[] { |
||||
|
502, |
||||
|
0, |
||||
|
0, |
||||
|
0}); |
||||
|
//
|
||||
|
// pnlSetting
|
||||
|
//
|
||||
|
this.pnlSetting.Controls.Add(this.numHost); |
||||
|
this.pnlSetting.Controls.Add(this.label4); |
||||
|
this.pnlSetting.Controls.Add(this.label3); |
||||
|
this.pnlSetting.Controls.Add(this.numCount); |
||||
|
this.pnlSetting.Controls.Add(this.numPort); |
||||
|
this.pnlSetting.Controls.Add(this.numAddress); |
||||
|
this.pnlSetting.Controls.Add(this.label2); |
||||
|
this.pnlSetting.Controls.Add(this.label1); |
||||
|
this.pnlSetting.Controls.Add(this.lbLocal); |
||||
|
this.pnlSetting.Controls.Add(this.cbMode); |
||||
|
this.pnlSetting.Location = new System.Drawing.Point(12, 10); |
||||
|
this.pnlSetting.Margin = new System.Windows.Forms.Padding(4); |
||||
|
this.pnlSetting.Name = "pnlSetting"; |
||||
|
this.pnlSetting.Size = new System.Drawing.Size(763, 39); |
||||
|
this.pnlSetting.TabIndex = 13; |
||||
|
//
|
||||
|
// numHost
|
||||
|
//
|
||||
|
this.numHost.Location = new System.Drawing.Point(381, 6); |
||||
|
this.numHost.Margin = new System.Windows.Forms.Padding(4); |
||||
|
this.numHost.Maximum = new decimal(new int[] { |
||||
|
65535, |
||||
|
0, |
||||
|
0, |
||||
|
0}); |
||||
|
this.numHost.Minimum = new decimal(new int[] { |
||||
|
1, |
||||
|
0, |
||||
|
0, |
||||
|
0}); |
||||
|
this.numHost.Name = "numHost"; |
||||
|
this.numHost.Size = new System.Drawing.Size(68, 25); |
||||
|
this.numHost.TabIndex = 21; |
||||
|
this.numHost.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; |
||||
|
this.toolTip1.SetToolTip(this.numHost, "端口"); |
||||
|
this.numHost.Value = new decimal(new int[] { |
||||
|
1, |
||||
|
0, |
||||
|
0, |
||||
|
0}); |
||||
|
//
|
||||
|
// label4
|
||||
|
//
|
||||
|
this.label4.AutoSize = true; |
||||
|
this.label4.Location = new System.Drawing.Point(331, 11); |
||||
|
this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); |
||||
|
this.label4.Name = "label4"; |
||||
|
this.label4.Size = new System.Drawing.Size(52, 15); |
||||
|
this.label4.TabIndex = 22; |
||||
|
this.label4.Text = "站号:"; |
||||
|
//
|
||||
|
// label3
|
||||
|
//
|
||||
|
this.label3.AutoSize = true; |
||||
|
this.label3.Location = new System.Drawing.Point(616, 11); |
||||
|
this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); |
||||
|
this.label3.Name = "label3"; |
||||
|
this.label3.Size = new System.Drawing.Size(52, 15); |
||||
|
this.label3.TabIndex = 20; |
||||
|
this.label3.Text = "个数:"; |
||||
|
//
|
||||
|
// numCount
|
||||
|
//
|
||||
|
this.numCount.Location = new System.Drawing.Point(676, 6); |
||||
|
this.numCount.Margin = new System.Windows.Forms.Padding(4); |
||||
|
this.numCount.Maximum = new decimal(new int[] { |
||||
|
65535, |
||||
|
0, |
||||
|
0, |
||||
|
0}); |
||||
|
this.numCount.Minimum = new decimal(new int[] { |
||||
|
1, |
||||
|
0, |
||||
|
0, |
||||
|
0}); |
||||
|
this.numCount.Name = "numCount"; |
||||
|
this.numCount.Size = new System.Drawing.Size(68, 25); |
||||
|
this.numCount.TabIndex = 18; |
||||
|
this.numCount.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; |
||||
|
this.toolTip1.SetToolTip(this.numCount, "端口"); |
||||
|
this.numCount.Value = new decimal(new int[] { |
||||
|
2000, |
||||
|
0, |
||||
|
0, |
||||
|
0}); |
||||
|
//
|
||||
|
// numAddress
|
||||
|
//
|
||||
|
this.numAddress.Location = new System.Drawing.Point(520, 6); |
||||
|
this.numAddress.Margin = new System.Windows.Forms.Padding(4); |
||||
|
this.numAddress.Maximum = new decimal(new int[] { |
||||
|
65535, |
||||
|
0, |
||||
|
0, |
||||
|
0}); |
||||
|
this.numAddress.Minimum = new decimal(new int[] { |
||||
|
1, |
||||
|
0, |
||||
|
0, |
||||
|
0}); |
||||
|
this.numAddress.Name = "numAddress"; |
||||
|
this.numAddress.Size = new System.Drawing.Size(85, 25); |
||||
|
this.numAddress.TabIndex = 17; |
||||
|
this.numAddress.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; |
||||
|
this.toolTip1.SetToolTip(this.numAddress, "端口"); |
||||
|
this.numAddress.Value = new decimal(new int[] { |
||||
|
40000, |
||||
|
0, |
||||
|
0, |
||||
|
0}); |
||||
|
//
|
||||
|
// label2
|
||||
|
//
|
||||
|
this.label2.AutoSize = true; |
||||
|
this.label2.Location = new System.Drawing.Point(199, 11); |
||||
|
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); |
||||
|
this.label2.Name = "label2"; |
||||
|
this.label2.Size = new System.Drawing.Size(52, 15); |
||||
|
this.label2.TabIndex = 19; |
||||
|
this.label2.Text = "端口:"; |
||||
|
//
|
||||
|
// dataGridView1
|
||||
|
//
|
||||
|
this.dataGridView1.AllowUserToAddRows = false; |
||||
|
this.dataGridView1.AllowUserToDeleteRows = false; |
||||
|
this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) |
||||
|
| System.Windows.Forms.AnchorStyles.Left))); |
||||
|
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; |
||||
|
this.dataGridView1.Location = new System.Drawing.Point(12, 56); |
||||
|
this.dataGridView1.Name = "dataGridView1"; |
||||
|
this.dataGridView1.RowHeadersWidth = 51; |
||||
|
this.dataGridView1.RowTemplate.Height = 27; |
||||
|
this.dataGridView1.Size = new System.Drawing.Size(449, 406); |
||||
|
this.dataGridView1.TabIndex = 14; |
||||
|
//
|
||||
|
// FrmModbusSlave
|
||||
|
//
|
||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); |
||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
||||
|
this.ClientSize = new System.Drawing.Size(889, 474); |
||||
|
this.Controls.Add(this.txtReceive); |
||||
|
this.Controls.Add(this.dataGridView1); |
||||
|
this.Controls.Add(this.pnlSetting); |
||||
|
this.Controls.Add(this.btnConnect); |
||||
|
this.Margin = new System.Windows.Forms.Padding(4); |
||||
|
this.Name = "FrmModbusSlave"; |
||||
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; |
||||
|
this.Text = "网络调试"; |
||||
|
this.Load += new System.EventHandler(this.FrmMain_Load); |
||||
|
((System.ComponentModel.ISupportInitialize)(this.numPort)).EndInit(); |
||||
|
this.pnlSetting.ResumeLayout(false); |
||||
|
this.pnlSetting.PerformLayout(); |
||||
|
((System.ComponentModel.ISupportInitialize)(this.numHost)).EndInit(); |
||||
|
((System.ComponentModel.ISupportInitialize)(this.numCount)).EndInit(); |
||||
|
((System.ComponentModel.ISupportInitialize)(this.numAddress)).EndInit(); |
||||
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); |
||||
|
this.ResumeLayout(false); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
private System.Windows.Forms.Button btnConnect; |
||||
|
private System.Windows.Forms.Timer timer1; |
||||
|
private System.Windows.Forms.RichTextBox txtReceive; |
||||
|
private System.Windows.Forms.Label label1; |
||||
|
private System.Windows.Forms.Label lbLocal; |
||||
|
private System.Windows.Forms.ComboBox cbMode; |
||||
|
private System.Windows.Forms.NumericUpDown numPort; |
||||
|
private System.Windows.Forms.Panel pnlSetting; |
||||
|
private System.Windows.Forms.ToolTip toolTip1; |
||||
|
private System.Windows.Forms.NumericUpDown numCount; |
||||
|
private System.Windows.Forms.NumericUpDown numAddress; |
||||
|
private System.Windows.Forms.DataGridView dataGridView1; |
||||
|
private System.Windows.Forms.Label label3; |
||||
|
private System.Windows.Forms.Label label2; |
||||
|
private System.Windows.Forms.Label label4; |
||||
|
private System.Windows.Forms.NumericUpDown numHost; |
||||
|
} |
||||
|
} |
||||
|
|
@ -0,0 +1,129 @@ |
|||||
|
<?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> |
||||
|
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> |
||||
|
<value>17, 17</value> |
||||
|
</metadata> |
||||
|
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> |
||||
|
<value>601, 17</value> |
||||
|
</metadata> |
||||
|
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> |
||||
|
<value>601, 17</value> |
||||
|
</metadata> |
||||
|
</root> |
@ -0,0 +1,15 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace XCoder.XNet |
||||
|
{ |
||||
|
internal class RegisterUnit |
||||
|
{ |
||||
|
public Int32 Address { get; set; } |
||||
|
|
||||
|
public UInt16 Value { get; set; } |
||||
|
} |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue