Browse Source

新增SSH工具

net45
大石头 4 years ago
parent
commit
d6d621e9fc
  1. 94
      XCoder/Common/ControlConfig.cs
  2. 4
      XCoder/FrmMDI.cs
  3. 71
      XCoder/Tools/FrmMD5.cs
  4. 68
      XCoder/Tools/FrmSecurity.cs
  5. 10
      XCoder/XCoder.csproj
  6. 220
      XCoder/XNet/FrmSsh.cs
  7. 407
      XCoder/XNet/FrmSsh.designer.cs
  8. 129
      XCoder/XNet/FrmSsh.resx
  9. 3
      XCoder40/XCoder40.csproj

94
XCoder/Common/ControlConfig.cs

@ -0,0 +1,94 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using NewLife;
using NewLife.Serialization;
namespace XCoder.Common
{
/// <summary>控件配置</summary>
internal class ControlConfig
{
public Control Control { get; set; }
public String FileName { get; set; }
public void Load()
{
var dataPath = Setting.Current.DataPath;
var file = dataPath.CombinePath(FileName).GetFullPath();
if (File.Exists(file))
{
var dic = JsonParser.Decode(File.ReadAllText(file));
LoadConfig(dic, Control);
}
}
private void LoadConfig(IDictionary<String, Object> dic, Control control)
{
foreach (Control item in control.Controls)
{
switch (item)
{
case RadioButton rb:
if (dic.TryGetValue(item.Name, out var v)) rb.Checked = v.ToBoolean();
break;
case CheckBox cb:
if (dic.TryGetValue(item.Name, out v)) cb.Checked = v.ToBoolean();
break;
case RichTextBox rtb:
if (dic.TryGetValue(item.Name, out v)) rtb.Text = v + "";
break;
case NumericUpDown nud:
if (dic.TryGetValue(item.Name, out v)) nud.Value = v.ToInt();
break;
case ComboBox cbox:
if (dic.TryGetValue(item.Name, out v)) cbox.DataSource = (v + "").Split(",");
break;
default:
if (item.Controls.Count > 0) LoadConfig(dic, item);
break;
}
}
}
public void Save()
{
var dic = new Dictionary<String, Object>();
SaveConfig(dic, Control);
var dataPath = Setting.Current.DataPath;
var file = dataPath.CombinePath(FileName).GetFullPath();
file.EnsureDirectory(true);
File.WriteAllText(file, dic.ToJson(true));
}
private void SaveConfig(IDictionary<String, Object> dic, Control control)
{
foreach (Control item in control.Controls)
{
switch (item)
{
case RadioButton rb: dic[item.Name] = rb.Checked; break;
case CheckBox cb: dic[item.Name] = cb.Checked; break;
case RichTextBox rtb: dic[item.Name] = rtb.Text; break;
case NumericUpDown nud: dic[item.Name] = nud.Value; break;
case ComboBox cbox:
var list = new List<String> { cbox.Text };
for (var i = 0; i < cbox.Items.Count; i++)
{
var elm = cbox.Items[i];
if (elm != null) list.Add(elm + "");
}
dic[item.Name] = list.Where(e => !e.IsNullOrEmpty()).Distinct().Join();
break;
default:
if (item.Controls.Count > 0) SaveConfig(dic, item);
break;
}
}
}
}
}

4
XCoder/FrmMDI.cs

