mirror of
https://github.com/Ylianst/MeshCentralRouter
synced 2025-12-06 00:13:33 +00:00
Added live stats to desktop and routing.
This commit is contained in:
@@ -482,7 +482,8 @@ namespace MeshCentralRouter
|
||||
//if (state == ConnectState.Disconnected) return;
|
||||
try
|
||||
{
|
||||
parent.wc.SendBinary(buffer, 0, buffer.Length);
|
||||
parent.bytesOut += buffer.Length;
|
||||
parent.bytesOutCompressed += parent.wc.SendBinary(buffer, 0, buffer.Length);
|
||||
bytesent += buffer.Length;
|
||||
}
|
||||
catch (Exception) { }
|
||||
@@ -493,7 +494,8 @@ namespace MeshCentralRouter
|
||||
//if (state == ConnectState.Disconnected) return;
|
||||
try
|
||||
{
|
||||
parent.wc.SendString(str);
|
||||
parent.bytesOut += str.Length;
|
||||
parent.bytesOutCompressed += parent.wc.SendString(str);
|
||||
bytesent += str.Length;
|
||||
}
|
||||
catch (Exception) { }
|
||||
@@ -506,7 +508,8 @@ namespace MeshCentralRouter
|
||||
{
|
||||
try
|
||||
{
|
||||
parent.wc.SendBinary(((MemoryStream)bw.BaseStream).GetBuffer(), 0, (int)((MemoryStream)bw.BaseStream).Length);
|
||||
parent.bytesOut += (int)((MemoryStream)bw.BaseStream).Length;
|
||||
parent.bytesOutCompressed += parent.wc.SendBinary(((MemoryStream)bw.BaseStream).GetBuffer(), 0, (int)((MemoryStream)bw.BaseStream).Length);
|
||||
bytesent += (int)((MemoryStream)bw.BaseStream).Length;
|
||||
}
|
||||
catch (Exception) { }
|
||||
|
||||
187
KVMStats.Designer.cs
generated
Normal file
187
KVMStats.Designer.cs
generated
Normal file
@@ -0,0 +1,187 @@
|
||||
namespace MeshCentralRouter
|
||||
{
|
||||
partial class KVMStats
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(KVMStats));
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.label12 = new System.Windows.Forms.Label();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.kvmCompInBytesLabel = new System.Windows.Forms.Label();
|
||||
this.kvmCompOutBytesLabel = new System.Windows.Forms.Label();
|
||||
this.kvmOutBytesLabel = new System.Windows.Forms.Label();
|
||||
this.kvmInBytesLabel = new System.Windows.Forms.Label();
|
||||
this.outRatioLabel = new System.Windows.Forms.Label();
|
||||
this.inRatioLabel = new System.Windows.Forms.Label();
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.label11 = new System.Windows.Forms.Label();
|
||||
this.refreshTimer = new System.Windows.Forms.Timer(this.components);
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
resources.ApplyResources(this.okButton, "okButton");
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// label12
|
||||
//
|
||||
resources.ApplyResources(this.label12, "label12");
|
||||
this.label12.Name = "label12";
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
resources.ApplyResources(this.groupBox1, "groupBox1");
|
||||
this.groupBox1.Controls.Add(this.outRatioLabel);
|
||||
this.groupBox1.Controls.Add(this.inRatioLabel);
|
||||
this.groupBox1.Controls.Add(this.label10);
|
||||
this.groupBox1.Controls.Add(this.label11);
|
||||
this.groupBox1.Controls.Add(this.kvmCompOutBytesLabel);
|
||||
this.groupBox1.Controls.Add(this.kvmCompInBytesLabel);
|
||||
this.groupBox1.Controls.Add(this.label2);
|
||||
this.groupBox1.Controls.Add(this.label12);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.TabStop = false;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
resources.ApplyResources(this.label2, "label2");
|
||||
this.label2.Name = "label2";
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
resources.ApplyResources(this.groupBox2, "groupBox2");
|
||||
this.groupBox2.Controls.Add(this.kvmOutBytesLabel);
|
||||
this.groupBox2.Controls.Add(this.label3);
|
||||
this.groupBox2.Controls.Add(this.kvmInBytesLabel);
|
||||
this.groupBox2.Controls.Add(this.label4);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.TabStop = false;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
resources.ApplyResources(this.label3, "label3");
|
||||
this.label3.Name = "label3";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
resources.ApplyResources(this.label4, "label4");
|
||||
this.label4.Name = "label4";
|
||||
//
|
||||
// kvmCompInBytesLabel
|
||||
//
|
||||
resources.ApplyResources(this.kvmCompInBytesLabel, "kvmCompInBytesLabel");
|
||||
this.kvmCompInBytesLabel.Name = "kvmCompInBytesLabel";
|
||||
//
|
||||
// kvmCompOutBytesLabel
|
||||
//
|
||||
resources.ApplyResources(this.kvmCompOutBytesLabel, "kvmCompOutBytesLabel");
|
||||
this.kvmCompOutBytesLabel.Name = "kvmCompOutBytesLabel";
|
||||
//
|
||||
// kvmOutBytesLabel
|
||||
//
|
||||
resources.ApplyResources(this.kvmOutBytesLabel, "kvmOutBytesLabel");
|
||||
this.kvmOutBytesLabel.Name = "kvmOutBytesLabel";
|
||||
//
|
||||
// kvmInBytesLabel
|
||||
//
|
||||
resources.ApplyResources(this.kvmInBytesLabel, "kvmInBytesLabel");
|
||||
this.kvmInBytesLabel.Name = "kvmInBytesLabel";
|
||||
//
|
||||
// outRatioLabel
|
||||
//
|
||||
resources.ApplyResources(this.outRatioLabel, "outRatioLabel");
|
||||
this.outRatioLabel.Name = "outRatioLabel";
|
||||
//
|
||||
// inRatioLabel
|
||||
//
|
||||
resources.ApplyResources(this.inRatioLabel, "inRatioLabel");
|
||||
this.inRatioLabel.Name = "inRatioLabel";
|
||||
//
|
||||
// label10
|
||||
//
|
||||
resources.ApplyResources(this.label10, "label10");
|
||||
this.label10.Name = "label10";
|
||||
//
|
||||
// label11
|
||||
//
|
||||
resources.ApplyResources(this.label11, "label11");
|
||||
this.label11.Name = "label11";
|
||||
//
|
||||
// refreshTimer
|
||||
//
|
||||
this.refreshTimer.Interval = 500;
|
||||
this.refreshTimer.Tick += new System.EventHandler(this.refreshTimer_Tick);
|
||||
//
|
||||
// KVMStats
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.groupBox2);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "KVMStats";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.KVMStats_FormClosing);
|
||||
this.Load += new System.EventHandler(this.KVMStats_Load);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.Label label12;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.Label outRatioLabel;
|
||||
private System.Windows.Forms.Label inRatioLabel;
|
||||
private System.Windows.Forms.Label label10;
|
||||
private System.Windows.Forms.Label label11;
|
||||
private System.Windows.Forms.Label kvmCompOutBytesLabel;
|
||||
private System.Windows.Forms.Label kvmCompInBytesLabel;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private System.Windows.Forms.Label kvmOutBytesLabel;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Label kvmInBytesLabel;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.Timer refreshTimer;
|
||||
}
|
||||
}
|
||||
51
KVMStats.cs
Normal file
51
KVMStats.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MeshCentralRouter
|
||||
{
|
||||
public partial class KVMStats : Form
|
||||
{
|
||||
public KVMViewer viewer;
|
||||
|
||||
public KVMStats(KVMViewer viewer)
|
||||
{
|
||||
this.viewer = viewer;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void refreshTimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
kvmInBytesLabel.Text = string.Format(((viewer.bytesIn == 1)?"{0} Byte":"{0} Bytes"), viewer.bytesIn);
|
||||
kvmOutBytesLabel.Text = string.Format(((viewer.bytesOut == 1) ? "{0} Byte" : "{0} Bytes"), viewer.bytesOut);
|
||||
kvmCompInBytesLabel.Text = string.Format(((viewer.bytesInCompressed == 1) ? "{0} Byte" : "{0} Bytes"), viewer.bytesInCompressed);
|
||||
kvmCompOutBytesLabel.Text = string.Format(((viewer.bytesOutCompressed == 1) ? "{0} Byte" : "{0} Bytes"), viewer.bytesOutCompressed);
|
||||
if (viewer.bytesIn == 0) {
|
||||
inRatioLabel.Text = "0%";
|
||||
} else {
|
||||
inRatioLabel.Text = (100 - ((viewer.bytesInCompressed * 100) / viewer.bytesIn)) + "%";
|
||||
}
|
||||
if (viewer.bytesOut == 0) {
|
||||
outRatioLabel.Text = "0%";
|
||||
} else {
|
||||
outRatioLabel.Text = (100 - ((viewer.bytesOutCompressed * 100) / viewer.bytesOut)) + "%";
|
||||
}
|
||||
}
|
||||
|
||||
private void KVMStats_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
refreshTimer.Enabled = false;
|
||||
}
|
||||
|
||||
private void KVMStats_Load(object sender, EventArgs e)
|
||||
{
|
||||
refreshTimer.Enabled = true;
|
||||
refreshTimer_Tick(this, null);
|
||||
Text = viewer.Text;
|
||||
}
|
||||
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
viewer.closeKvmStats();
|
||||
}
|
||||
}
|
||||
}
|
||||
2309
KVMStats.resx
Normal file
2309
KVMStats.resx
Normal file
File diff suppressed because it is too large
Load Diff
23
KVMViewer.Designer.cs
generated
23
KVMViewer.Designer.cs
generated
@@ -57,8 +57,9 @@ namespace MeshCentralRouter
|
||||
this.cadButton = new System.Windows.Forms.Button();
|
||||
this.connectButton = new System.Windows.Forms.Button();
|
||||
this.consoleMessage = new System.Windows.Forms.Label();
|
||||
this.resizeKvmControl = new MeshCentralRouter.KVMResizeControl();
|
||||
this.consoleTimer = new System.Windows.Forms.Timer(this.components);
|
||||
this.statsButton = new System.Windows.Forms.Button();
|
||||
this.resizeKvmControl = new MeshCentralRouter.KVMResizeControl();
|
||||
this.mainStatusStrip.SuspendLayout();
|
||||
this.topPanel.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
@@ -92,6 +93,7 @@ namespace MeshCentralRouter
|
||||
// topPanel
|
||||
//
|
||||
this.topPanel.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.topPanel.Controls.Add(this.statsButton);
|
||||
this.topPanel.Controls.Add(this.displaySelectComboBox);
|
||||
this.topPanel.Controls.Add(this.settingsButton);
|
||||
this.topPanel.Controls.Add(this.zoomButton);
|
||||
@@ -146,6 +148,19 @@ namespace MeshCentralRouter
|
||||
this.consoleMessage.ForeColor = System.Drawing.Color.Black;
|
||||
this.consoleMessage.Name = "consoleMessage";
|
||||
//
|
||||
// consoleTimer
|
||||
//
|
||||
this.consoleTimer.Interval = 5000;
|
||||
this.consoleTimer.Tick += new System.EventHandler(this.consoleTimer_Tick);
|
||||
//
|
||||
// statsButton
|
||||
//
|
||||
resources.ApplyResources(this.statsButton, "statsButton");
|
||||
this.statsButton.Name = "statsButton";
|
||||
this.statsButton.TabStop = false;
|
||||
this.statsButton.UseVisualStyleBackColor = true;
|
||||
this.statsButton.Click += new System.EventHandler(this.statsButton_Click);
|
||||
//
|
||||
// resizeKvmControl
|
||||
//
|
||||
this.resizeKvmControl.BackColor = System.Drawing.Color.Gray;
|
||||
@@ -155,11 +170,6 @@ namespace MeshCentralRouter
|
||||
this.resizeKvmControl.StateChanged += new System.EventHandler(this.kvmControl_StateChanged);
|
||||
this.resizeKvmControl.DisplaysReceived += new System.EventHandler(this.resizeKvmControl_DisplaysReceived);
|
||||
//
|
||||
// consoleTimer
|
||||
//
|
||||
this.consoleTimer.Interval = 5000;
|
||||
this.consoleTimer.Tick += new System.EventHandler(this.consoleTimer_Tick);
|
||||
//
|
||||
// KVMViewer
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
@@ -195,6 +205,7 @@ namespace MeshCentralRouter
|
||||
private ComboBox displaySelectComboBox;
|
||||
private Label consoleMessage;
|
||||
private Timer consoleTimer;
|
||||
private Button statsButton;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
40
KVMViewer.cs
40
KVMViewer.cs
@@ -27,6 +27,7 @@ namespace MeshCentralRouter
|
||||
public partial class KVMViewer : Form
|
||||
{
|
||||
private KVMControl kvmControl = null;
|
||||
private KVMStats kvmStats = null;
|
||||
private MeshCentralServer server = null;
|
||||
private NodeClass node = null;
|
||||
private int state = 0;
|
||||
@@ -36,6 +37,12 @@ namespace MeshCentralRouter
|
||||
public webSocketClient wc = null;
|
||||
public Dictionary<string, int> userSessions = null;
|
||||
|
||||
// Stats
|
||||
public long bytesIn = 0;
|
||||
public long bytesInCompressed = 0;
|
||||
public long bytesOut = 0;
|
||||
public long bytesOutCompressed = 0;
|
||||
|
||||
public KVMViewer(MeshCentralServer server, NodeClass node)
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -82,6 +89,7 @@ namespace MeshCentralRouter
|
||||
private void MenuItemExit_Click(object sender, EventArgs e)
|
||||
{
|
||||
node.desktopViewer = null;
|
||||
closeKvmStats();
|
||||
Close();
|
||||
}
|
||||
|
||||
@@ -121,6 +129,12 @@ namespace MeshCentralRouter
|
||||
}
|
||||
case webSocketClient.ConnectionStates.Connected:
|
||||
{
|
||||
// Reset stats
|
||||
bytesIn = 0;
|
||||
bytesInCompressed = 0;
|
||||
bytesOut = 0;
|
||||
bytesOutCompressed = 0;
|
||||
|
||||
state = 2;
|
||||
string u = "*/meshrelay.ashx?p=2&nodeid=" + node.nodeid + "&id=" + randomIdHex + "&rauth=" + server.rauthCookie;
|
||||
server.sendCommand("{ \"action\": \"msg\", \"type\": \"tunnel\", \"nodeid\": \"" + node.nodeid + "\", \"value\": \"" + u.ToString() + "\", \"usage\": 2 }");
|
||||
@@ -133,6 +147,9 @@ namespace MeshCentralRouter
|
||||
|
||||
private void Wc_onStringData(webSocketClient sender, string data, int orglen)
|
||||
{
|
||||
bytesIn += data.Length;
|
||||
bytesInCompressed += orglen;
|
||||
|
||||
if ((state == 2) && ((data == "c") || (data == "cr")))
|
||||
{
|
||||
if (data == "cr") { sessionIsRecorded = true; }
|
||||
@@ -183,6 +200,9 @@ namespace MeshCentralRouter
|
||||
|
||||
private void Wc_onBinaryData(webSocketClient sender, byte[] data, int offset, int length, int orglen)
|
||||
{
|
||||
bytesIn += length;
|
||||
bytesInCompressed += orglen;
|
||||
|
||||
if (state != 3) return;
|
||||
kvmControl.ProcessData(data, offset, length);
|
||||
}
|
||||
@@ -265,6 +285,7 @@ namespace MeshCentralRouter
|
||||
UpdateStatus();
|
||||
}
|
||||
node.desktopViewer = null;
|
||||
closeKvmStats();
|
||||
}
|
||||
|
||||
private void toolStripMenuItem2_DropDownOpening(object sender, EventArgs e)
|
||||
@@ -418,5 +439,24 @@ namespace MeshCentralRouter
|
||||
consoleMessage.Visible = false;
|
||||
consoleTimer.Enabled = false;
|
||||
}
|
||||
|
||||
private void statsButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (kvmStats == null)
|
||||
{
|
||||
kvmStats = new KVMStats(this);
|
||||
kvmStats.Show(this);
|
||||
} else
|
||||
{
|
||||
kvmStats.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
public void closeKvmStats()
|
||||
{
|
||||
if (kvmStats == null) return;
|
||||
kvmStats.Close();
|
||||
kvmStats = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,6 +167,37 @@
|
||||
<metadata name="updateTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>264, 17</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="statsButton.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="statsButton.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="statsButton.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>989, 3</value>
|
||||
</data>
|
||||
<data name="statsButton.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>52, 26</value>
|
||||
</data>
|
||||
<data name="statsButton.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>7</value>
|
||||
</data>
|
||||
<data name="statsButton.Text" xml:space="preserve">
|
||||
<value>Stats</value>
|
||||
</data>
|
||||
<data name=">>statsButton.Name" xml:space="preserve">
|
||||
<value>statsButton</value>
|
||||
</data>
|
||||
<data name=">>statsButton.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>statsButton.Parent" xml:space="preserve">
|
||||
<value>topPanel</value>
|
||||
</data>
|
||||
<data name=">>statsButton.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="displaySelectComboBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>383, 5</value>
|
||||
</data>
|
||||
@@ -189,9 +220,8 @@
|
||||
<value>topPanel</value>
|
||||
</data>
|
||||
<data name=">>displaySelectComboBox.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
<value>1</value>
|
||||
</data>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="settingsButton.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
@@ -217,7 +247,7 @@
|
||||
<value>topPanel</value>
|
||||
</data>
|
||||
<data name=">>settingsButton.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="zoomButton.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
@@ -244,7 +274,7 @@
|
||||
<value>topPanel</value>
|
||||
</data>
|
||||
<data name=">>zoomButton.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="cadButton.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
@@ -271,7 +301,7 @@
|
||||
<value>topPanel</value>
|
||||
</data>
|
||||
<data name=">>cadButton.ZOrder" xml:space="preserve">
|
||||
<value>3</value>
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name="connectButton.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
@@ -298,7 +328,7 @@
|
||||
<value>topPanel</value>
|
||||
</data>
|
||||
<data name=">>connectButton.ZOrder" xml:space="preserve">
|
||||
<value>4</value>
|
||||
<value>5</value>
|
||||
</data>
|
||||
<data name="topPanel.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||
<value>Top</value>
|
||||
@@ -363,6 +393,9 @@
|
||||
<data name=">>consoleMessage.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<metadata name="consoleTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>385, 17</value>
|
||||
</metadata>
|
||||
<data name="resizeKvmControl.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||
<value>Fill</value>
|
||||
</data>
|
||||
@@ -379,7 +412,7 @@
|
||||
<value>resizeKvmControl</value>
|
||||
</data>
|
||||
<data name=">>resizeKvmControl.Type" xml:space="preserve">
|
||||
<value>MeshCentralRouter.KVMResizeControl, MeshCentralRouter, Version=1.0.7531.27756, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>MeshCentralRouter.KVMResizeControl, MeshCentralRouter, Version=1.0.7533.35016, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>resizeKvmControl.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
@@ -387,9 +420,6 @@
|
||||
<data name=">>resizeKvmControl.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<metadata name="consoleTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>385, 17</value>
|
||||
</metadata>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
|
||||
20
MapUserControl.Designer.cs
generated
20
MapUserControl.Designer.cs
generated
@@ -36,7 +36,10 @@
|
||||
this.appButton = new System.Windows.Forms.Button();
|
||||
this.closeButton = new System.Windows.Forms.Button();
|
||||
this.deviceImageList = new System.Windows.Forms.ImageList(this.components);
|
||||
this.mainContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.statsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
((System.ComponentModel.ISupportInitialize)(this.devicePictureBox)).BeginInit();
|
||||
this.mainContextMenuStrip.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// devicePictureBox
|
||||
@@ -83,12 +86,26 @@
|
||||
this.deviceImageList.Images.SetKeyName(6, "icons07.png");
|
||||
this.deviceImageList.Images.SetKeyName(7, "icons08.png");
|
||||
//
|
||||
// mainContextMenuStrip
|
||||
//
|
||||
this.mainContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.statsToolStripMenuItem});
|
||||
this.mainContextMenuStrip.Name = "mainContextMenuStrip";
|
||||
resources.ApplyResources(this.mainContextMenuStrip, "mainContextMenuStrip");
|
||||
//
|
||||
// statsToolStripMenuItem
|
||||
//
|
||||
this.statsToolStripMenuItem.Name = "statsToolStripMenuItem";
|
||||
resources.ApplyResources(this.statsToolStripMenuItem, "statsToolStripMenuItem");
|
||||
this.statsToolStripMenuItem.Click += new System.EventHandler(this.statsToolStripMenuItem_Click);
|
||||
//
|
||||
// MapUserControl
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.SystemColors.ControlLight;
|
||||
this.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.ContextMenuStrip = this.mainContextMenuStrip;
|
||||
this.Controls.Add(this.closeButton);
|
||||
this.Controls.Add(this.appButton);
|
||||
this.Controls.Add(this.routingStatusLabel);
|
||||
@@ -96,6 +113,7 @@
|
||||
this.Controls.Add(this.devicePictureBox);
|
||||
this.Name = "MapUserControl";
|
||||
((System.ComponentModel.ISupportInitialize)(this.devicePictureBox)).EndInit();
|
||||
this.mainContextMenuStrip.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
@@ -108,5 +126,7 @@
|
||||
private System.Windows.Forms.Button appButton;
|
||||
private System.Windows.Forms.Button closeButton;
|
||||
private System.Windows.Forms.ImageList deviceImageList;
|
||||
private System.Windows.Forms.ContextMenuStrip mainContextMenuStrip;
|
||||
private System.Windows.Forms.ToolStripMenuItem statsToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace MeshCentralRouter
|
||||
public string certhash;
|
||||
public bool xdebug = false;
|
||||
public bool inaddrany = false;
|
||||
public MappingStats stats = null;
|
||||
|
||||
public static void saveToRegistry(string name, string value)
|
||||
{
|
||||
@@ -73,9 +74,8 @@ namespace MeshCentralRouter
|
||||
{
|
||||
routingStatusLabel.Text = Properties.Resources.Stopped;
|
||||
appButton.Enabled = false;
|
||||
mapper.onStateMsgChanged -= Mapper_onStateMsgChanged;
|
||||
mapper.stop();
|
||||
mapper = null;
|
||||
if (mapper != null) { mapper.onStateMsgChanged -= Mapper_onStateMsgChanged; mapper.stop(); mapper = null; }
|
||||
if (stats != null) { stats.Close(); stats = null; }
|
||||
}
|
||||
|
||||
private void Mapper_onStateMsgChanged(string statemsg)
|
||||
@@ -162,12 +162,26 @@ namespace MeshCentralRouter
|
||||
|
||||
private void closeButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (mapper != null)
|
||||
{
|
||||
mapper.stop();
|
||||
mapper = null;
|
||||
}
|
||||
if (stats != null) { stats.Close(); stats = null; }
|
||||
if (mapper != null) { mapper.stop(); mapper = null; }
|
||||
parent.removeMap(this);
|
||||
}
|
||||
|
||||
private void statsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (stats == null) {
|
||||
stats = new MappingStats(this);
|
||||
stats.Show(this);
|
||||
} else {
|
||||
stats.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
public void closeStats()
|
||||
{
|
||||
if (stats == null) return;
|
||||
stats.Close();
|
||||
stats = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>devicePictureBox.ZOrder" xml:space="preserve">
|
||||
<value>4</value>
|
||||
<value>5</value>
|
||||
</data>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="deviceNameLabel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
@@ -172,7 +172,7 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>deviceNameLabel.ZOrder" xml:space="preserve">
|
||||
<value>3</value>
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name="routingStatusLabel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Left, Right</value>
|
||||
@@ -202,7 +202,7 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>routingStatusLabel.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="appButton.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
@@ -229,7 +229,7 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>appButton.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="closeButton.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
@@ -256,7 +256,7 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>closeButton.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
<value>1</value>
|
||||
</data>
|
||||
<metadata name="deviceImageList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
@@ -266,7 +266,7 @@
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAy
|
||||
mgAAAk1TRnQBSQFMAgEBCAEAAUABAAFAAQABMgEAATIBAAT/AREBAAj/AUIBTQE2BwABNgMAASgDAAHI
|
||||
mgAAAk1TRnQBSQFMAgEBCAEAAUgBAAFIAQABMgEAATIBAAT/AREBAAj/AUIBTQE2BwABNgMAASgDAAHI
|
||||
AwABlgMAAQEBAAEQBQABYAHq/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A
|
||||
/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A
|
||||
/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A
|
||||
@@ -926,6 +926,24 @@
|
||||
Df8B/AMAAT8H/wMADf8B/AMAAT8H/wMADf8B/gMACP8DAA7/AgABDwj/AwAO/wH8AT8J/wMAGf8DAAs=
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="mainContextMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>156, 17</value>
|
||||
</metadata>
|
||||
<data name="statsToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>152, 22</value>
|
||||
</data>
|
||||
<data name="statsToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Stats...</value>
|
||||
</data>
|
||||
<data name="mainContextMenuStrip.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>153, 48</value>
|
||||
</data>
|
||||
<data name=">>mainContextMenuStrip.Name" xml:space="preserve">
|
||||
<value>mainContextMenuStrip</value>
|
||||
</data>
|
||||
<data name=">>mainContextMenuStrip.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
@@ -933,7 +951,7 @@
|
||||
<value>6, 13</value>
|
||||
</data>
|
||||
<data name="$this.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>433, 60</value>
|
||||
<value>429, 56</value>
|
||||
</data>
|
||||
<data name=">>deviceImageList.Name" xml:space="preserve">
|
||||
<value>deviceImageList</value>
|
||||
@@ -941,6 +959,12 @@
|
||||
<data name=">>deviceImageList.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ImageList, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>statsToolStripMenuItem.Name" xml:space="preserve">
|
||||
<value>statsToolStripMenuItem</value>
|
||||
</data>
|
||||
<data name=">>statsToolStripMenuItem.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>$this.Name" xml:space="preserve">
|
||||
<value>MapUserControl</value>
|
||||
</data>
|
||||
|
||||
187
MappingStats.Designer.cs
generated
Normal file
187
MappingStats.Designer.cs
generated
Normal file
@@ -0,0 +1,187 @@
|
||||
namespace MeshCentralRouter
|
||||
{
|
||||
partial class MappingStats
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MappingStats));
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.label12 = new System.Windows.Forms.Label();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.outRatioLabel = new System.Windows.Forms.Label();
|
||||
this.inRatioLabel = new System.Windows.Forms.Label();
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.label11 = new System.Windows.Forms.Label();
|
||||
this.kvmCompOutBytesLabel = new System.Windows.Forms.Label();
|
||||
this.kvmCompInBytesLabel = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.kvmOutBytesLabel = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.kvmInBytesLabel = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.refreshTimer = new System.Windows.Forms.Timer(this.components);
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
resources.ApplyResources(this.okButton, "okButton");
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// label12
|
||||
//
|
||||
resources.ApplyResources(this.label12, "label12");
|
||||
this.label12.Name = "label12";
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
resources.ApplyResources(this.groupBox1, "groupBox1");
|
||||
this.groupBox1.Controls.Add(this.outRatioLabel);
|
||||
this.groupBox1.Controls.Add(this.inRatioLabel);
|
||||
this.groupBox1.Controls.Add(this.label10);
|
||||
this.groupBox1.Controls.Add(this.label11);
|
||||
this.groupBox1.Controls.Add(this.kvmCompOutBytesLabel);
|
||||
this.groupBox1.Controls.Add(this.kvmCompInBytesLabel);
|
||||
this.groupBox1.Controls.Add(this.label2);
|
||||
this.groupBox1.Controls.Add(this.label12);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.TabStop = false;
|
||||
//
|
||||
// outRatioLabel
|
||||
//
|
||||
resources.ApplyResources(this.outRatioLabel, "outRatioLabel");
|
||||
this.outRatioLabel.Name = "outRatioLabel";
|
||||
//
|
||||
// inRatioLabel
|
||||
//
|
||||
resources.ApplyResources(this.inRatioLabel, "inRatioLabel");
|
||||
this.inRatioLabel.Name = "inRatioLabel";
|
||||
//
|
||||
// label10
|
||||
//
|
||||
resources.ApplyResources(this.label10, "label10");
|
||||
this.label10.Name = "label10";
|
||||
//
|
||||
// label11
|
||||
//
|
||||
resources.ApplyResources(this.label11, "label11");
|
||||
this.label11.Name = "label11";
|
||||
//
|
||||
// kvmCompOutBytesLabel
|
||||
//
|
||||
resources.ApplyResources(this.kvmCompOutBytesLabel, "kvmCompOutBytesLabel");
|
||||
this.kvmCompOutBytesLabel.Name = "kvmCompOutBytesLabel";
|
||||
//
|
||||
// kvmCompInBytesLabel
|
||||
//
|
||||
resources.ApplyResources(this.kvmCompInBytesLabel, "kvmCompInBytesLabel");
|
||||
this.kvmCompInBytesLabel.Name = "kvmCompInBytesLabel";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
resources.ApplyResources(this.label2, "label2");
|
||||
this.label2.Name = "label2";
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
resources.ApplyResources(this.groupBox2, "groupBox2");
|
||||
this.groupBox2.Controls.Add(this.kvmOutBytesLabel);
|
||||
this.groupBox2.Controls.Add(this.label3);
|
||||
this.groupBox2.Controls.Add(this.kvmInBytesLabel);
|
||||
this.groupBox2.Controls.Add(this.label4);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.TabStop = false;
|
||||
//
|
||||
// kvmOutBytesLabel
|
||||
//
|
||||
resources.ApplyResources(this.kvmOutBytesLabel, "kvmOutBytesLabel");
|
||||
this.kvmOutBytesLabel.Name = "kvmOutBytesLabel";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
resources.ApplyResources(this.label3, "label3");
|
||||
this.label3.Name = "label3";
|
||||
//
|
||||
// kvmInBytesLabel
|
||||
//
|
||||
resources.ApplyResources(this.kvmInBytesLabel, "kvmInBytesLabel");
|
||||
this.kvmInBytesLabel.Name = "kvmInBytesLabel";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
resources.ApplyResources(this.label4, "label4");
|
||||
this.label4.Name = "label4";
|
||||
//
|
||||
// refreshTimer
|
||||
//
|
||||
this.refreshTimer.Interval = 500;
|
||||
this.refreshTimer.Tick += new System.EventHandler(this.refreshTimer_Tick);
|
||||
//
|
||||
// MappingStats
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.groupBox2);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "MappingStats";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.KVMStats_FormClosing);
|
||||
this.Load += new System.EventHandler(this.KVMStats_Load);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.Label label12;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.Label outRatioLabel;
|
||||
private System.Windows.Forms.Label inRatioLabel;
|
||||
private System.Windows.Forms.Label label10;
|
||||
private System.Windows.Forms.Label label11;
|
||||
private System.Windows.Forms.Label kvmCompOutBytesLabel;
|
||||
private System.Windows.Forms.Label kvmCompInBytesLabel;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private System.Windows.Forms.Label kvmOutBytesLabel;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Label kvmInBytesLabel;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.Timer refreshTimer;
|
||||
}
|
||||
}
|
||||
51
MappingStats.cs
Normal file
51
MappingStats.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MeshCentralRouter
|
||||
{
|
||||
public partial class MappingStats : Form
|
||||
{
|
||||
public MapUserControl mapControl;
|
||||
|
||||
public MappingStats(MapUserControl mapControl)
|
||||
{
|
||||
this.mapControl = mapControl;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void refreshTimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
kvmInBytesLabel.Text = string.Format(((mapControl.mapper.bytesToClient == 1)?"{0} Byte":"{0} Bytes"), mapControl.mapper.bytesToClient);
|
||||
kvmOutBytesLabel.Text = string.Format(((mapControl.mapper.bytesToServer == 1) ? "{0} Byte" : "{0} Bytes"), mapControl.mapper.bytesToServer);
|
||||
kvmCompInBytesLabel.Text = string.Format(((mapControl.mapper.bytesToClientCompressed == 1) ? "{0} Byte" : "{0} Bytes"), mapControl.mapper.bytesToClientCompressed);
|
||||
kvmCompOutBytesLabel.Text = string.Format(((mapControl.mapper.bytesToServerCompressed == 1) ? "{0} Byte" : "{0} Bytes"), mapControl.mapper.bytesToServerCompressed);
|
||||
if (mapControl.mapper.bytesToClient == 0) {
|
||||
inRatioLabel.Text = "0%";
|
||||
} else {
|
||||
inRatioLabel.Text = (100 - ((mapControl.mapper.bytesToClientCompressed * 100) / mapControl.mapper.bytesToClient)) + "%";
|
||||
}
|
||||
if (mapControl.mapper.bytesToServer == 0) {
|
||||
outRatioLabel.Text = "0%";
|
||||
} else {
|
||||
outRatioLabel.Text = (100 - ((mapControl.mapper.bytesToServerCompressed * 100) / mapControl.mapper.bytesToServer)) + "%";
|
||||
}
|
||||
}
|
||||
|
||||
private void KVMStats_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
refreshTimer.Enabled = false;
|
||||
}
|
||||
|
||||
private void KVMStats_Load(object sender, EventArgs e)
|
||||
{
|
||||
refreshTimer.Enabled = true;
|
||||
refreshTimer_Tick(this, null);
|
||||
Text += " - " + mapControl.node.name;
|
||||
}
|
||||
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
mapControl.closeStats();
|
||||
}
|
||||
}
|
||||
}
|
||||
2438
MappingStats.resx
Normal file
2438
MappingStats.resx
Normal file
File diff suppressed because it is too large
Load Diff
@@ -124,6 +124,18 @@
|
||||
<Compile Include="KVMSettingsForm.Designer.cs">
|
||||
<DependentUpon>KVMSettingsForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MappingStats.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MappingStats.Designer.cs">
|
||||
<DependentUpon>MappingStats.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="KVMStats.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="KVMStats.Designer.cs">
|
||||
<DependentUpon>KVMStats.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="KVMViewer.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -428,6 +440,12 @@
|
||||
<EmbeddedResource Include="KVMSettingsForm.resx">
|
||||
<DependentUpon>KVMSettingsForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="MappingStats.resx">
|
||||
<DependentUpon>MappingStats.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="KVMStats.resx">
|
||||
<DependentUpon>KVMStats.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="KVMViewer.resx">
|
||||
<DependentUpon>KVMViewer.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
||||
@@ -225,6 +225,18 @@ namespace MeshCentralRouter
|
||||
private void Wc_onStateChanged(webSocketClient sender, webSocketClient.ConnectionStates state)
|
||||
{
|
||||
Debug("#" + sender.id + ": Websocket mapping, connected to server.");
|
||||
switch (state)
|
||||
{
|
||||
case webSocketClient.ConnectionStates.Disconnected:
|
||||
{
|
||||
if (sender.tag.GetType() == typeof(TcpClient)) {
|
||||
ShutdownClients((TcpClient)sender.tag, null, sender, sender.id);
|
||||
} else if (sender.tag.GetType() == typeof(UdpClient)) {
|
||||
ShutdownClients(null, (UdpClient)sender.tag, sender, sender.id);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Wc_onStringData(webSocketClient sender, string data, int orglen)
|
||||
@@ -318,7 +330,7 @@ namespace MeshCentralRouter
|
||||
// Forward the data & read again
|
||||
try
|
||||
{
|
||||
mm.bytesToServer += buf.Length;
|
||||
mm.bytesToServer += len;
|
||||
mm.bytesToServerCompressed += wc.SendBinary(buf, 0, len); // TODO: Do Async
|
||||
try { client.GetStream().BeginRead(buf, 0, buf.Length, new AsyncCallback(ClientEndReadWS), new object[] { mm, wc, client, buf }); } catch (Exception) { }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user