mirror of
https://github.com/Ylianst/MeshCentralRouter
synced 2025-12-06 00:13:33 +00:00
Added automatic clipboard sync.
This commit is contained in:
@@ -38,7 +38,8 @@ namespace MeshCentralRouter
|
||||
private int scalinglevel = 1024; // 100% scale
|
||||
private int frameRate = 100; // Medium frame rate
|
||||
private bool swamMouseButtons = false;
|
||||
private bool remoteKeybaordMap = false;
|
||||
private bool remoteKeyboardMap = false;
|
||||
private bool autoSendClipboard = false;
|
||||
private double scalefactor = 1;
|
||||
public List<string> displays = new List<string>();
|
||||
public ushort currentDisp = 0;
|
||||
@@ -111,7 +112,8 @@ namespace MeshCentralRouter
|
||||
public int ScalingLevel { get { return scalinglevel; } set { scalinglevel = value; SendCompressionLevel(); } }
|
||||
public int FrameRate { get { return frameRate; } set { frameRate = value; SendCompressionLevel(); } }
|
||||
public bool SwamMouseButtons { get { return swamMouseButtons; } set { swamMouseButtons = value; } }
|
||||
public bool RemoteKeybaordMap { get { return remoteKeybaordMap; } set { remoteKeybaordMap = value; } }
|
||||
public bool RemoteKeyboardMap { get { return remoteKeyboardMap; } set { remoteKeyboardMap = value; } }
|
||||
public bool AutoSendClipboard { get { return autoSendClipboard; } set { autoSendClipboard = value; } }
|
||||
|
||||
public double ScaleFactor { get { return scalefactor; } set { scalefactor = value; } }
|
||||
|
||||
@@ -409,7 +411,7 @@ namespace MeshCentralRouter
|
||||
{
|
||||
//if (state != ConnectState.Connected) return;
|
||||
|
||||
if (remoteKeybaordMap == true) return;
|
||||
if (remoteKeyboardMap == true) return;
|
||||
|
||||
if (killNextKeyPress > 0)
|
||||
{
|
||||
@@ -432,7 +434,7 @@ namespace MeshCentralRouter
|
||||
{
|
||||
//if (state != ConnectState.Connected) return;
|
||||
|
||||
if (remoteKeybaordMap == true) { SendKey((byte)e.KeyCode, action); return; } // Use old key system that uses the remote keyboard mapping.
|
||||
if (remoteKeyboardMap == true) { SendKey((byte)e.KeyCode, action); return; } // Use old key system that uses the remote keyboard mapping.
|
||||
string keycode = e.KeyCode.ToString();
|
||||
if ((action == 0) && (e.Control == false) && (e.Alt == false) && (((e.KeyValue >= 48) && (e.KeyValue <= 57)) || (keycode.Length == 1) || (keycode.StartsWith("Oem") == true))) return;
|
||||
if ((e.Control == true) || (e.Alt == true)) { killNextKeyPress = DateTime.Now.Ticks; }
|
||||
|
||||
9
KVMSettingsForm.Designer.cs
generated
9
KVMSettingsForm.Designer.cs
generated
@@ -42,6 +42,7 @@
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.autoSendClipboardCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.groupBox1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
@@ -64,6 +65,7 @@
|
||||
// groupBox1
|
||||
//
|
||||
resources.ApplyResources(this.groupBox1, "groupBox1");
|
||||
this.groupBox1.Controls.Add(this.autoSendClipboardCheckBox);
|
||||
this.groupBox1.Controls.Add(this.remoteKeyboardMapCheckBox);
|
||||
this.groupBox1.Controls.Add(this.swapMouseButtonsCheckBox);
|
||||
this.groupBox1.Controls.Add(this.frameRateComboBox);
|
||||
@@ -135,6 +137,12 @@
|
||||
resources.ApplyResources(this.label4, "label4");
|
||||
this.label4.Name = "label4";
|
||||
//
|
||||
// autoSendClipboardCheckBox
|
||||
//
|
||||
resources.ApplyResources(this.autoSendClipboardCheckBox, "autoSendClipboardCheckBox");
|
||||
this.autoSendClipboardCheckBox.Name = "autoSendClipboardCheckBox";
|
||||
this.autoSendClipboardCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// KVMSettingsForm
|
||||
//
|
||||
this.AcceptButton = this.okButton;
|
||||
@@ -173,5 +181,6 @@
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.CheckBox swapMouseButtonsCheckBox;
|
||||
private System.Windows.Forms.CheckBox remoteKeyboardMapCheckBox;
|
||||
private System.Windows.Forms.CheckBox autoSendClipboardCheckBox;
|
||||
}
|
||||
}
|
||||
@@ -120,11 +120,16 @@ namespace MeshCentralRouter
|
||||
set { swapMouseButtonsCheckBox.Checked = value; }
|
||||
}
|
||||
|
||||
public bool RemoteKeybaordMap
|
||||
public bool RemoteKeyboardMap
|
||||
{
|
||||
get { return remoteKeyboardMapCheckBox.Checked; }
|
||||
set { remoteKeyboardMapCheckBox.Checked = value; }
|
||||
}
|
||||
public bool AutoSendClipboard
|
||||
{
|
||||
get { return autoSendClipboardCheckBox.Checked; }
|
||||
set { autoSendClipboardCheckBox.Checked = value; }
|
||||
}
|
||||
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
</data>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="cancelButton.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>312, 236</value>
|
||||
<value>312, 254</value>
|
||||
</data>
|
||||
<data name="cancelButton.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>75, 23</value>
|
||||
@@ -151,7 +151,7 @@
|
||||
<value>Bottom, Right</value>
|
||||
</data>
|
||||
<data name="okButton.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>231, 236</value>
|
||||
<value>231, 254</value>
|
||||
</data>
|
||||
<data name="okButton.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>75, 23</value>
|
||||
@@ -177,6 +177,36 @@
|
||||
<data name="groupBox1.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Bottom, Left, Right</value>
|
||||
</data>
|
||||
<data name="autoSendClipboardCheckBox.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="autoSendClipboardCheckBox.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="autoSendClipboardCheckBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>128, 151</value>
|
||||
</data>
|
||||
<data name="autoSendClipboardCheckBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>163, 17</value>
|
||||
</data>
|
||||
<data name="autoSendClipboardCheckBox.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>9</value>
|
||||
</data>
|
||||
<data name="autoSendClipboardCheckBox.Text" xml:space="preserve">
|
||||
<value>Automatically Send Clipboard</value>
|
||||
</data>
|
||||
<data name=">>autoSendClipboardCheckBox.Name" xml:space="preserve">
|
||||
<value>autoSendClipboardCheckBox</value>
|
||||
</data>
|
||||
<data name=">>autoSendClipboardCheckBox.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>autoSendClipboardCheckBox.Parent" xml:space="preserve">
|
||||
<value>groupBox1</value>
|
||||
</data>
|
||||
<data name=">>autoSendClipboardCheckBox.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="remoteKeyboardMapCheckBox.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
@@ -205,7 +235,7 @@
|
||||
<value>groupBox1</value>
|
||||
</data>
|
||||
<data name=">>remoteKeyboardMapCheckBox.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="swapMouseButtonsCheckBox.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
@@ -232,7 +262,7 @@
|
||||
<value>groupBox1</value>
|
||||
</data>
|
||||
<data name=">>swapMouseButtonsCheckBox.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="frameRateComboBox.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Left, Right</value>
|
||||
@@ -256,7 +286,7 @@
|
||||
<value>groupBox1</value>
|
||||
</data>
|
||||
<data name=">>frameRateComboBox.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="label2.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
@@ -283,7 +313,7 @@
|
||||
<value>groupBox1</value>
|
||||
</data>
|
||||
<data name=">>label2.ZOrder" xml:space="preserve">
|
||||
<value>3</value>
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name="scalingComboBox.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Left, Right</value>
|
||||
@@ -307,7 +337,7 @@
|
||||
<value>groupBox1</value>
|
||||
</data>
|
||||
<data name=">>scalingComboBox.ZOrder" xml:space="preserve">
|
||||
<value>4</value>
|
||||
<value>5</value>
|
||||
</data>
|
||||
<data name="label1.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
@@ -334,7 +364,7 @@
|
||||
<value>groupBox1</value>
|
||||
</data>
|
||||
<data name=">>label1.ZOrder" xml:space="preserve">
|
||||
<value>5</value>
|
||||
<value>6</value>
|
||||
</data>
|
||||
<data name="qualityComboBox.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Left, Right</value>
|
||||
@@ -361,7 +391,7 @@
|
||||
<value>groupBox1</value>
|
||||
</data>
|
||||
<data name=">>qualityComboBox.ZOrder" xml:space="preserve">
|
||||
<value>6</value>
|
||||
<value>7</value>
|
||||
</data>
|
||||
<data name="label3.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
@@ -388,13 +418,13 @@
|
||||
<value>groupBox1</value>
|
||||
</data>
|
||||
<data name=">>label3.ZOrder" xml:space="preserve">
|
||||
<value>7</value>
|
||||
<value>8</value>
|
||||
</data>
|
||||
<data name="groupBox1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>12, 68</value>
|
||||
</data>
|
||||
<data name="groupBox1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>375, 162</value>
|
||||
<value>375, 180</value>
|
||||
</data>
|
||||
<data name="groupBox1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>2</value>
|
||||
@@ -472,7 +502,7 @@
|
||||
<value>6, 13</value>
|
||||
</data>
|
||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>399, 271</value>
|
||||
<value>399, 289</value>
|
||||
</data>
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
|
||||
57
KVMViewer.cs
57
KVMViewer.cs
@@ -26,6 +26,7 @@ namespace MeshCentralRouter
|
||||
{
|
||||
public partial class KVMViewer : Form
|
||||
{
|
||||
private MainForm parent = null;
|
||||
private KVMControl kvmControl = null;
|
||||
private KVMStats kvmStats = null;
|
||||
private MeshCentralServer server = null;
|
||||
@@ -37,14 +38,19 @@ namespace MeshCentralRouter
|
||||
public int consentFlags = 0;
|
||||
public webSocketClient wc = null;
|
||||
public Dictionary<string, int> userSessions = null;
|
||||
private string lastClipboardSent = null;
|
||||
private DateTime lastClipboardTime = DateTime.MinValue;
|
||||
|
||||
// Stats
|
||||
public long bytesIn = 0;
|
||||
public long bytesInCompressed = 0;
|
||||
public long bytesOut = 0;
|
||||
public long bytesOutCompressed = 0;
|
||||
|
||||
public KVMViewer(MeshCentralServer server, NodeClass node)
|
||||
|
||||
public KVMViewer(MainForm parent, MeshCentralServer server, NodeClass node)
|
||||
{
|
||||
this.parent = parent;
|
||||
InitializeComponent();
|
||||
Translate.TranslateControl(this);
|
||||
this.Text += " - " + node.name;
|
||||
@@ -56,6 +62,7 @@ namespace MeshCentralRouter
|
||||
resizeKvmControl.ZoomToFit = true;
|
||||
UpdateStatus();
|
||||
this.MouseWheel += MainForm_MouseWheel;
|
||||
parent.ClipboardChanged += Parent_ClipboardChanged;
|
||||
|
||||
mainToolTip.SetToolTip(connectButton, Translate.T(Properties.Resources.ToggleRemoteDesktopConnection));
|
||||
mainToolTip.SetToolTip(cadButton, Translate.T(Properties.Resources.SendCtrlAltDelToRemoteDevice));
|
||||
@@ -64,6 +71,29 @@ namespace MeshCentralRouter
|
||||
mainToolTip.SetToolTip(clipInboundButton, Translate.T(Properties.Resources.PullClipboardFromRemoteDevice));
|
||||
mainToolTip.SetToolTip(zoomButton, Translate.T(Properties.Resources.ToggleZoomToFitMode));
|
||||
mainToolTip.SetToolTip(statsButton, Translate.T(Properties.Resources.DisplayConnectionStatistics));
|
||||
kvmControl.AutoSendClipboard = Settings.GetRegValue("kvmAutoClipboard", "0").Equals("1");
|
||||
}
|
||||
|
||||
private void Parent_ClipboardChanged()
|
||||
{
|
||||
if (state != 3) return;
|
||||
if (kvmControl.AutoSendClipboard) { SendClipboard(); }
|
||||
}
|
||||
|
||||
private delegate void SendClipboardHandler();
|
||||
|
||||
private void SendClipboard()
|
||||
{
|
||||
if (this.InvokeRequired) { this.Invoke(new SendClipboardHandler(SendClipboard)); return; }
|
||||
string textData = (string)Clipboard.GetData(DataFormats.Text);
|
||||
if (textData != null)
|
||||
{
|
||||
if ((DateTime.Now.Subtract(lastClipboardTime).TotalSeconds < 20) && (lastClipboardSent != null) && (lastClipboardSent.Equals(textData))) return; // Don't resend clipboard if same and sent in last 20 seconds. This avoids clipboard loop.
|
||||
string textData2 = textData.Replace("\\", "\\\\").Replace("\"", "\\\"");
|
||||
server.sendCommand("{\"action\":\"msg\",\"type\":\"setclip\",\"nodeid\":\"" + node.nodeid + "\",\"data\":\"" + textData2 + "\"}");
|
||||
lastClipboardTime = DateTime.Now;
|
||||
lastClipboardSent = textData;
|
||||
}
|
||||
}
|
||||
|
||||
private void KvmControl_DesktopSizeChanged(object sender, EventArgs e)
|
||||
@@ -203,6 +233,10 @@ namespace MeshCentralRouter
|
||||
kvmControl.SendRefresh();
|
||||
UpdateStatus();
|
||||
displayMessage(null);
|
||||
|
||||
// Send clipboard
|
||||
if (kvmControl.AutoSendClipboard) { SendClipboard(); }
|
||||
|
||||
return;
|
||||
}
|
||||
if (state != 3) return;
|
||||
@@ -312,6 +346,8 @@ namespace MeshCentralRouter
|
||||
}
|
||||
|
||||
cadButton.Enabled = (state == 3);
|
||||
clipInboundButton.Visible = !kvmControl.AutoSendClipboard;
|
||||
clipOutboundButton.Visible = !kvmControl.AutoSendClipboard;
|
||||
clipInboundButton.Enabled = (state == 3);
|
||||
clipOutboundButton.Enabled = (state == 3);
|
||||
}
|
||||
@@ -360,12 +396,20 @@ namespace MeshCentralRouter
|
||||
form.Scaling = kvmControl.ScalingLevel;
|
||||
form.FrameRate = kvmControl.FrameRate;
|
||||
form.SwamMouseButtons = kvmControl.SwamMouseButtons;
|
||||
form.RemoteKeybaordMap = kvmControl.RemoteKeybaordMap;
|
||||
form.RemoteKeyboardMap = kvmControl.RemoteKeyboardMap;
|
||||
form.AutoSendClipboard = kvmControl.AutoSendClipboard;
|
||||
if (form.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
|
||||
{
|
||||
kvmControl.SetCompressionParams(form.Compression, form.Scaling, form.FrameRate);
|
||||
kvmControl.SwamMouseButtons = form.SwamMouseButtons;
|
||||
kvmControl.RemoteKeybaordMap = form.RemoteKeybaordMap;
|
||||
kvmControl.RemoteKeyboardMap = form.RemoteKeyboardMap;
|
||||
if (kvmControl.AutoSendClipboard != form.AutoSendClipboard)
|
||||
{
|
||||
kvmControl.AutoSendClipboard = form.AutoSendClipboard;
|
||||
Settings.SetRegValue("kvmAutoClipboard", kvmControl.AutoSendClipboard ? "1" : "0");
|
||||
if (kvmControl.AutoSendClipboard == true) { Parent_ClipboardChanged(); }
|
||||
}
|
||||
UpdateStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -514,12 +558,7 @@ namespace MeshCentralRouter
|
||||
|
||||
private void clipOutboundButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
string textData = (string)Clipboard.GetData(DataFormats.Text);
|
||||
if (textData != null)
|
||||
{
|
||||
textData = textData.Replace("\\", "\\\\").Replace("\"", "\\\"");
|
||||
server.sendCommand("{\"action\":\"msg\",\"type\":\"setclip\",\"nodeid\":\"" + node.nodeid + "\",\"data\":\"" + textData + "\"}");
|
||||
}
|
||||
SendClipboard();
|
||||
}
|
||||
|
||||
private void resizeKvmControl_Enter(object sender, EventArgs e)
|
||||
|
||||
@@ -121,13 +121,31 @@
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="mainToolStripStatusLabel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>1029, 17</value>
|
||||
</data>
|
||||
<data name="mainToolStripStatusLabel.Text" xml:space="preserve">
|
||||
<value>---</value>
|
||||
</data>
|
||||
<data name="mainToolStripStatusLabel.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<value>MiddleLeft</value>
|
||||
</data>
|
||||
<data name="toolStripStatusLabel1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>13, 17</value>
|
||||
</data>
|
||||
<data name="toolStripStatusLabel1.Text" xml:space="preserve">
|
||||
<value>v</value>
|
||||
</data>
|
||||
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="toolStripStatusLabel1.Visible" type="System.Boolean, mscorlib">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="mainStatusStrip.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>0, 727</value>
|
||||
</data>
|
||||
<data name="mainStatusStrip.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>1044, 22</value>
|
||||
</data>
|
||||
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="mainStatusStrip.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>9</value>
|
||||
</data>
|
||||
@@ -146,36 +164,21 @@
|
||||
<data name=">>mainStatusStrip.ZOrder" xml:space="preserve">
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name="mainToolStripStatusLabel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>1029, 17</value>
|
||||
</data>
|
||||
<data name="mainToolStripStatusLabel.Text" xml:space="preserve">
|
||||
<value>---</value>
|
||||
</data>
|
||||
<data name="mainToolStripStatusLabel.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<value>MiddleLeft</value>
|
||||
</data>
|
||||
<data name="toolStripStatusLabel1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>13, 17</value>
|
||||
</data>
|
||||
<data name="toolStripStatusLabel1.Text" xml:space="preserve">
|
||||
<value>v</value>
|
||||
</data>
|
||||
<data name="toolStripStatusLabel1.Visible" type="System.Boolean, mscorlib">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<metadata name="updateTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>154, 17</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="clipOutboundButton.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="clipOutboundButton.Enabled" type="System.Boolean, mscorlib">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="clipOutboundButton.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="clipOutboundButton.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>288, 3</value>
|
||||
<value>881, 3</value>
|
||||
</data>
|
||||
<data name="clipOutboundButton.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>30, 26</value>
|
||||
@@ -195,9 +198,9 @@
|
||||
<data name=">>clipOutboundButton.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<metadata name="mainToolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>399, 17</value>
|
||||
</metadata>
|
||||
<data name="clipInboundButton.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="clipInboundButton.Enabled" type="System.Boolean, mscorlib">
|
||||
<value>False</value>
|
||||
</data>
|
||||
@@ -205,7 +208,7 @@
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="clipInboundButton.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>324, 3</value>
|
||||
<value>917, 3</value>
|
||||
</data>
|
||||
<data name="clipInboundButton.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>30, 26</value>
|
||||
@@ -213,6 +216,9 @@
|
||||
<data name="clipInboundButton.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>4</value>
|
||||
</data>
|
||||
<metadata name="mainToolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>399, 17</value>
|
||||
</metadata>
|
||||
<data name="clipInboundButton.ToolTip" xml:space="preserve">
|
||||
<value>Pull clipboard from remote device</value>
|
||||
</data>
|
||||
@@ -262,7 +268,7 @@
|
||||
<value>13</value>
|
||||
</data>
|
||||
<data name="displaySelectComboBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>360, 5</value>
|
||||
<value>288, 5</value>
|
||||
</data>
|
||||
<data name="displaySelectComboBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>128, 21</value>
|
||||
@@ -372,6 +378,24 @@
|
||||
<metadata name="consentContextMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>518, 17</value>
|
||||
</metadata>
|
||||
<data name="askConsentBarToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>171, 22</value>
|
||||
</data>
|
||||
<data name="askConsentBarToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Ask Consent + Bar</value>
|
||||
</data>
|
||||
<data name="askConsentToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>171, 22</value>
|
||||
</data>
|
||||
<data name="askConsentToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Ask Consent</value>
|
||||
</data>
|
||||
<data name="privacyBarToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>171, 22</value>
|
||||
</data>
|
||||
<data name="privacyBarToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Privacy Bar</value>
|
||||
</data>
|
||||
<data name="consentContextMenuStrip.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>172, 70</value>
|
||||
</data>
|
||||
@@ -435,24 +459,6 @@
|
||||
<data name=">>topPanel.ZOrder" xml:space="preserve">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="askConsentBarToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>171, 22</value>
|
||||
</data>
|
||||
<data name="askConsentBarToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Ask Consent + Bar</value>
|
||||
</data>
|
||||
<data name="askConsentToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>171, 22</value>
|
||||
</data>
|
||||
<data name="askConsentToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Ask Consent</value>
|
||||
</data>
|
||||
<data name="privacyBarToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>171, 22</value>
|
||||
</data>
|
||||
<data name="privacyBarToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Privacy Bar</value>
|
||||
</data>
|
||||
<data name="consoleMessage.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
@@ -492,9 +498,6 @@
|
||||
<metadata name="consoleTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>275, 17</value>
|
||||
</metadata>
|
||||
<metadata name="mainToolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>399, 17</value>
|
||||
</metadata>
|
||||
<data name="resizeKvmControl.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||
<value>Fill</value>
|
||||
</data>
|
||||
@@ -511,7 +514,7 @@
|
||||
<value>resizeKvmControl</value>
|
||||
</data>
|
||||
<data name=">>resizeKvmControl.Type" xml:space="preserve">
|
||||
<value>MeshCentralRouter.KVMResizeControl, MeshCentralRouter, Version=1.7.7822.29844, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>MeshCentralRouter.KVMResizeControl, MeshCentralRouter, Version=1.7.7835.29677, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>resizeKvmControl.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
|
||||
30
MainForm.cs
30
MainForm.cs
@@ -57,6 +57,31 @@ namespace MeshCentralRouter
|
||||
public int deviceDoubleClickAction = 0;
|
||||
public FileInfo nativeSshPath = null;
|
||||
public LocalPipeServer localPipeServer = null;
|
||||
private IntPtr nextClipboardViewer = IntPtr.Zero;
|
||||
|
||||
public delegate void ClipboardChangedHandler();
|
||||
public event ClipboardChangedHandler ClipboardChanged;
|
||||
|
||||
protected override void WndProc(ref System.Windows.Forms.Message m)
|
||||
{
|
||||
// defined in winuser.h
|
||||
const int WM_DRAWCLIPBOARD = 0x308;
|
||||
const int WM_CHANGECBCHAIN = 0x030D;
|
||||
|
||||
switch (m.Msg)
|
||||
{
|
||||
case WM_DRAWCLIPBOARD:
|
||||
if (ClipboardChanged != null) { ClipboardChanged(); }
|
||||
Win32Api.SendMessage(nextClipboardViewer, m.Msg, m.WParam, m.LParam);
|
||||
break;
|
||||
case WM_CHANGECBCHAIN:
|
||||
if (m.WParam == nextClipboardViewer) { nextClipboardViewer = m.LParam; } else { Win32Api.SendMessage(nextClipboardViewer, m.Msg, m.WParam, m.LParam); }
|
||||
break;
|
||||
default:
|
||||
base.WndProc(ref m);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public bool isRouterHooked()
|
||||
{
|
||||
@@ -282,6 +307,9 @@ namespace MeshCentralRouter
|
||||
// Check if Windows SSH is present
|
||||
FileInfo nativeSshPath = new FileInfo(Path.Combine(Environment.SystemDirectory, "OpenSSH\\ssh.exe"));
|
||||
if (nativeSshPath.Exists) { this.nativeSshPath = nativeSshPath; }
|
||||
|
||||
// Listen to clipboard events
|
||||
nextClipboardViewer = Win32Api.SetClipboardViewer(this.Handle);
|
||||
}
|
||||
|
||||
private void setDoubleClickDeviceAction()
|
||||
@@ -1840,7 +1868,7 @@ namespace MeshCentralRouter
|
||||
if ((node.conn & 1) == 0) { return; } // Agent not connected on this device
|
||||
if (node.desktopViewer == null)
|
||||
{
|
||||
node.desktopViewer = new KVMViewer(meshcentral, node);
|
||||
node.desktopViewer = new KVMViewer(this, meshcentral, node);
|
||||
node.desktopViewer.consentFlags = consentFlags;
|
||||
node.desktopViewer.Show();
|
||||
node.desktopViewer.MenuItemConnect_Click(null, null);
|
||||
|
||||
18
Translate.cs
18
Translate.cs
@@ -36,6 +36,15 @@ namespace MeshCentralRouter
|
||||
{"de","Fehler beim Starten der Remote-Terminal-Sitzung"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"{0} Byte",
|
||||
new Dictionary<string, string>() {
|
||||
{"ko","{0} 바이트"},
|
||||
{"fr","{0} octet"},
|
||||
{"zh-chs","{0} 字节"},
|
||||
{"hi","{0} बाइट"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Certificate",
|
||||
new Dictionary<string, string>() {
|
||||
@@ -2652,15 +2661,6 @@ namespace MeshCentralRouter
|
||||
{"hi","सीआईआरए"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"{0} Byte",
|
||||
new Dictionary<string, string>() {
|
||||
{"ko","{0} 바이트"},
|
||||
{"fr","{0} octet"},
|
||||
{"zh-chs","{0} 字节"},
|
||||
{"hi","{0} बाइट"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Mapping Settings",
|
||||
new Dictionary<string, string>() {
|
||||
|
||||
@@ -32,6 +32,15 @@ namespace MeshCentralRouter
|
||||
public const int WINHTTP_AUTO_DETECT_TYPE_DHCP = 0x00000001;
|
||||
public const int WINHTTP_AUTO_DETECT_TYPE_DNS_A = 0x00000002;
|
||||
|
||||
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||
public static extern IntPtr SetClipboardViewer(IntPtr hWndNewViewer);
|
||||
|
||||
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||
public static extern bool ChangeClipboardChain(IntPtr hWndRemove, IntPtr hWndNewNext);
|
||||
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto)]
|
||||
public static extern int SendMessage(IntPtr hwnd, int wMsg, IntPtr wParam, IntPtr lParam);
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
|
||||
public struct WINHTTP_AUTOPROXY_OPTIONS
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user