@ -70,8 +70,8 @@ namespace XCoder
var ms = new Dictionary<String, ToolStripMenuItem>();
foreach (ToolStripMenuItem item in menuStrip.Items)
{
var name = item.Text.Substring(null, "(");
ms[name] = item;
var name2 = item.Text.Substring(null, "(");
ms[name2] = item;
}
foreach (var item in ts)
{

71
XCoder/Tools/FrmMD5.cs

@ -11,6 +11,7 @@ using System.Windows.Forms;
using NewLife;
using NewLife.Log;
using NewLife.Serialization;
using XCoder.Common;
namespace XCoder.Tools
{
@ -18,6 +19,8 @@ namespace XCoder.Tools
[DisplayName("MD5解密")]
public partial class FrmMD5 : Form, IXForm
{
private ControlConfig _config;
#region 窗体初始化
public FrmMD5()
{
@ -27,70 +30,10 @@ namespace XCoder.Tools
this.FixDpi();
}
private void FrmSecurity_Load(Object sender, EventArgs e) => LoadConfig();
private void LoadConfig()
{
var dataPath = Setting.Current.DataPath;
var file = dataPath.CombinePath("md5.json").GetFullPath();
if (File.Exists(file))
{
var dic = new JsonParser(File.ReadAllText(file)).Decode() as IDictionary<String, Object>;
LoadConfig(dic, this);
}
}
private void LoadConfig(IDictionary<String, Object> dic, Control control)
{
foreach (Control item in control.Controls)
{
switch (item)
{
case RadioButton rb:
if (dic.TryGetValue(item.Name, out var v)) rb.Checked = v.ToBoolean();
break;
case CheckBox cb:
if (dic.TryGetValue(item.Name, out v)) cb.Checked = v.ToBoolean();
break;
case RichTextBox rtb:
if (dic.TryGetValue(item.Name, out v)) rtb.Text = v + "";
break;
case NumericUpDown nud:
if (dic.TryGetValue(item.Name, out v)) nud.Value = v.ToInt();
break;
default:
if (item.Controls.Count > 0) LoadConfig(dic, item);
break;
}
}
}
private void SaveConfig()
private void FrmSecurity_Load(Object sender, EventArgs e)
{
var dic = new Dictionary<String, Object>();
SaveConfig(dic, this);
var dataPath = Setting.Current.DataPath;
var file = dataPath.CombinePath("md5.json").GetFullPath();
file.EnsureDirectory(true);
File.WriteAllText(file, dic.ToJson(true));
}
private void SaveConfig(IDictionary<String, Object> dic, Control control)
{
foreach (Control item in control.Controls)
{
switch (item)
{
case RadioButton rb: dic[item.Name] = rb.Checked; break;
case CheckBox cb: dic[item.Name] = cb.Checked; break;
case RichTextBox rtb: dic[item.Name] = rtb.Text; break;
case NumericUpDown nud: dic[item.Name] = nud.Value; break;
default:
if (item.Controls.Count > 0) SaveConfig(dic, item);
break;
}
}
_config = new ControlConfig { Control = this, FileName = "md5.json" };
_config.Load();
}
#endregion
@ -188,7 +131,7 @@ namespace XCoder.Tools
private Stopwatch _watch;
private async void btnMD5_Click(Object sender, EventArgs e)
{
SaveConfig();
_config.Save();
var chars = GetChars();
var buf = GetSource();

68
XCoder/Tools/FrmSecurity.cs

@ -20,6 +20,7 @@ using NewLife.Reflection;
using NewLife.Security;
using NewLife.Serialization;
using NewLife.Web;
using XCoder.Common;
namespace XCoder.Tools
{
@ -27,6 +28,8 @@ namespace XCoder.Tools
[DisplayName("加密解密")]
public partial class FrmSecurity : Form, IXForm
{
private ControlConfig _config;
#region 窗体初始化
public FrmSecurity()
{
@ -38,67 +41,8 @@ namespace XCoder.Tools
private void FrmSecurity_Load(Object sender, EventArgs e)
{
LoadConfig();
}
private void LoadConfig()
{
var dataPath = Setting.Current.DataPath;
var file = dataPath.CombinePath("security.json").GetFullPath();
if (File.Exists(file))
{
var dic = new JsonParser(File.ReadAllText(file)).Decode() as IDictionary<String, Object>;
LoadConfig(dic, this);
}
}
private void LoadConfig(IDictionary<String, Object> dic, Control control)
{
foreach (Control item in control.Controls)
{
switch (item)
{
case RadioButton rb:
if (dic.TryGetValue(item.Name, out var v)) rb.Checked = v.ToBoolean();
break;
case CheckBox cb:
if (dic.TryGetValue(item.Name, out v)) cb.Checked = v.ToBoolean();
break;
case RichTextBox rtb:
if (dic.TryGetValue(item.Name, out v)) rtb.Text = v + "";
break;
default:
if (item.Controls.Count > 0) LoadConfig(dic, item);
break;
}
}
}
private void SaveConfig()
{
var dic = new Dictionary<String, Object>();
SaveConfig(dic, this);
var dataPath = Setting.Current.DataPath;
var file = dataPath.CombinePath("security.json").GetFullPath();
file.EnsureDirectory(true);
File.WriteAllText(file, dic.ToJson(true));
}
private void SaveConfig(IDictionary<String, Object> dic, Control control)
{
foreach (Control item in control.Controls)
{
switch (item)
{
case RadioButton rb: dic[item.Name] = rb.Checked; break;
case CheckBox cb: dic[item.Name] = cb.Checked; break;
case RichTextBox rtb: dic[item.Name] = rtb.Text; break;
default:
if (item.Controls.Count > 0) SaveConfig(dic, item);
break;
}
}
_config = new ControlConfig { Control = this, FileName = "security.json" };
_config.Load();
}
#endregion
@ -192,7 +136,7 @@ namespace XCoder.Tools
}
rtResult.Text = sb.ToString();
SaveConfig();
_config.Save();
}
private void SetResult(Byte[] data)

10
XCoder/XCoder.csproj

@ -55,6 +55,7 @@
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Compile Include="Common\ControlConfig.cs" />
<Compile Include="Engine\IcoHelper.cs" />
<Compile Include="Engine\ModelConfig.cs" />
<Compile Include="FileEncoding\FrmMain.cs">
@ -123,6 +124,12 @@
<Compile Include="XNet\FrmIp.designer.cs">
<DependentUpon>FrmIp.cs</DependentUpon>
</Compile>
<Compile Include="XNet\FrmSsh.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="XNet\FrmSsh.designer.cs">
<DependentUpon>FrmSsh.cs</DependentUpon>
</Compile>
<Compile Include="XNet\IPPacket.cs" />
<Compile Include="XNet\NetHelper2.cs" />
<Compile Include="XNet\RawSocket.cs" />
@ -210,6 +217,9 @@
<EmbeddedResource Include="XNet\FrmIp.resx">
<DependentUpon>FrmIp.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="XNet\FrmSsh.resx">
<DependentUpon>FrmSsh.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Yun\FrmMap.resx">
<DependentUpon>FrmMap.cs</DependentUpon>
</EmbeddedResource>

220
XCoder/XNet/FrmSsh.cs

@ -0,0 +1,220 @@
using System;
using System.ComponentModel;
using System.Windows.Forms;
using NewLife;
using NewLife.Log;
using NewLife.Net;
using XCoder;
using XCoder.Common;
using XCoder.XNet;
namespace XNet
{
[Category("网络通信")]
[DisplayName("SSH工具")]
public partial class FrmSsh : Form, IXForm
{
private ControlConfig _config;
ISocketClient _Client;
#region 窗体
public FrmSsh()
{
InitializeComponent();
// 动态调节宽度高度,兼容高DPI
this.FixDpi();
Icon = IcoHelper.GetIcon("SSH");
}
private void FrmMain_Load(Object sender, EventArgs e)
{
_config = new ControlConfig { Control = this, FileName = "ssh.json" };
_config.Load();
txtReceive.UseWinFormControl();
txtReceive.Clear();
txtReceive.SetDefaultStyle(12);
txtSend.SetDefaultStyle(12);
gbReceive.Tag = gbReceive.Text;
gbSend.Tag = gbSend.Text;
// 加载保存的颜色
UIConfig.Apply(txtReceive);
}
#endregion
#region 收发数据
void Connect()
{
_Client = null;
var remote = cbRemote.Text;
var uri = new NetUri(remote);
if (uri.Type == NetType.Unknown) uri.Type = NetType.Tcp;
if (uri.Port == 0) uri.Port = 22;
var client = uri.CreateRemote();
client.Received += OnReceived;
client.Log = XTrace.Log;
if (!client.Open()) return;
_Client = client;
"已连接服务器".SpeechTip();
pnlSetting.Enabled = false;
btnConnect.Text = "关闭";
_config.Save();
}
void Disconnect()
{
if (_Client != null)
{
_Client.Dispose();
_Client = null;
"关闭连接".SpeechTip();
}
pnlSetting.Enabled = true;
btnConnect.Text = "打开";
}
private void btnConnect_Click(Object sender, EventArgs e)
{
_config.Save();
var btn = sender as Button;
if (btn.Text == "打开")
Connect();
else
Disconnect();
}
void OnReceived(Object sender, ReceivedEventArgs e)
{
XTrace.WriteLine(e.Packet.ToStr());
}
Int32 _pColor = 0;
Int32 BytesOfReceived = 0;
Int32 BytesOfSent = 0;
Int32 lastReceive = 0;
Int32 lastSend = 0;
private void timer1_Tick(Object sender, EventArgs e)
{
var rcount = BytesOfReceived;
var tcount = BytesOfSent;
if (rcount != lastReceive)
{
gbReceive.Text = (gbReceive.Tag + "").Replace("0", rcount + "");
lastReceive = rcount;
}
if (tcount != lastSend)
{
gbSend.Text = (gbSend.Tag + "").Replace("0", tcount + "");
lastSend = tcount;
}
var cfg = NetConfig.Current;
if (cfg.ColorLog) txtReceive.ColourDefault(_pColor);
_pColor = txtReceive.TextLength;
}
private void btnSend_Click(Object sender, EventArgs e)
{
var str = txtSend.Text;
if (String.IsNullOrEmpty(str))
{
MessageBox.Show("发送内容不能为空!", Text);
txtSend.Focus();
return;
}
// 处理换行
str = str.Replace("\n", "\r\n");
if (_Client != null) _Client.Send(str);
}
#endregion
#region 右键菜单
private void mi清空_Click(Object sender, EventArgs e)
{
txtReceive.Clear();
BytesOfReceived = 0;
}
private void mi清空2_Click(Object sender, EventArgs e)
{
txtSend.Clear();
BytesOfSent = 0;
}
private void mi显示应用日志_Click(Object sender, EventArgs e)
{
var mi = sender as ToolStripMenuItem;
mi.Checked = !mi.Checked;
}
private void mi显示网络日志_Click(Object sender, EventArgs e)
{
var mi = sender as ToolStripMenuItem;
mi.Checked = !mi.Checked;
}
private void mi显示发送数据_Click(Object sender, EventArgs e)
{
var mi = sender as ToolStripMenuItem;
mi.Checked = !mi.Checked;
}
private void mi显示接收数据_Click(Object sender, EventArgs e)
{
var mi = sender as ToolStripMenuItem;
mi.Checked = !mi.Checked;
}
private void mi显示统计信息_Click(Object sender, EventArgs e)
{
var mi = sender as ToolStripMenuItem;
NetConfig.Current.ShowStat = mi.Checked = !mi.Checked;
}
private void mi显示接收字符串_Click(Object sender, EventArgs e)
{
var mi = sender as ToolStripMenuItem;
NetConfig.Current.ShowReceiveString = mi.Checked = !mi.Checked;
}
private void miHex发送_Click(Object sender, EventArgs e)
{
var mi = sender as ToolStripMenuItem;
NetConfig.Current.HexSend = mi.Checked = !mi.Checked;
}
private void Tcp参数ToolStripMenuItem_Click(Object sender, EventArgs e)
{
NetHelper2.ShowTcpParameters();
}
private void TcpToolStripMenuItem_Click(Object sender, EventArgs e)
{
NetHelper2.SetTcpMax();
}
private void mi日志着色_Click(Object sender, EventArgs e)
{
var mi = sender as ToolStripMenuItem;
mi.Checked = !mi.Checked;
}
#endregion
}
}

407
XCoder/XNet/FrmSsh.designer.cs

@ -0,0 +1,407 @@
namespace XNet
{
partial class FrmSsh
{
/// <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.gbReceive = new System.Windows.Forms.GroupBox();
this.txtReceive = new System.Windows.Forms.RichTextBox();
this.menuReceive = new System.Windows.Forms.ContextMenuStrip(this.components);
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.mi日志着色 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator();
this.mi显示应用日志 = new System.Windows.Forms.ToolStripMenuItem();
this.mi显示网络日志 = new System.Windows.Forms.ToolStripMenuItem();
this.mi显示接收字符串 = new System.Windows.Forms.ToolStripMenuItem();
this.mi显示发送数据 = new System.Windows.Forms.ToolStripMenuItem();
this.mi显示接收数据 = new System.Windows.Forms.ToolStripMenuItem();
this.mi显示统计信息 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripSeparator();
this.Tcp参数ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.TcpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuSend = new System.Windows.Forms.ContextMenuStrip(this.components);
this.miHexSend = new System.Windows.Forms.ToolStripMenuItem();
this.mi清空2 = new System.Windows.Forms.ToolStripMenuItem();
this.btnConnect = new System.Windows.Forms.Button();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.fontDialog1 = new System.Windows.Forms.FontDialog();
this.colorDialog1 = new System.Windows.Forms.ColorDialog();
this.pnlSetting = new System.Windows.Forms.Panel();
this.cbRemote = new System.Windows.Forms.ComboBox();
this.label4 = new System.Windows.Forms.Label();
this.gbSend = new System.Windows.Forms.GroupBox();
this.txtSend = new System.Windows.Forms.RichTextBox();
this.btnSend = new System.Windows.Forms.Button();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.label1 = new System.Windows.Forms.Label();
this.txtUser = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.textBox2 = new System.Windows.Forms.TextBox();
this.gbReceive.SuspendLayout();
this.menuReceive.SuspendLayout();
this.menuSend.SuspendLayout();
this.pnlSetting.SuspendLayout();
this.gbSend.SuspendLayout();
this.SuspendLayout();
//
// gbReceive
//
this.gbReceive.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.gbReceive.Controls.Add(this.txtReceive);
this.gbReceive.Location = new System.Drawing.Point(14, 64);
this.gbReceive.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.gbReceive.Name = "gbReceive";
this.gbReceive.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.gbReceive.Size = new System.Drawing.Size(978, 351);
this.gbReceive.TabIndex = 4;
this.gbReceive.TabStop = false;
this.gbReceive.Text = "接收区:已接收0字节";
//
// txtReceive
//
this.txtReceive.ContextMenuStrip = this.menuReceive;
this.txtReceive.Dock = System.Windows.Forms.DockStyle.Fill;
this.txtReceive.HideSelection = false;
this.txtReceive.Location = new System.Drawing.Point(4, 25);
this.txtReceive.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.txtReceive.Name = "txtReceive";
this.txtReceive.Size = new System.Drawing.Size(970, 322);
this.txtReceive.TabIndex = 1;
this.txtReceive.Text = "";
//
// menuReceive
//
this.menuReceive.ImageScalingSize = new System.Drawing.Size(24, 24);
this.menuReceive.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItem1,
this.mi日志着色,
this.toolStripMenuItem3,
this.mi显示应用日志,
this.mi显示网络日志,
this.mi显示接收字符串,
this.mi显示发送数据,
this.mi显示接收数据,
this.mi显示统计信息,
this.toolStripMenuItem4,
this.Tcp参数ToolStripMenuItem,
this.TcpToolStripMenuItem});
this.menuReceive.Name = "menuSend";
this.menuReceive.Size = new System.Drawing.Size(207, 316);
//
// toolStripMenuItem1
//
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(206, 30);
this.toolStripMenuItem1.Text = "清空";
this.toolStripMenuItem1.Click += new System.EventHandler(this.mi清空_Click);
//
// mi日志着色
//
this.mi日志着色.Name = "mi日志着色";
this.mi日志着色.Size = new System.Drawing.Size(206, 30);
this.mi日志着色.Text = "日志着色";
this.mi日志着色.Click += new System.EventHandler(this.mi日志着色_Click);
//
// toolStripMenuItem3
//
this.toolStripMenuItem3.Name = "toolStripMenuItem3";
this.toolStripMenuItem3.Size = new System.Drawing.Size(203, 6);
//
// mi显示应用日志
//
this.mi显示应用日志.Name = "mi显示应用日志";
this.mi显示应用日志.Size = new System.Drawing.Size(206, 30);
this.mi显示应用日志.Text = "显示应用日志";
this.mi显示应用日志.Click += new System.EventHandler(this.mi显示应用日志_Click);
//
// mi显示网络日志
//
this.mi显示网络日志.Name = "mi显示网络日志";
this.mi显示网络日志.Size = new System.Drawing.Size(206, 30);
this.mi显示网络日志.Text = "显示网络日志";
this.mi显示网络日志.Click += new System.EventHandler(this.mi显示网络日志_Click);
//
// mi显示接收字符串
//
this.mi显示接收字符串.Name = "mi显示接收字符串";
this.mi显示接收字符串.Size = new System.Drawing.Size(206, 30);
this.mi显示接收字符串.Text = "显示接收字符串";
this.mi显示接收字符串.Click += new System.EventHandler(this.mi显示接收字符串_Click);
//
// mi显示发送数据
//
this.mi显示发送数据.Name = "mi显示发送数据";
this.mi显示发送数据.Size = new System.Drawing.Size(206, 30);
this.mi显示发送数据.Text = "显示发送数据";
this.mi显示发送数据.Click += new System.EventHandler(this.mi显示发送数据_Click);
//
// mi显示接收数据
//
this.mi显示接收数据.Name = "mi显示接收数据";
this.mi显示接收数据.Size = new System.Drawing.Size(206, 30);
this.mi显示接收数据.Text = "显示接收数据";
this.mi显示接收数据.Click += new System.EventHandler(this.mi显示接收数据_Click);
//
// mi显示统计信息
//
this.mi显示统计信息.Name = "mi显示统计信息";
this.mi显示统计信息.Size = new System.Drawing.Size(206, 30);
this.mi显示统计信息.Text = "显示统计信息";
this.mi显示统计信息.Click += new System.EventHandler(this.mi显示统计信息_Click);
//
// toolStripMenuItem4
//
this.toolStripMenuItem4.Name = "toolStripMenuItem4";
this.toolStripMenuItem4.Size = new System.Drawing.Size(203, 6);
//
// 查看Tcp参数ToolStripMenuItem
//
this.Tcp参数ToolStripMenuItem.Name = "查看Tcp参数ToolStripMenuItem";
this.Tcp参数ToolStripMenuItem.Size = new System.Drawing.Size(206, 30);
this.Tcp参数ToolStripMenuItem.Text = "查看Tcp参数";
this.Tcp参数ToolStripMenuItem.Click += new System.EventHandler(this.Tcp参数ToolStripMenuItem_Click);
//
// 设置最大TcpToolStripMenuItem
//
this.TcpToolStripMenuItem.Name = "设置最大TcpToolStripMenuItem";
this.TcpToolStripMenuItem.Size = new System.Drawing.Size(206, 30);
this.TcpToolStripMenuItem.Text = "设置最大Tcp";
this.TcpToolStripMenuItem.Click += new System.EventHandler(this.TcpToolStripMenuItem_Click);
//
// menuSend
//
this.menuSend.ImageScalingSize = new System.Drawing.Size(24, 24);
this.menuSend.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.miHexSend,
this.mi清空2});
this.menuSend.Name = "menuSend";
this.menuSend.Size = new System.Drawing.Size(150, 64);
//
// miHexSend
//
this.miHexSend.Name = "miHexSend";
this.miHexSend.Size = new System.Drawing.Size(149, 30);
this.miHexSend.Text = "Hex发送";
this.miHexSend.Click += new System.EventHandler(this.miHex发送_Click);
//
// mi清空2
//
this.mi清空2.Name = "mi清空2";
this.mi清空2.Size = new System.Drawing.Size(149, 30);
this.mi清空2.Text = "清空";
this.mi清空2.Click += new System.EventHandler(this.mi清空2_Click);
//
// btnConnect
//
this.btnConnect.Location = new System.Drawing.Point(880, 14);
this.btnConnect.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.btnConnect.Name = "btnConnect";
this.btnConnect.Size = new System.Drawing.Size(100, 44);
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);
//
// pnlSetting
//
this.pnlSetting.Controls.Add(this.textBox2);
this.pnlSetting.Controls.Add(this.label3);
this.pnlSetting.Controls.Add(this.txtUser);
this.pnlSetting.Controls.Add(this.label1);
this.pnlSetting.Controls.Add(this.cbRemote);
this.pnlSetting.Controls.Add(this.label4);
this.pnlSetting.Location = new System.Drawing.Point(14, 12);
this.pnlSetting.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.pnlSetting.Name = "pnlSetting";
this.pnlSetting.Size = new System.Drawing.Size(858, 46);
this.pnlSetting.TabIndex = 13;
//
// cbRemote
//
this.cbRemote.FormattingEnabled = true;
this.cbRemote.Location = new System.Drawing.Point(77, 14);
this.cbRemote.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.cbRemote.Name = "cbRemote";
this.cbRemote.Size = new System.Drawing.Size(252, 26);
this.cbRemote.TabIndex = 17;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(23, 18);
this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(44, 18);
this.label4.TabIndex = 16;
this.label4.Text = "远程";
//
// gbSend
//
this.gbSend.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.gbSend.Controls.Add(this.txtSend);
this.gbSend.Controls.Add(this.btnSend);
this.gbSend.Location = new System.Drawing.Point(14, 424);
this.gbSend.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.gbSend.Name = "gbSend";
this.gbSend.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.gbSend.Size = new System.Drawing.Size(978, 126);
this.gbSend.TabIndex = 15;
this.gbSend.TabStop = false;
this.gbSend.Text = "发送区:已发送0字节";
//
// txtSend
//
this.txtSend.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.txtSend.ContextMenuStrip = this.menuSend;
this.txtSend.HideSelection = false;
this.txtSend.Location = new System.Drawing.Point(0, 28);
this.txtSend.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.txtSend.Name = "txtSend";
this.txtSend.Size = new System.Drawing.Size(886, 86);
this.txtSend.TabIndex = 2;
this.txtSend.Text = "";
//
// btnSend
//
this.btnSend.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnSend.Location = new System.Drawing.Point(894, 74);
this.btnSend.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.btnSend.Name = "btnSend";
this.btnSend.Size = new System.Drawing.Size(75, 45);
this.btnSend.TabIndex = 1;
this.btnSend.Text = "发送";
this.btnSend.UseVisualStyleBackColor = true;
this.btnSend.Click += new System.EventHandler(this.btnSend_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(357, 18);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(80, 18);
this.label1.TabIndex = 18;
this.label1.Text = "用户名:";
//
// txtUser
//
this.txtUser.Location = new System.Drawing.Point(441, 13);
this.txtUser.Name = "txtUser";
this.txtUser.Size = new System.Drawing.Size(100, 28);
this.txtUser.TabIndex = 19;
this.txtUser.Text = "root";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(587, 18);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(62, 18);
this.label3.TabIndex = 20;
this.label3.Text = "密码:";
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(644, 13);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(100, 28);
this.textBox2.TabIndex = 21;
this.textBox2.Text = "root";
//
// FrmSsh
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1000, 568);
this.Controls.Add(this.gbSend);
this.Controls.Add(this.pnlSetting);
this.Controls.Add(this.btnConnect);
this.Controls.Add(this.gbReceive);
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.Name = "FrmSsh";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "SSH工具";
this.Load += new System.EventHandler(this.FrmMain_Load);
this.gbReceive.ResumeLayout(false);
this.menuReceive.ResumeLayout(false);
this.menuSend.ResumeLayout(false);
this.pnlSetting.ResumeLayout(false);
this.pnlSetting.PerformLayout();
this.gbSend.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox gbReceive;
private System.Windows.Forms.Button btnConnect;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.ContextMenuStrip menuSend;
private System.Windows.Forms.ToolStripMenuItem mi清空2;
private System.Windows.Forms.RichTextBox txtReceive;
private System.Windows.Forms.FontDialog fontDialog1;
private System.Windows.Forms.ColorDialog colorDialog1;
private System.Windows.Forms.Panel pnlSetting;
private System.Windows.Forms.ContextMenuStrip menuReceive;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem3;
private System.Windows.Forms.GroupBox gbSend;
private System.Windows.Forms.RichTextBox txtSend;
private System.Windows.Forms.Button btnSend;
private System.Windows.Forms.ToolStripMenuItem mi显示发送数据;
private System.Windows.Forms.ToolStripMenuItem mi显示接收数据;
private System.Windows.Forms.ToolStripMenuItem mi显示统计信息;
private System.Windows.Forms.ToolStripMenuItem mi显示接收字符串;
private System.Windows.Forms.ToolStripMenuItem mi显示应用日志;
private System.Windows.Forms.ToolStripMenuItem mi显示网络日志;
private System.Windows.Forms.ToolTip toolTip1;
private System.Windows.Forms.ToolStripMenuItem miHexSend;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem4;
private System.Windows.Forms.ToolStripMenuItem Tcp参数ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem TcpToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem mi日志着色;
private System.Windows.Forms.ComboBox cbRemote;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox txtUser;
private System.Windows.Forms.Label label1;
}
}

129
XCoder/XNet/FrmSsh.resx

@ -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="menuReceive.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>104, 13</value>
</metadata>
<metadata name="menuSend.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>237, 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>

3
XCoder40/XCoder40.csproj

@ -51,6 +51,9 @@
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\XCoder\Common\ControlConfig.cs">
<Link>Common\ControlConfig.cs</Link>
</Compile>
<Compile Include="..\XCoder\Engine\FileSource.cs">
<Link>Engine\FileSource.cs</Link>
</Compile>

Loading…
Cancel
Save