Add project
This commit is contained in:
6
src/App.config
Executable file
6
src/App.config
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<configuration>
|
||||||
|
<startup>
|
||||||
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||||
|
</startup>
|
||||||
|
</configuration>
|
199
src/Form1.Designer.cs
generated
Executable file
199
src/Form1.Designer.cs
generated
Executable file
@ -0,0 +1,199 @@
|
|||||||
|
namespace TCPCommander
|
||||||
|
{
|
||||||
|
partial class Form1
|
||||||
|
{
|
||||||
|
/// <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();
|
||||||
|
this.timer1 = new System.Windows.Forms.Timer(this.components);
|
||||||
|
this.StartButton = new System.Windows.Forms.Button();
|
||||||
|
this.TCP_PortTextBox = new System.Windows.Forms.TextBox();
|
||||||
|
this.IPLabel = new System.Windows.Forms.Label();
|
||||||
|
this.TCP_PortLabel = new System.Windows.Forms.Label();
|
||||||
|
this.TCP_AvailablePortsLabel = new System.Windows.Forms.Label();
|
||||||
|
this.DebugButton = new System.Windows.Forms.Button();
|
||||||
|
this.UDP_AvailablePortsLabel = new System.Windows.Forms.Label();
|
||||||
|
this.UDP_PortLabel = new System.Windows.Forms.Label();
|
||||||
|
this.UDP_PortTextBox = new System.Windows.Forms.TextBox();
|
||||||
|
this.TCP_label = new System.Windows.Forms.Label();
|
||||||
|
this.label4 = new System.Windows.Forms.Label();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// timer1
|
||||||
|
//
|
||||||
|
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
|
||||||
|
//
|
||||||
|
// StartButton
|
||||||
|
//
|
||||||
|
this.StartButton.Location = new System.Drawing.Point(385, 40);
|
||||||
|
this.StartButton.Name = "StartButton";
|
||||||
|
this.StartButton.Size = new System.Drawing.Size(93, 38);
|
||||||
|
this.StartButton.TabIndex = 2;
|
||||||
|
this.StartButton.Text = "Start Server";
|
||||||
|
this.StartButton.UseVisualStyleBackColor = true;
|
||||||
|
this.StartButton.Click += new System.EventHandler(this.StartButton_Click);
|
||||||
|
//
|
||||||
|
// TCP_PortTextBox
|
||||||
|
//
|
||||||
|
this.TCP_PortTextBox.Location = new System.Drawing.Point(59, 92);
|
||||||
|
this.TCP_PortTextBox.MaxLength = 65535;
|
||||||
|
this.TCP_PortTextBox.Name = "TCP_PortTextBox";
|
||||||
|
this.TCP_PortTextBox.Size = new System.Drawing.Size(100, 20);
|
||||||
|
this.TCP_PortTextBox.TabIndex = 0;
|
||||||
|
this.TCP_PortTextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TCP_PortTextBox_KeyPress);
|
||||||
|
this.TCP_PortTextBox.KeyUp += new System.Windows.Forms.KeyEventHandler(this.TCP_PortTextBox_KeyUp);
|
||||||
|
//
|
||||||
|
// IPLabel
|
||||||
|
//
|
||||||
|
this.IPLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
|
this.IPLabel.Location = new System.Drawing.Point(112, 5);
|
||||||
|
this.IPLabel.Name = "IPLabel";
|
||||||
|
this.IPLabel.Size = new System.Drawing.Size(174, 65);
|
||||||
|
this.IPLabel.TabIndex = 2;
|
||||||
|
this.IPLabel.Text = "IP Address Here";
|
||||||
|
this.IPLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
//
|
||||||
|
// TCP_PortLabel
|
||||||
|
//
|
||||||
|
this.TCP_PortLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
|
this.TCP_PortLabel.Location = new System.Drawing.Point(19, 143);
|
||||||
|
this.TCP_PortLabel.Name = "TCP_PortLabel";
|
||||||
|
this.TCP_PortLabel.Size = new System.Drawing.Size(174, 53);
|
||||||
|
this.TCP_PortLabel.TabIndex = 3;
|
||||||
|
this.TCP_PortLabel.Text = "Port Here";
|
||||||
|
this.TCP_PortLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
//
|
||||||
|
// TCP_AvailablePortsLabel
|
||||||
|
//
|
||||||
|
this.TCP_AvailablePortsLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
|
this.TCP_AvailablePortsLabel.Location = new System.Drawing.Point(59, 115);
|
||||||
|
this.TCP_AvailablePortsLabel.Name = "TCP_AvailablePortsLabel";
|
||||||
|
this.TCP_AvailablePortsLabel.Size = new System.Drawing.Size(100, 23);
|
||||||
|
this.TCP_AvailablePortsLabel.TabIndex = 4;
|
||||||
|
this.TCP_AvailablePortsLabel.Text = "(1 - 65535)";
|
||||||
|
this.TCP_AvailablePortsLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
//
|
||||||
|
// DebugButton
|
||||||
|
//
|
||||||
|
this.DebugButton.Location = new System.Drawing.Point(385, 105);
|
||||||
|
this.DebugButton.Name = "DebugButton";
|
||||||
|
this.DebugButton.Size = new System.Drawing.Size(93, 38);
|
||||||
|
this.DebugButton.TabIndex = 3;
|
||||||
|
this.DebugButton.Text = "Debug Info";
|
||||||
|
this.DebugButton.UseVisualStyleBackColor = true;
|
||||||
|
this.DebugButton.Click += new System.EventHandler(this.DebugButton_Click);
|
||||||
|
//
|
||||||
|
// UDP_AvailablePortsLabel
|
||||||
|
//
|
||||||
|
this.UDP_AvailablePortsLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
|
this.UDP_AvailablePortsLabel.Location = new System.Drawing.Point(241, 115);
|
||||||
|
this.UDP_AvailablePortsLabel.Name = "UDP_AvailablePortsLabel";
|
||||||
|
this.UDP_AvailablePortsLabel.Size = new System.Drawing.Size(100, 23);
|
||||||
|
this.UDP_AvailablePortsLabel.TabIndex = 8;
|
||||||
|
this.UDP_AvailablePortsLabel.Text = "(1 - 65535)";
|
||||||
|
this.UDP_AvailablePortsLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
//
|
||||||
|
// UDP_PortLabel
|
||||||
|
//
|
||||||
|
this.UDP_PortLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
|
this.UDP_PortLabel.Location = new System.Drawing.Point(199, 143);
|
||||||
|
this.UDP_PortLabel.Name = "UDP_PortLabel";
|
||||||
|
this.UDP_PortLabel.Size = new System.Drawing.Size(174, 53);
|
||||||
|
this.UDP_PortLabel.TabIndex = 7;
|
||||||
|
this.UDP_PortLabel.Text = "Port Here";
|
||||||
|
this.UDP_PortLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
//
|
||||||
|
// UDP_PortTextBox
|
||||||
|
//
|
||||||
|
this.UDP_PortTextBox.Location = new System.Drawing.Point(241, 92);
|
||||||
|
this.UDP_PortTextBox.MaxLength = 65535;
|
||||||
|
this.UDP_PortTextBox.Name = "UDP_PortTextBox";
|
||||||
|
this.UDP_PortTextBox.Size = new System.Drawing.Size(100, 20);
|
||||||
|
this.UDP_PortTextBox.TabIndex = 1;
|
||||||
|
this.UDP_PortTextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.UDP_PortTextBox_KeyPress);
|
||||||
|
this.UDP_PortTextBox.KeyUp += new System.Windows.Forms.KeyEventHandler(this.UDP_PortTextBox_KeyUp);
|
||||||
|
//
|
||||||
|
// TCP_label
|
||||||
|
//
|
||||||
|
this.TCP_label.AutoSize = true;
|
||||||
|
this.TCP_label.Location = new System.Drawing.Point(95, 76);
|
||||||
|
this.TCP_label.Name = "TCP_label";
|
||||||
|
this.TCP_label.Size = new System.Drawing.Size(28, 13);
|
||||||
|
this.TCP_label.TabIndex = 9;
|
||||||
|
this.TCP_label.Text = "TCP";
|
||||||
|
//
|
||||||
|
// label4
|
||||||
|
//
|
||||||
|
this.label4.AutoSize = true;
|
||||||
|
this.label4.Location = new System.Drawing.Point(280, 76);
|
||||||
|
this.label4.Name = "label4";
|
||||||
|
this.label4.Size = new System.Drawing.Size(30, 13);
|
||||||
|
this.label4.TabIndex = 10;
|
||||||
|
this.label4.Text = "UDP";
|
||||||
|
//
|
||||||
|
// Form1
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(490, 200);
|
||||||
|
this.Controls.Add(this.label4);
|
||||||
|
this.Controls.Add(this.TCP_label);
|
||||||
|
this.Controls.Add(this.UDP_AvailablePortsLabel);
|
||||||
|
this.Controls.Add(this.UDP_PortLabel);
|
||||||
|
this.Controls.Add(this.UDP_PortTextBox);
|
||||||
|
this.Controls.Add(this.DebugButton);
|
||||||
|
this.Controls.Add(this.TCP_AvailablePortsLabel);
|
||||||
|
this.Controls.Add(this.TCP_PortLabel);
|
||||||
|
this.Controls.Add(this.IPLabel);
|
||||||
|
this.Controls.Add(this.TCP_PortTextBox);
|
||||||
|
this.Controls.Add(this.StartButton);
|
||||||
|
this.Name = "Form1";
|
||||||
|
this.Text = "TCPCommander Launcher";
|
||||||
|
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
|
||||||
|
this.Load += new System.EventHandler(this.Form1_Load);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.Timer timer1;
|
||||||
|
private System.Windows.Forms.Button StartButton;
|
||||||
|
private System.Windows.Forms.TextBox TCP_PortTextBox;
|
||||||
|
private System.Windows.Forms.Label IPLabel;
|
||||||
|
private System.Windows.Forms.Label TCP_PortLabel;
|
||||||
|
private System.Windows.Forms.Label TCP_AvailablePortsLabel;
|
||||||
|
private System.Windows.Forms.Button DebugButton;
|
||||||
|
private System.Windows.Forms.Label UDP_AvailablePortsLabel;
|
||||||
|
private System.Windows.Forms.Label UDP_PortLabel;
|
||||||
|
private System.Windows.Forms.TextBox UDP_PortTextBox;
|
||||||
|
private System.Windows.Forms.Label TCP_label;
|
||||||
|
private System.Windows.Forms.Label label4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
861
src/Form1.cs
Executable file
861
src/Form1.cs
Executable file
@ -0,0 +1,861 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
using System.Net.NetworkInformation;
|
||||||
|
using System.Net.Sockets;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Web;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.Management;
|
||||||
|
using Microsoft.Win32;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.IO;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
|
using System.Threading;
|
||||||
|
using Open.Nat;
|
||||||
|
using WinForms = System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace TCPCommander
|
||||||
|
{
|
||||||
|
public partial class Form1 : Form
|
||||||
|
{
|
||||||
|
public Form1()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
WinForms.Timer ScreenshotTimer = new WinForms.Timer();
|
||||||
|
|
||||||
|
IPEndPoint TCP_ipEP;
|
||||||
|
public static TcpClient TCP_client;
|
||||||
|
public static TcpListener TCP_listener;
|
||||||
|
|
||||||
|
IPEndPoint UDP_ipEP;
|
||||||
|
public static UdpClient UDP_client;
|
||||||
|
|
||||||
|
public static string IPstring;
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
public static extern bool GetCursorPos(out Point lpPoint);
|
||||||
|
|
||||||
|
[DllImport("user32.dll", SetLastError = true)]
|
||||||
|
public static extern bool SetCursorPos(int X, int Y);
|
||||||
|
|
||||||
|
|
||||||
|
ImageCodecInfo jpgEncoder;
|
||||||
|
System.Drawing.Imaging.Encoder encoder;
|
||||||
|
EncoderParameters encoderparams;
|
||||||
|
EncoderParameter encoderparam;
|
||||||
|
|
||||||
|
Form3 f3;
|
||||||
|
private void Form1_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
StartButton.Enabled = false;
|
||||||
|
IPLabel.Text = "";
|
||||||
|
TCP_PortLabel.Text = "Port: (Not Selected)";
|
||||||
|
|
||||||
|
f2 = new Form2();
|
||||||
|
f3 = new Form3();
|
||||||
|
|
||||||
|
f2.Hide();
|
||||||
|
f2.Text = "Server Status: Offline";
|
||||||
|
f2.IPLabel.Text = "Server Offline";
|
||||||
|
f2.LogTextBox.Location = new Point((this.Width) - (f2.LogTextBox.Size.Width / 2), f2.LogTextBox.Location.Y);
|
||||||
|
f2.IPLabel.Location = new Point((this.Width) - (f2.IPLabel.Size.Width / 2), f2.IPLabel.Location.Y);
|
||||||
|
f2.SessionTimeLabel.Location = new Point((this.Width) - (f2.IPLabel.Size.Width / 2), f2.SessionTimeLabel.Location.Y);
|
||||||
|
|
||||||
|
f2.SessionTimeLabel.Text = "00:00:00";
|
||||||
|
|
||||||
|
f2.LogTextBox.ReadOnly = true;
|
||||||
|
f2.LogTextBox.BackColor = System.Drawing.SystemColors.Window;
|
||||||
|
|
||||||
|
|
||||||
|
this.MinimumSize = this.Size;
|
||||||
|
this.MaximumSize = this.Size;
|
||||||
|
|
||||||
|
f2.MinimumSize = f2.Size;
|
||||||
|
f2.MaximumSize = f2.Size;
|
||||||
|
f3.Opacity = 0;
|
||||||
|
f3.Show();
|
||||||
|
f3.Hide();
|
||||||
|
|
||||||
|
|
||||||
|
Initialize();
|
||||||
|
timer1.Interval = 1000;
|
||||||
|
timer1.Enabled = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
jpgEncoder = GetEncoder(ImageFormat.Jpeg);
|
||||||
|
encoder = System.Drawing.Imaging.Encoder.Quality;
|
||||||
|
encoderparams = new EncoderParameters(1);
|
||||||
|
encoderparam = new EncoderParameter(encoder, 100L);
|
||||||
|
|
||||||
|
encoderparams.Param[0] = encoderparam;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TCP_clientIsOpen;
|
||||||
|
bool UDP_clientIsOpen;
|
||||||
|
byte[] buffer = new byte[1];
|
||||||
|
|
||||||
|
int SessionTime = 0;
|
||||||
|
bool ServerStatusChanged;
|
||||||
|
private void timer1_Tick(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (StartServer)
|
||||||
|
{
|
||||||
|
SessionTime++;
|
||||||
|
}
|
||||||
|
else if (SessionTime > 0)
|
||||||
|
{
|
||||||
|
LogAdd("Session Ended @ " + DateTime.Now.ToString("MM/dd/yy") + " - " + DateTime.Now.ToString("HH:mm:ss"));
|
||||||
|
LogAdd("Session Lasted: " + Hour + " Hours : " + Minute + " Minutes : " + Second + " Seconds");
|
||||||
|
SessionTime = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(ServerStatusChanged == StartServer && !StartServer))
|
||||||
|
{
|
||||||
|
f2.SessionTimeLabel.Text = GetSessionTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
ServerStatusChanged = StartServer;
|
||||||
|
|
||||||
|
if (TCP_client != null)
|
||||||
|
{
|
||||||
|
if (TCP_clientIsOpen)
|
||||||
|
{
|
||||||
|
if (TCP_client.Client.Poll(0, SelectMode.SelectRead))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
if (TCP_client.Client.Receive(buffer, SocketFlags.Peek) == 0)
|
||||||
|
{
|
||||||
|
ResetServer(StartServer);
|
||||||
|
}
|
||||||
|
} catch (Exception ex)
|
||||||
|
{
|
||||||
|
Debug.WriteLine("EXCEPTION OCCURED: Type: " + ex.GetType().ToString() + "Message: " + ex.Message);
|
||||||
|
ResetServer(StartServer);
|
||||||
|
LogAdd("Exception Thrown: " + ex.GetType() + ":" + ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public async void PortForward(bool forward, bool alert = false)
|
||||||
|
{
|
||||||
|
if (!forward)
|
||||||
|
{
|
||||||
|
if (alert)
|
||||||
|
MessageBox.Show("Alert: TCPCommander Server currently has UPnP disabled, so you cannot connect from outside the network", "TCPCommander Alert", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var discoverer = new NatDiscoverer();
|
||||||
|
var device = await discoverer.DiscoverDeviceAsync();
|
||||||
|
await device.CreatePortMapAsync(new Mapping(Protocol.Tcp, int.Parse(TCP_PortTextBox.Text), int.Parse(TCP_PortTextBox.Text), "TCPCommander Server Map"));//"Inner Router"));
|
||||||
|
|
||||||
|
var sb = new StringBuilder();
|
||||||
|
var ip = await device.GetExternalIPAsync();
|
||||||
|
|
||||||
|
sb.AppendFormat("\n+------+-------------------------------+--------------------------------+------------------------------------+-------------------------+");
|
||||||
|
sb.AppendFormat("\n| PROT | PUBLIC (Reacheable) | PRIVATE (Your computer) | Description | |");
|
||||||
|
sb.AppendFormat("\n+------+----------------------+--------+-----------------------+--------+------------------------------------+-------------------------+");
|
||||||
|
sb.AppendFormat("\n| | IP Address | Port | IP Address | Port | | Expires |");
|
||||||
|
sb.AppendFormat("\n+------+----------------------+--------+-----------------------+--------+------------------------------------+-------------------------+");
|
||||||
|
foreach (var mapping in await device.GetAllMappingsAsync())
|
||||||
|
{
|
||||||
|
sb.AppendFormat("\n| {5} | {0,-20} | {1,6} | {2,-21} | {3,6} | {4,-35}|{6,25}|",
|
||||||
|
ip, mapping.PublicPort, mapping.PrivateIP, mapping.PrivatePort, mapping.Description, mapping.Protocol == Protocol.Tcp ? "TCP" : "UDP", mapping.Expiration.ToLocalTime());
|
||||||
|
}
|
||||||
|
sb.AppendFormat("\n+------+----------------------+--------+-----------------------+--------+------------------------------------+-------------------------+");
|
||||||
|
Console.WriteLine(sb.ToString());
|
||||||
|
}
|
||||||
|
catch (MappingException ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine(ex.Message);
|
||||||
|
Console.ReadLine();
|
||||||
|
}
|
||||||
|
catch (WebException ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine(ex.Message);
|
||||||
|
Console.ReadLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ResetServer(bool ServerIsStarted)
|
||||||
|
{
|
||||||
|
if (ServerIsStarted)
|
||||||
|
{
|
||||||
|
TCP_listener.Stop();
|
||||||
|
|
||||||
|
TCP_client.Close();
|
||||||
|
TCP_clientIsOpen = false;
|
||||||
|
|
||||||
|
UDP_client.Close();
|
||||||
|
UDP_clientIsOpen = false;
|
||||||
|
|
||||||
|
Console.WriteLine(@"
|
||||||
|
===================================================
|
||||||
|
Client has been detected as being disconnected!
|
||||||
|
===================================================");
|
||||||
|
worker.WorkerSupportsCancellation = true;
|
||||||
|
worker.CancelAsync();
|
||||||
|
|
||||||
|
worker.Dispose();
|
||||||
|
LogAdd("Client Disconnected");
|
||||||
|
LogAdd("Restarting Server");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TCP_listener.Stop();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (TCP_client != null)
|
||||||
|
{
|
||||||
|
TCP_client.GetStream().Close();
|
||||||
|
TCP_client.Close();
|
||||||
|
TCP_client = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Debug.WriteLine("Exception Thrown: " + ex.GetType() + ":" + ex.Message);
|
||||||
|
LogAdd("Exception Thrown: " + ex.GetType() + ":" + ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
TCP_clientIsOpen = false;
|
||||||
|
Console.WriteLine(@"
|
||||||
|
==========================================================
|
||||||
|
Server has been shutdown by the user and is now offline!
|
||||||
|
==========================================================");
|
||||||
|
worker.WorkerSupportsCancellation = true;
|
||||||
|
worker.CancelAsync();
|
||||||
|
|
||||||
|
|
||||||
|
worker.DoWork -= ListenToClient;
|
||||||
|
worker.RunWorkerCompleted -= Worker_RunWorkerCompleted;
|
||||||
|
|
||||||
|
worker.Dispose();
|
||||||
|
LogAdd("Server Shut Down By Host");
|
||||||
|
LogAdd("Worker Temporarily Deactivated");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BackgroundWorker worker;
|
||||||
|
public /*async*/ void Initialize()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
IPstring = GetLocalNetworkIPV4();
|
||||||
|
IPLabel.Text = "IP: " + IPstring;
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Debug.WriteLine("Error Occured: " + ex.GetType().ToString() + " : " + ex.Message);
|
||||||
|
LogAdd("Exception Thrown: " + ex.GetType() + ":" + ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void Worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
|
||||||
|
{
|
||||||
|
worker.DoWork -= ListenToClient;
|
||||||
|
worker.RunWorkerCompleted -= Worker_RunWorkerCompleted;
|
||||||
|
worker.Dispose();
|
||||||
|
Debug.WriteLine("The Worker has stopped");
|
||||||
|
LogAdd("Worker Stopping And Restarting - Connection Temporarily Disabled");
|
||||||
|
worker = new BackgroundWorker();
|
||||||
|
worker.DoWork += ListenToClient;
|
||||||
|
worker.RunWorkerCompleted += Worker_RunWorkerCompleted;
|
||||||
|
worker.RunWorkerAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PCLocked = false;
|
||||||
|
public void ListenToClient(object sender, DoWorkEventArgs e)
|
||||||
|
{
|
||||||
|
LogAdd("Listener Started - Connection Enabled");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
TCP_listener.Start();
|
||||||
|
Console.WriteLine(@"
|
||||||
|
===================================================
|
||||||
|
Started listening requests at: {0}:{1}
|
||||||
|
===================================================",
|
||||||
|
TCP_ipEP.Address, TCP_ipEP.Port);
|
||||||
|
TCP_client = TCP_listener.AcceptTcpClient();
|
||||||
|
TCP_clientIsOpen = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Console.WriteLine("Connected toTCP_client!" + " \n");
|
||||||
|
|
||||||
|
|
||||||
|
Console.WriteLine("Client: " + (TCP_client.Client.RemoteEndPoint as IPEndPoint).Address + ":" + (TCP_client.Client.RemoteEndPoint as IPEndPoint).Port); //IMPORTANT FOR GETTINGTCP_client IP AND PORT!!!
|
||||||
|
LogAdd("Client: " + (TCP_client.Client.RemoteEndPoint as IPEndPoint).Address + ":" + (TCP_client.Client.RemoteEndPoint as IPEndPoint).Port + " Connected to the Server");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
if (ex.Message == "A blocking operation was interrupted by a call to WSACancelBlockingCall")
|
||||||
|
{
|
||||||
|
Debug.WriteLine("Alert: An exception has occured that is thrown when waiting for theTCP_client to accept is stopped by the server.\nThis error is normal and shouldn't impact performance, but is possible to fix with another method");
|
||||||
|
Debug.WriteLine("Same Thing sortof goes for the read in the whileTCP_listener");
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.WriteLine(ex.Message);
|
||||||
|
LogAdd("Exception Thrown: " + ex.GetType() + ":" + ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
while (TCP_client.Connected)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int bytesize = 1024;
|
||||||
|
byte[] buffer = new byte[bytesize];
|
||||||
|
string networkRead =TCP_client.GetStream().Read(buffer, 0, bytesize).ToString();
|
||||||
|
string data = ASCIIEncoding.ASCII.GetString(buffer);
|
||||||
|
Debug.WriteLine(data);
|
||||||
|
|
||||||
|
LogAdd("Incoming Data: " + data);
|
||||||
|
|
||||||
|
if (data.ToUpper().Contains("{TEST}"))
|
||||||
|
{
|
||||||
|
sendData(getBytes("{TEST_RESPOND}"),TCP_client.GetStream());
|
||||||
|
Console.WriteLine("DETECTED \"TEST\"");
|
||||||
|
}
|
||||||
|
else if (data.ToUpper().Contains("{SHUTDOWN}"))
|
||||||
|
{
|
||||||
|
Shutdown();
|
||||||
|
LogAdd("Shutting Down");
|
||||||
|
}
|
||||||
|
else if (data.ToUpper().Contains("{MONITOR_ON}"))
|
||||||
|
{
|
||||||
|
Debug.WriteLine("the monitor has been turned on");
|
||||||
|
|
||||||
|
SetMonitorState(MonitorState.ON);
|
||||||
|
|
||||||
|
mouse_event(MOUSEEVENTF_MOVE, 0, 0, 0, UIntPtr.Zero);
|
||||||
|
|
||||||
|
sendData(getBytes("{MONITOR_TURNED_ON}"),TCP_client.GetStream());
|
||||||
|
LogAdd("Turning Monitor ON");
|
||||||
|
}
|
||||||
|
else if (data.ToUpper().Contains("{MONITOR_OFF}"))
|
||||||
|
{
|
||||||
|
Debug.WriteLine("the monitor has been turned off");
|
||||||
|
|
||||||
|
SetMonitorState(MonitorState.OFF);
|
||||||
|
|
||||||
|
sendData(getBytes("{MONITOR_TURNED_OFF}"),TCP_client.GetStream());
|
||||||
|
|
||||||
|
LogAdd("Turning Mointor OFF");
|
||||||
|
}
|
||||||
|
else if (data.ToUpper().Contains("{TAKE_SCREENSHOT}"))
|
||||||
|
{
|
||||||
|
ScreenshotTimer.Interval = 1000;
|
||||||
|
ScreenshotTimer.Tick += SendScreenshotTick;
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (data.ToString().Contains("{SPEED_TEST}") && data.ToString().Contains("{/SPEED_TEST}"))
|
||||||
|
{
|
||||||
|
//sendData(new byte[1024 * 1024 * 5],TCP_client.GetStream());
|
||||||
|
Console.WriteLine("Speed Test: Size = " + data.Length);
|
||||||
|
LogAdd("Completing Speed Test");
|
||||||
|
}
|
||||||
|
else if (data.ToString().Contains("{LOCK_PC}"))
|
||||||
|
{
|
||||||
|
|
||||||
|
if (PCLocked)
|
||||||
|
{
|
||||||
|
f3.Invoke(new Action(() => f3.UnlockPC()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
f3.Invoke(new Action(() => f3.LockPC()));
|
||||||
|
}
|
||||||
|
|
||||||
|
PCLocked = !PCLocked;
|
||||||
|
|
||||||
|
sendData(getBytes("{PC_LOCKED}"),TCP_client.GetStream());
|
||||||
|
LogAdd("PC Locked Set -> " + PCLocked);
|
||||||
|
}
|
||||||
|
else if (data.ToString().Contains("{PC_LOCK_STATUS}"))
|
||||||
|
{
|
||||||
|
sendData(getBytes("{PC_LOCK_STATUS}" + PCLocked.ToString().ToLower() + "{/PC_LOCK_STATUS}"),TCP_client.GetStream());
|
||||||
|
LogAdd("Getting & Sending PC Lock Status");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Debug.WriteLine("Exception WHILE Listening: " + ex.Message);
|
||||||
|
TCP_client.GetStream().Close();
|
||||||
|
TCP_client.Close();
|
||||||
|
TCP_clientIsOpen = false;
|
||||||
|
LogAdd("Exception Thrown: " + ex.GetType() + ":" + ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SendScreenshotTick(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
Debug.WriteLine("a screenshot was taken");
|
||||||
|
|
||||||
|
var bitmap = SaveScreenshotWithMousePointer();
|
||||||
|
bitmap = new Bitmap(bitmap, new Size(1280, 720));
|
||||||
|
|
||||||
|
var stream = new MemoryStream();
|
||||||
|
bitmap.Save(stream, jpgEncoder, encoderparams);
|
||||||
|
Debug.WriteLine("Getting stream size: " + stream.Length);
|
||||||
|
|
||||||
|
sendData(stream.ToArray(),TCP_client.GetStream());
|
||||||
|
|
||||||
|
bitmap.Dispose();
|
||||||
|
LogAdd("Taking & Sending Screenshot");
|
||||||
|
}
|
||||||
|
|
||||||
|
private ImageCodecInfo GetEncoder(ImageFormat format)
|
||||||
|
{
|
||||||
|
|
||||||
|
ImageCodecInfo[] codecs = ImageCodecInfo.GetImageDecoders();
|
||||||
|
|
||||||
|
foreach (ImageCodecInfo codec in codecs)
|
||||||
|
{
|
||||||
|
if (codec.FormatID == format.Guid)
|
||||||
|
{
|
||||||
|
return codec;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Shutdown()
|
||||||
|
{
|
||||||
|
sendData(getBytes("{BEGAN_SHUTDOWN}"),TCP_client.GetStream());
|
||||||
|
ProcessStartInfo psi = new ProcessStartInfo("shutdown", "/s /f /t 0");
|
||||||
|
psi.CreateNoWindow = true;
|
||||||
|
psi.UseShellExecute = false;
|
||||||
|
Process.Start(psi);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Screenshot Capture
|
||||||
|
public static class User32
|
||||||
|
{
|
||||||
|
public const Int32 CURSOR_SHOWING = 0x00000001;
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public struct ICONINFO
|
||||||
|
{
|
||||||
|
public bool fIcon;
|
||||||
|
public Int32 xHotspot;
|
||||||
|
public Int32 yHotspot;
|
||||||
|
public IntPtr hbmMask;
|
||||||
|
public IntPtr hbmColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public struct POINT
|
||||||
|
{
|
||||||
|
public Int32 x;
|
||||||
|
public Int32 y;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public struct CURSORINFO
|
||||||
|
{
|
||||||
|
public Int32 cbSize;
|
||||||
|
public Int32 flags;
|
||||||
|
public IntPtr hCursor;
|
||||||
|
public POINT ptScreenPos;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
public static extern bool GetCursorInfo(out CURSORINFO pci);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
public static extern IntPtr CopyIcon(IntPtr hIcon);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
public static extern bool DrawIcon(IntPtr hdc, int x, int y, IntPtr hIcon);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
public static extern bool GetIconInfo(IntPtr hIcon, out ICONINFO piconinfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
Bitmap SaveScreenshotWithMousePointer()
|
||||||
|
{
|
||||||
|
var bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);
|
||||||
|
// Create a graphics object from the bitmap.
|
||||||
|
var gfxScreenshot = Graphics.FromImage(bmpScreenshot);
|
||||||
|
// Take the screenshot from the upper left corner to the right
|
||||||
|
gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
|
||||||
|
|
||||||
|
User32.CURSORINFO cursorInfo;
|
||||||
|
cursorInfo.cbSize = Marshal.SizeOf(typeof(User32.CURSORINFO));
|
||||||
|
|
||||||
|
if (User32.GetCursorInfo(out cursorInfo))
|
||||||
|
{
|
||||||
|
// if the cursor is showing draw it on the screen shot
|
||||||
|
if (cursorInfo.flags == User32.CURSOR_SHOWING)
|
||||||
|
{
|
||||||
|
// we need to get hotspot so we can draw the cursor in the correct position
|
||||||
|
var iconPointer = User32.CopyIcon(cursorInfo.hCursor);
|
||||||
|
User32.ICONINFO iconInfo;
|
||||||
|
int iconX, iconY;
|
||||||
|
|
||||||
|
if (User32.GetIconInfo(iconPointer, out iconInfo))
|
||||||
|
{
|
||||||
|
// calculate the correct position of the cursor
|
||||||
|
iconX = cursorInfo.ptScreenPos.x - ((int)iconInfo.xHotspot);
|
||||||
|
iconY = cursorInfo.ptScreenPos.y - ((int)iconInfo.yHotspot);
|
||||||
|
|
||||||
|
// draw the cursor icon on top of the captured screen image
|
||||||
|
User32.DrawIcon(gfxScreenshot.GetHdc(), iconX, iconY, cursorInfo.hCursor);
|
||||||
|
|
||||||
|
// release the handle created by call to g.GetHdc()
|
||||||
|
gfxScreenshot.ReleaseHdc();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return bmpScreenshot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Bitmap SaveScreenshot()
|
||||||
|
{
|
||||||
|
var bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);
|
||||||
|
// Create a graphics object from the bitmap.
|
||||||
|
var gfxScreenshot = Graphics.FromImage(bmpScreenshot);
|
||||||
|
// Take the screenshot from the upper left corner to the right
|
||||||
|
gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
|
||||||
|
return bmpScreenshot;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
static extern void mouse_event(Int32 dwFlags, Int32 dx, Int32 dy, Int32 dwData, UIntPtr dwExtraInfo);
|
||||||
|
private const int MOUSEEVENTF_MOVE = 0x0001;
|
||||||
|
|
||||||
|
#region Monitor Command
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
static extern IntPtr SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
|
||||||
|
|
||||||
|
private int SC_MONITORPOWER = 0xF170;
|
||||||
|
private int WM_SYSCOMMAND = 0x0112;
|
||||||
|
|
||||||
|
public enum MonitorState
|
||||||
|
{
|
||||||
|
ON = -1,
|
||||||
|
OFF = 2,
|
||||||
|
STANDBY = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetMonitorState(MonitorState state)
|
||||||
|
{
|
||||||
|
this.Invoke(new Action(() => SendMessage(this.Handle, WM_SYSCOMMAND, SC_MONITORPOWER, (int)state)));
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
byte[] getBytes(string input)
|
||||||
|
{
|
||||||
|
byte[] bytes = Encoding.ASCII.GetBytes(input);
|
||||||
|
return bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
void sendData(byte[] data, NetworkStream stream)
|
||||||
|
{
|
||||||
|
int bufferSize = 1024;
|
||||||
|
byte[] dataLength = BitConverter.GetBytes(data.Length);
|
||||||
|
stream.Write(dataLength, 0, 4); //send to the other side the size of data!
|
||||||
|
int bytesSent = 0;
|
||||||
|
int bytesLeft = data.Length;
|
||||||
|
while (bytesLeft > 0)
|
||||||
|
{
|
||||||
|
int curDataSize = Math.Min(bufferSize, bytesLeft);
|
||||||
|
stream.Write(data, bytesSent, curDataSize);
|
||||||
|
bytesSent += curDataSize;
|
||||||
|
bytesLeft -= curDataSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void sendScreenshot(byte[] data, NetworkStream stream)
|
||||||
|
{
|
||||||
|
int bufferSize = (1024 * 1024) / 2;
|
||||||
|
byte[] dataLength = BitConverter.GetBytes(data.Length);
|
||||||
|
stream.Write(dataLength, 0, 4); //send to the other side the size of data!
|
||||||
|
int bytesSent = 0;
|
||||||
|
int bytesLeft = data.Length;
|
||||||
|
while (bytesLeft > 0)
|
||||||
|
{
|
||||||
|
int curDataSize = Math.Min(bufferSize, bytesLeft);
|
||||||
|
stream.Write(data, bytesSent, curDataSize);
|
||||||
|
bytesSent += curDataSize;
|
||||||
|
bytesLeft -= curDataSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string getBetween(string strSource, string strStart, string strEnd)
|
||||||
|
{
|
||||||
|
int Start, End;
|
||||||
|
if (strSource.Contains(strStart) && strSource.Contains(strEnd))
|
||||||
|
{
|
||||||
|
Start = strSource.IndexOf(strStart, 0) + strStart.Length;
|
||||||
|
End = strSource.IndexOf(strEnd, Start);
|
||||||
|
return strSource.Substring(Start, End - Start);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string GetLocalNetworkIPV4()
|
||||||
|
{
|
||||||
|
string localIP = "";
|
||||||
|
bool OpenPort = false;
|
||||||
|
using (Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, 0))
|
||||||
|
{
|
||||||
|
IPGlobalProperties ipGlobalProperties = IPGlobalProperties.GetIPGlobalProperties();
|
||||||
|
TcpConnectionInformation[] tcpConnInfoArray = ipGlobalProperties.GetActiveTcpConnections();
|
||||||
|
|
||||||
|
for (int i = 60000; i < 65535; i++)
|
||||||
|
{
|
||||||
|
if (OpenPort)
|
||||||
|
{
|
||||||
|
Debug.WriteLine("Working Port Found");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (TcpConnectionInformation tcpi in tcpConnInfoArray)
|
||||||
|
{
|
||||||
|
if (tcpi.LocalEndPoint.Port == i)
|
||||||
|
{
|
||||||
|
Debug.WriteLine(i + " Is In Use");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
OpenPort = true;
|
||||||
|
socket.Connect("8.8.8.8", i);
|
||||||
|
IPEndPoint endPoint = socket.LocalEndPoint as IPEndPoint;
|
||||||
|
localIP = endPoint.Address.ToString();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return localIP;
|
||||||
|
}
|
||||||
|
|
||||||
|
Form2 f2;
|
||||||
|
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (TCP_client != null)
|
||||||
|
{
|
||||||
|
TCP_client.GetStream().Close();
|
||||||
|
TCP_client.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (UDP_client != null)
|
||||||
|
{
|
||||||
|
UDP_client.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception) { }
|
||||||
|
|
||||||
|
if (TCP_listener != null)
|
||||||
|
{
|
||||||
|
if (TCP_listener.Server.IsBound)
|
||||||
|
{
|
||||||
|
TCP_listener.Stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool StartServer = false;
|
||||||
|
private async void StartButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
StartServer = !StartServer;
|
||||||
|
|
||||||
|
if (StartServer)
|
||||||
|
{
|
||||||
|
IPGlobalProperties ipGlobalProperties = IPGlobalProperties.GetIPGlobalProperties();
|
||||||
|
TcpConnectionInformation[] tcpConnInfoArray = ipGlobalProperties.GetActiveTcpConnections();
|
||||||
|
|
||||||
|
foreach (TcpConnectionInformation tcpi in tcpConnInfoArray)
|
||||||
|
{
|
||||||
|
if (tcpi.LocalEndPoint.Port == int.Parse(TCP_PortTextBox.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Could not open port \"" + TCP_PortTextBox.Text + "\" as it is already in use!", "Error Opening Port", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||||
|
StartServer = false;
|
||||||
|
return;
|
||||||
|
} else if (tcpi.LocalEndPoint.Port == int.Parse(UDP_PortTextBox.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Could not open port \"" + TCP_PortTextBox.Text + "\" as it is already in use!", "Error Opening Port", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||||
|
StartServer = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TCP_PortTextBox.ReadOnly = true;
|
||||||
|
TCP_PortTextBox.BackColor = System.Drawing.SystemColors.Window;
|
||||||
|
|
||||||
|
StartButton.Text = "Stop Server";
|
||||||
|
|
||||||
|
PortForward(false, true);
|
||||||
|
|
||||||
|
f2.Text = "Server Status: Online";
|
||||||
|
f2.IPLabel.Text = "Connect: " + IPstring + ", " + TCP_PortTextBox.Text + ", " + UDP_PortTextBox.Text;
|
||||||
|
f2.SessionTimeLabel.Text = GetSessionTime();
|
||||||
|
LogAdd("Session Started @ " + DateTime.Now.ToString("MM/dd/yy") + " - " + DateTime.Now.ToString("HH:mm:ss"));
|
||||||
|
|
||||||
|
TCP_ipEP = new IPEndPoint(IPAddress.Parse(IPstring), int.Parse(TCP_PortTextBox.Text)); //allow a way to set the port in the future
|
||||||
|
TCP_listener = new TcpListener(TCP_ipEP);
|
||||||
|
|
||||||
|
UDP_ipEP = new IPEndPoint(IPAddress.Parse(IPstring), int.Parse(UDP_PortTextBox.Text));
|
||||||
|
UDP_client = new UdpClient(UDP_ipEP);
|
||||||
|
|
||||||
|
worker = new BackgroundWorker();
|
||||||
|
worker.DoWork += ListenToClient;
|
||||||
|
worker.RunWorkerCompleted += Worker_RunWorkerCompleted;
|
||||||
|
worker.RunWorkerAsync();
|
||||||
|
TCP_PortLabel.Text = TCP_PortTextBox.Text;
|
||||||
|
|
||||||
|
//await Task.Run(() => SetUpPortMap());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TCP_PortTextBox.ReadOnly = false;
|
||||||
|
StartButton.Text = "Start Server";
|
||||||
|
TCP_PortLabel.Text = "Port: (Not Selected)";
|
||||||
|
f2.Text = "Server Status: Offline";
|
||||||
|
f2.IPLabel.Text = "Server Offline";
|
||||||
|
f2.SessionTimeLabel.Text = "00:00:00";
|
||||||
|
ResetServer(StartServer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TCP_PortTextBox_KeyPress(object sender, KeyPressEventArgs e)
|
||||||
|
{
|
||||||
|
if (TCP_PortTextBox.TextLength >= 5 && e.KeyChar != (char)8)
|
||||||
|
{
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(char.IsDigit(e.KeyChar) || e.KeyChar == (char)8))
|
||||||
|
{
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TCP_PortTextBox_KeyUp(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (TCP_PortTextBox.TextLength > 0 && UDP_PortTextBox.TextLength > 0)
|
||||||
|
{
|
||||||
|
if (int.Parse(TCP_PortTextBox.Text) > 0 && int.Parse(TCP_PortTextBox.Text) < 65536 && int.Parse(UDP_PortTextBox.Text) > 0 && int.Parse(UDP_PortTextBox.Text) < 65536)
|
||||||
|
{
|
||||||
|
StartButton.Enabled = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
StartButton.Enabled = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
StartButton.Enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UDP_PortTextBox_KeyPress(object sender, KeyPressEventArgs e)
|
||||||
|
{
|
||||||
|
if (UDP_PortTextBox.TextLength >= 5 && e.KeyChar != (char)8)
|
||||||
|
{
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(char.IsDigit(e.KeyChar) || e.KeyChar == (char)8))
|
||||||
|
{
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UDP_PortTextBox_KeyUp(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (TCP_PortTextBox.TextLength > 0 && UDP_PortTextBox.TextLength > 0)
|
||||||
|
{
|
||||||
|
if (int.Parse(TCP_PortTextBox.Text) > 0 && int.Parse(TCP_PortTextBox.Text) < 65536 && int.Parse(UDP_PortTextBox.Text) > 0 && int.Parse(UDP_PortTextBox.Text) < 65536)
|
||||||
|
{
|
||||||
|
StartButton.Enabled = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
StartButton.Enabled = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
StartButton.Enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static bool DebugButtonEnabled = false;
|
||||||
|
private void DebugButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
DebugButtonEnabled = !DebugButtonEnabled;
|
||||||
|
if (DebugButtonEnabled)
|
||||||
|
{
|
||||||
|
f2.BringToFront();
|
||||||
|
f2.Show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
f2.Hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int Hour;
|
||||||
|
int Minute;
|
||||||
|
int Second;
|
||||||
|
public string GetSessionTime()
|
||||||
|
{
|
||||||
|
Hour = SessionTime / 3600;
|
||||||
|
Minute = (SessionTime % 3600) / 60;
|
||||||
|
Second = SessionTime % 60;
|
||||||
|
return String.Format("{0:D2}:{1:D2}:{2:D2}", Hour, Minute, Second);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LogAdd(string input)
|
||||||
|
{
|
||||||
|
if (f2.LogTextBox.InvokeRequired)
|
||||||
|
{
|
||||||
|
f2.LogTextBox.Invoke(new Action(() => {
|
||||||
|
f2.LogTextBox.Text += DateTime.Now.ToString("[MM/dd - HH:mm:ss]") + " - " + input + "\r\n\r\n";
|
||||||
|
f2.LogTextBox.SelectionStart = f2.LogTextBox.TextLength;
|
||||||
|
f2.LogTextBox.ScrollToCaret();
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
f2.LogTextBox.Text += DateTime.Now.ToString("[MM/dd - HH:mm:ss]") + " - " + input + "\r\n\r\n";
|
||||||
|
f2.LogTextBox.SelectionStart = f2.LogTextBox.TextLength;
|
||||||
|
f2.LogTextBox.ScrollToCaret();
|
||||||
|
}
|
||||||
|
//f2.LogTextBox.ScrollToCaret();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
123
src/Form1.resx
Executable file
123
src/Form1.resx
Executable file
@ -0,0 +1,123 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
87
src/Form2.Designer.cs
generated
Executable file
87
src/Form2.Designer.cs
generated
Executable file
@ -0,0 +1,87 @@
|
|||||||
|
namespace TCPCommander
|
||||||
|
{
|
||||||
|
partial class Form2
|
||||||
|
{
|
||||||
|
/// <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.IPLabel = new System.Windows.Forms.Label();
|
||||||
|
this.LogTextBox = new System.Windows.Forms.TextBox();
|
||||||
|
this.SessionTimeLabel = new System.Windows.Forms.Label();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// IPLabel
|
||||||
|
//
|
||||||
|
this.IPLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
|
this.IPLabel.Location = new System.Drawing.Point(314, 45);
|
||||||
|
this.IPLabel.Name = "IPLabel";
|
||||||
|
this.IPLabel.Size = new System.Drawing.Size(278, 49);
|
||||||
|
this.IPLabel.TabIndex = 1;
|
||||||
|
this.IPLabel.Text = "Status";
|
||||||
|
this.IPLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
//
|
||||||
|
// LogTextBox
|
||||||
|
//
|
||||||
|
this.LogTextBox.Location = new System.Drawing.Point(88, 179);
|
||||||
|
this.LogTextBox.Multiline = true;
|
||||||
|
this.LogTextBox.Name = "LogTextBox";
|
||||||
|
this.LogTextBox.Size = new System.Drawing.Size(738, 259);
|
||||||
|
this.LogTextBox.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// SessionTimeLabel
|
||||||
|
//
|
||||||
|
this.SessionTimeLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
|
this.SessionTimeLabel.Location = new System.Drawing.Point(314, 94);
|
||||||
|
this.SessionTimeLabel.Name = "SessionTimeLabel";
|
||||||
|
this.SessionTimeLabel.Size = new System.Drawing.Size(278, 49);
|
||||||
|
this.SessionTimeLabel.TabIndex = 3;
|
||||||
|
this.SessionTimeLabel.Text = "Session Time";
|
||||||
|
this.SessionTimeLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
//
|
||||||
|
// Form2
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(936, 450);
|
||||||
|
this.Controls.Add(this.SessionTimeLabel);
|
||||||
|
this.Controls.Add(this.LogTextBox);
|
||||||
|
this.Controls.Add(this.IPLabel);
|
||||||
|
this.Name = "Form2";
|
||||||
|
this.Text = "Server Status:";
|
||||||
|
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form2_FormClosing);
|
||||||
|
this.Load += new System.EventHandler(this.Form2_Load);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public System.Windows.Forms.Label IPLabel;
|
||||||
|
public System.Windows.Forms.TextBox LogTextBox;
|
||||||
|
public System.Windows.Forms.Label SessionTimeLabel;
|
||||||
|
}
|
||||||
|
}
|
33
src/Form2.cs
Executable file
33
src/Form2.cs
Executable file
@ -0,0 +1,33 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace TCPCommander
|
||||||
|
{
|
||||||
|
public partial class Form2 : Form
|
||||||
|
{
|
||||||
|
public Form2()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Form2_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Form2_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
|
{
|
||||||
|
Form1.DebugButtonEnabled = false;
|
||||||
|
this.Hide();
|
||||||
|
e.Cancel = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
src/Form2.resx
Executable file
120
src/Form2.resx
Executable file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
103
src/Form3.Designer.cs
generated
Executable file
103
src/Form3.Designer.cs
generated
Executable file
@ -0,0 +1,103 @@
|
|||||||
|
namespace TCPCommander
|
||||||
|
{
|
||||||
|
partial class Form3
|
||||||
|
{
|
||||||
|
/// <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();
|
||||||
|
this.timer1 = new System.Windows.Forms.Timer(this.components);
|
||||||
|
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
|
||||||
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// timer1
|
||||||
|
//
|
||||||
|
this.timer1.Interval = 10;
|
||||||
|
this.timer1.Tick += new System.EventHandler(this.Timer1_Tick);
|
||||||
|
//
|
||||||
|
// notifyIcon1
|
||||||
|
//
|
||||||
|
this.notifyIcon1.Text = "Computer Lock";
|
||||||
|
this.notifyIcon1.Visible = true;
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 21F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
|
this.label1.ForeColor = System.Drawing.Color.White;
|
||||||
|
this.label1.Location = new System.Drawing.Point(12, 20);
|
||||||
|
this.label1.Name = "label1";
|
||||||
|
this.label1.Size = new System.Drawing.Size(770, 65);
|
||||||
|
this.label1.TabIndex = 0;
|
||||||
|
this.label1.Text = "Your computer is currently locked by the Administrator";
|
||||||
|
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
|
this.label2.ForeColor = System.Drawing.Color.White;
|
||||||
|
this.label2.Location = new System.Drawing.Point(12, 110);
|
||||||
|
this.label2.Name = "label2";
|
||||||
|
this.label2.Size = new System.Drawing.Size(770, 50);
|
||||||
|
this.label2.TabIndex = 1;
|
||||||
|
this.label2.Text = "Please use your phone to unlock your computer.";
|
||||||
|
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
//
|
||||||
|
// Form3
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.AutoSize = true;
|
||||||
|
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(6)))), ((int)(((byte)(28)))), ((int)(((byte)(74)))));
|
||||||
|
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||||
|
this.Controls.Add(this.label2);
|
||||||
|
this.Controls.Add(this.label1);
|
||||||
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||||
|
this.Name = "Form3";
|
||||||
|
this.ShowIcon = false;
|
||||||
|
this.ShowInTaskbar = false;
|
||||||
|
this.Text = "Computer Lock";
|
||||||
|
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
|
||||||
|
this.Load += new System.EventHandler(this.Form1_Load);
|
||||||
|
this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.Timer timer1;
|
||||||
|
private System.Windows.Forms.Label label1;
|
||||||
|
private System.Windows.Forms.Label label2;
|
||||||
|
public System.Windows.Forms.NotifyIcon notifyIcon1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
250
src/Form3.cs
Executable file
250
src/Form3.cs
Executable file
@ -0,0 +1,250 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Management;
|
||||||
|
using System.IO;
|
||||||
|
using Microsoft.Win32;
|
||||||
|
using KeyboardHookMain;
|
||||||
|
using System.Security.Permissions;
|
||||||
|
//This project is using JSON.NET
|
||||||
|
namespace TCPCommander //need to make login form (form1), form for keybinding (form3), form for attempts and at what time
|
||||||
|
{
|
||||||
|
public partial class Form3 : Form
|
||||||
|
{
|
||||||
|
public static bool isLocked = false;
|
||||||
|
|
||||||
|
private static readonly IntPtr HWND_TOPMOST = new IntPtr(-1);
|
||||||
|
private static readonly IntPtr HWND_NOTOPMOST = new IntPtr(-2);
|
||||||
|
private const UInt32 SWP_NOSIZE = 0x0001;
|
||||||
|
private const UInt32 SWP_NOMOVE = 0x0002;
|
||||||
|
private const UInt32 TOPMOST_FLAGS = SWP_NOMOVE | SWP_NOSIZE;
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
[return: MarshalAs(UnmanagedType.Bool)]
|
||||||
|
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
[return: MarshalAs(UnmanagedType.Bool)]
|
||||||
|
static extern bool SetForegroundWindow(IntPtr hWnd);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
public static extern bool ShutdownBlockReasonCreate(IntPtr hWnd, [MarshalAs(UnmanagedType.LPWStr)] string pwszReason);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
public static extern bool ShutdownBlockReasonDestroy(IntPtr hWnd);
|
||||||
|
|
||||||
|
//[DllImport("user32.dll", SetLastError = true)]
|
||||||
|
//public static extern bool BlockInput(bool fBlockIt);
|
||||||
|
|
||||||
|
protected override void WndProc(ref Message m)
|
||||||
|
{
|
||||||
|
const int WM_QUERYENDSESSION = 0x0011;
|
||||||
|
const int WM_ENDSESSION = 0x0016;
|
||||||
|
|
||||||
|
if (m.Msg == WM_QUERYENDSESSION || m.Msg == WM_ENDSESSION)
|
||||||
|
return;
|
||||||
|
|
||||||
|
base.WndProc(ref m);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Form3()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
Form[] z;
|
||||||
|
private void Form1_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
//BlockInput(true);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
WindowState = FormWindowState.Maximized;
|
||||||
|
notifyIcon1.Icon = SystemIcons.Shield;
|
||||||
|
|
||||||
|
SystemEvents.DisplaySettingsChanging += SystemEvents_DisplaySettingsChanging;
|
||||||
|
}
|
||||||
|
|
||||||
|
int screenCount;
|
||||||
|
private void SystemEvents_DisplaySettingsChanging(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (isLocked)
|
||||||
|
{
|
||||||
|
screenCount = Screen.AllScreens.Length;
|
||||||
|
|
||||||
|
for (int a = 0; a < z.Length; a++)
|
||||||
|
{
|
||||||
|
if (z[a] != null)
|
||||||
|
{
|
||||||
|
z[a].Close();
|
||||||
|
z[a].Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
z = new Form[screenCount - 1];
|
||||||
|
for (int a = 0; a < z.Length; a++)
|
||||||
|
{
|
||||||
|
z[a] = new Form();
|
||||||
|
z[a].FormBorderStyle = FormBorderStyle.None;
|
||||||
|
z[a].BackColor = Color.Black;
|
||||||
|
z[a].Location = Screen.AllScreens[a + 1].WorkingArea.Location;
|
||||||
|
|
||||||
|
z[a].Show();
|
||||||
|
|
||||||
|
Rectangle bounds = Screen.AllScreens[a + 1].Bounds;
|
||||||
|
z[a].SetBounds(bounds.X, bounds.Y, bounds.Width, bounds.Height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MenuItem4_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Application.Exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Timer1_Tick(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool PreFilterMessage(ref Message m)
|
||||||
|
{
|
||||||
|
if (m.Msg == 0x201 || m.Msg == 0x202 || m.Msg == 0x203) return true;
|
||||||
|
if (m.Msg == 0x204 || m.Msg == 0x205 || m.Msg == 0x206) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LockPC()
|
||||||
|
{
|
||||||
|
this.Show();
|
||||||
|
SetWindowPos(this.Handle, HWND_TOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS);
|
||||||
|
|
||||||
|
Cursor.Hide();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
KeyboardHookMain.KeyboardHook.EngageFullKeyboardLockdown();
|
||||||
|
//mmf.DisableMouse();
|
||||||
|
|
||||||
|
StopShutdown("(Shutdown Disabled)\nReason: Lock Exploitation Protection");
|
||||||
|
|
||||||
|
this.Opacity = 1;
|
||||||
|
|
||||||
|
notifyIcon1.Visible = true;
|
||||||
|
notifyIcon1.BalloonTipTitle = ("Computer Lock");
|
||||||
|
notifyIcon1.BalloonTipText = ("Your computer has been locked.");
|
||||||
|
notifyIcon1.ShowBalloonTip(5000);
|
||||||
|
isLocked = true;
|
||||||
|
|
||||||
|
screenCount = Screen.AllScreens.Length;
|
||||||
|
z = new Form[screenCount - 1];
|
||||||
|
if (screenCount > 1)
|
||||||
|
{
|
||||||
|
for (int a = 0; a < z.Length; a++)
|
||||||
|
{
|
||||||
|
Debug.WriteLine(Application.OpenForms.Count);
|
||||||
|
|
||||||
|
z[a] = new Form();
|
||||||
|
z[a].FormBorderStyle = FormBorderStyle.None;
|
||||||
|
z[a].BackColor = Color.Black;
|
||||||
|
z[a].Location = Screen.AllScreens[a + 1].WorkingArea.Location;
|
||||||
|
|
||||||
|
z[a].Show();
|
||||||
|
|
||||||
|
Rectangle bounds = Screen.AllScreens[a + 1].Bounds;
|
||||||
|
z[a].SetBounds(bounds.X, bounds.Y, bounds.Width, bounds.Height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UnlockPC()
|
||||||
|
{
|
||||||
|
this.Hide();
|
||||||
|
SetWindowPos(this.Handle, HWND_NOTOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS);
|
||||||
|
|
||||||
|
Cursor.Show();
|
||||||
|
ResetShutdown();
|
||||||
|
KeyboardHookMain.KeyboardHook.ReleaseFullKeyboardLockdown();
|
||||||
|
//mmf.EnableMouse();
|
||||||
|
|
||||||
|
this.Opacity = 0.0;
|
||||||
|
|
||||||
|
notifyIcon1.BalloonTipTitle = "Computer Lock";
|
||||||
|
notifyIcon1.BalloonTipText = "Your computer has been unlocked.";
|
||||||
|
notifyIcon1.ShowBalloonTip(5000);
|
||||||
|
isLocked = false;
|
||||||
|
|
||||||
|
for (int a = 0; a < z.Length; a++)
|
||||||
|
{
|
||||||
|
z[a].Close();
|
||||||
|
z[a].Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void StopShutdown(string strMsg)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (ShutdownBlockReasonCreate(this.Handle, strMsg))
|
||||||
|
{
|
||||||
|
Debug.WriteLine("Shutdown aborted.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.WriteLine("Shutdown couldn't be aborted.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine("StopShutdown Error: " + e.Message + " " + e.StackTrace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ResetShutdown()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (ShutdownBlockReasonDestroy(this.Handle))
|
||||||
|
{
|
||||||
|
Debug.WriteLine("Shutdown Reset");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.WriteLine("Shutdown couldn't be reset");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.WriteLine("ResetShutdown Error: " + e.Message + " " + e.StackTrace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Form1_Paint(object sender, PaintEventArgs e)
|
||||||
|
{
|
||||||
|
Pen p = new Pen(Color.White); /
|
||||||
|
p.Width = 5;
|
||||||
|
Graphics g = e.Graphics;
|
||||||
|
g.DrawRectangle(p, new Rectangle(label1.Location.X - 5, label1.Location.Y - 5, label1.Width + 10, label1.Height + 10));
|
||||||
|
g.DrawRectangle(p, new Rectangle(label2.Location.X - 5, label2.Location.Y - 5, label2.Width + 10, label2.Height + 10));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
|
{
|
||||||
|
notifyIcon1.BalloonTipClosed += (s, args) =>
|
||||||
|
{
|
||||||
|
var thisIcon = (NotifyIcon)sender;
|
||||||
|
thisIcon.Visible = false;
|
||||||
|
thisIcon.Dispose();
|
||||||
|
SystemEvents.DisplaySettingsChanging -= SystemEvents_DisplaySettingsChanging;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
126
src/Form3.resx
Executable file
126
src/Form3.resx
Executable file
@ -0,0 +1,126 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="notifyIcon1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>104, 17</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
1733
src/KeyboardLock.cs
Executable file
1733
src/KeyboardLock.cs
Executable file
File diff suppressed because it is too large
Load Diff
22
src/Program.cs
Executable file
22
src/Program.cs
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace TCPCommander
|
||||||
|
{
|
||||||
|
static class Program
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The main entry point for the application.
|
||||||
|
/// </summary>
|
||||||
|
[STAThread]
|
||||||
|
static void Main()
|
||||||
|
{
|
||||||
|
Application.EnableVisualStyles();
|
||||||
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
|
Application.Run(new Form1());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
36
src/Properties/AssemblyInfo.cs
Executable file
36
src/Properties/AssemblyInfo.cs
Executable file
@ -0,0 +1,36 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("TCPCommander")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("TCPCommander")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2020")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("f924fba5-b17d-4e39-8e5e-de79969c2bfe")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
71
src/Properties/Resources.Designer.cs
generated
Executable file
71
src/Properties/Resources.Designer.cs
generated
Executable file
@ -0,0 +1,71 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace TCPCommander.Properties
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||||
|
/// </summary>
|
||||||
|
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||||
|
// class via a tool like ResGen or Visual Studio.
|
||||||
|
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||||
|
// with the /str option, or rebuild your VS project.
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
internal class Resources
|
||||||
|
{
|
||||||
|
|
||||||
|
private static global::System.Resources.ResourceManager resourceMan;
|
||||||
|
|
||||||
|
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||||
|
|
||||||
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||||
|
internal Resources()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the cached ResourceManager instance used by this class.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Resources.ResourceManager ResourceManager
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if ((resourceMan == null))
|
||||||
|
{
|
||||||
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TCPCommander.Properties.Resources", typeof(Resources).Assembly);
|
||||||
|
resourceMan = temp;
|
||||||
|
}
|
||||||
|
return resourceMan;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Overrides the current thread's CurrentUICulture property for all
|
||||||
|
/// resource lookups using this strongly typed resource class.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Globalization.CultureInfo Culture
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return resourceCulture;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
resourceCulture = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
117
src/Properties/Resources.resx
Executable file
117
src/Properties/Resources.resx
Executable file
@ -0,0 +1,117 @@
|
|||||||
|
<?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.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: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" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
</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" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
</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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
30
src/Properties/Settings.Designer.cs
generated
Executable file
30
src/Properties/Settings.Designer.cs
generated
Executable file
@ -0,0 +1,30 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace TCPCommander.Properties
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||||
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||||
|
{
|
||||||
|
|
||||||
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
|
|
||||||
|
public static Settings Default
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return defaultInstance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
7
src/Properties/Settings.settings
Executable file
7
src/Properties/Settings.settings
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||||
|
<Profiles>
|
||||||
|
<Profile Name="(Default)" />
|
||||||
|
</Profiles>
|
||||||
|
<Settings />
|
||||||
|
</SettingsFile>
|
120
src/TCPCommander.csproj
Executable file
120
src/TCPCommander.csproj
Executable file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{F924FBA5-B17D-4E39-8E5E-DE79969C2BFE}</ProjectGuid>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<RootNamespace>TCPCommander</RootNamespace>
|
||||||
|
<AssemblyName>TCPCommander</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
|
<Deterministic>true</Deterministic>
|
||||||
|
<NuGetPackageImportStamp>
|
||||||
|
</NuGetPackageImportStamp>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="Open.Nat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f22a6a4582336c76, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\Open.NAT.2.1.0.0\lib\net45\Open.Nat.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Management" />
|
||||||
|
<Reference Include="System.Net.Sockets, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Net.Sockets.4.3.0\lib\net46\System.Net.Sockets.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Web" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Deployment" />
|
||||||
|
<Reference Include="System.Drawing" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Windows.Forms" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Form1.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Form1.Designer.cs">
|
||||||
|
<DependentUpon>Form1.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Form3.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Form3.designer.cs">
|
||||||
|
<DependentUpon>Form3.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Form2.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Form2.Designer.cs">
|
||||||
|
<DependentUpon>Form2.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="KeyboardLock.cs" />
|
||||||
|
<Compile Include="Program.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<EmbeddedResource Include="Form1.resx">
|
||||||
|
<DependentUpon>Form1.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="Form3.resx">
|
||||||
|
<DependentUpon>Form3.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="Form2.resx">
|
||||||
|
<DependentUpon>Form2.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<Compile Include="Properties\Resources.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
<None Include="Properties\Settings.settings">
|
||||||
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
|
</None>
|
||||||
|
<Compile Include="Properties\Settings.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="App.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="packages\FreeRDP.2.0.0.13\freerdp-client.dll" />
|
||||||
|
<Content Include="packages\FreeRDP.2.0.0.13\freerdp.dll" />
|
||||||
|
<Content Include="packages\FreeRDP.2.0.0.13\winpr.dll" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
</Project>
|
25
src/TCPCommander.sln
Executable file
25
src/TCPCommander.sln
Executable file
@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 16
|
||||||
|
VisualStudioVersion = 16.0.29519.87
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TCPCommander", "TCPCommander.csproj", "{F924FBA5-B17D-4E39-8E5E-DE79969C2BFE}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{F924FBA5-B17D-4E39-8E5E-DE79969C2BFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{F924FBA5-B17D-4E39-8E5E-DE79969C2BFE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{F924FBA5-B17D-4E39-8E5E-DE79969C2BFE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{F924FBA5-B17D-4E39-8E5E-DE79969C2BFE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {85233985-BFA9-4BFC-9ED6-E281E2F662A0}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
5
src/packages.config
Executable file
5
src/packages.config
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="Open.NAT" version="2.1.0.0" targetFramework="net472" />
|
||||||
|
<package id="System.Net.Sockets" version="4.3.0" targetFramework="net472" />
|
||||||
|
</packages>
|
Reference in New Issue
Block a user