Add project

This commit is contained in:
Allen Wolf
2024-01-10 23:06:50 -06:00
parent a775b99d14
commit 4605d2dab7
20 changed files with 4245 additions and 0 deletions

6
src/App.config Executable file
View 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>

89
src/Form1.Designer.cs generated Executable file
View File

@ -0,0 +1,89 @@
namespace TeamViewerController
{
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.label1 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// label1
//
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(261, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(232, 51);
this.label1.TabIndex = 0;
this.label1.Text = "Access Type";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// button1
//
this.button1.Location = new System.Drawing.Point(450, 63);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(83, 39);
this.button1.TabIndex = 1;
this.button1.Text = "Submit";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// textBox1
//
this.textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.textBox1.Location = new System.Drawing.Point(313, 63);
this.textBox1.Name = "textBox1";
this.textBox1.Text = "Install 1.0";
this.textBox1.Size = new System.Drawing.Size(131, 38);
this.textBox1.TabIndex = 2;
this.textBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.button1);
this.Controls.Add(this.label1);
this.Name = "Form1";
this.Text = "Install Remote Access";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox textBox1;
}
}

952
src/Form1.cs Executable file
View File

@ -0,0 +1,952 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using System.Net.Sockets;
using System.Diagnostics;
using System.Net.NetworkInformation;
using Open.Nat;
using System.Threading;
using System.Windows.Forms;
using System.IO;
using System.ComponentModel;
using System.Drawing.Imaging;
using System.Drawing;
using Microsoft.Win32;
using System.Runtime.InteropServices;
using KeyboardHookMain;
namespace TeamViewerController
{
public partial class Form1 : Form
{
public static TcpClient client;
public static TcpListener listener;
public static string IPstring;
public static IPEndPoint ipEP;
public static bool clientIsOpen;
public static int portValue = 8888;
public static int outerPortValue = 8888;
public static int connectToPort;
private string FindByDisplayName(RegistryKey parentKey, string name)
{
string[] nameList = parentKey.GetSubKeyNames();
for (int i = 0; i < nameList.Length; i++)
{
RegistryKey regKey = parentKey.OpenSubKey(nameList[i]);
try
{
if (regKey.GetValue("DisplayName").ToString() == name)
{
return regKey.GetValue("InstallLocation").ToString();
}
}
catch { }
}
return "";
}
public static /*async*/ void writeMessage(string input)
{
try
{
NetworkStream ns = client.GetStream();
byte[] message = Encoding.ASCII.GetBytes(input);
ns.Write(message, 0, message.Length);
}
catch (Exception ex)
{
}
}
bool TeamViewerRunning;
bool PCLocked;
Form2 f2 = new Form2();
bool ScreenBlanked;
NotifyIcon notifyIcon = new NotifyIcon();
public void ListenToClient(object sender, DoWorkEventArgs e)
{
IPstring = GetLocalNetworkIPV4();
IPGlobalProperties ipGlobalProperties = IPGlobalProperties.GetIPGlobalProperties();
TcpConnectionInformation[] tcpConnInfoArray = ipGlobalProperties.GetActiveTcpConnections();
foreach (TcpConnectionInformation tcpi in tcpConnInfoArray)
{
if (tcpi.LocalEndPoint.Port == portValue)
{
Debug.WriteLine("Could not open port \"" + portValue + "\" as it is already in use!");
return;
}
}
try
{
ipEP = new IPEndPoint(IPAddress.Parse(IPstring), portValue); //allow a way to set the port in the future
listener = new TcpListener(ipEP);
}
catch (Exception ex)
{
Debug.WriteLine("ERROR: " + ex.Message);
}
try
{
//listener.AllowNatTraversal(true);
listener.Start();
OpenPort();
client = listener.AcceptTcpClient();
clientIsOpen = true;
}
catch (Exception ex)
{
Console.WriteLine("ERROR: " + ex.Message);
Console.ReadLine();
}
while (client.Connected)
{
try
{
const int bytesize = 1024;
byte[] buffer = new byte[bytesize];
string networkRead = client.GetStream().Read(buffer, 0, bytesize).ToString();
string data = ASCIIEncoding.ASCII.GetString(buffer);
if (data.Contains("{Screenshot}"))
{
//var bitmap = SaveScreenshot();
var bitmap = SaveScreenshotWithMousePointer();
var stream = new MemoryStream();
bitmap.Save(stream, ImageFormat.Bmp);
Debug.WriteLine("Getting stream size: " + stream.Length);
sendData(stream.ToArray(), client.GetStream(), 1024 * 256);
} else if (data.Contains("{OpenTV}"))
{
try
{
foreach (Process p in Process.GetProcesses())
{
if (p.ProcessName == "TeamViewer")
{
TeamViewerRunning = true;
break;
}
else
{
TeamViewerRunning = false;
}
}
if (!TeamViewerRunning)
{
Process.Start(TeamViewerLocation);
}
}
catch (Exception ex)
{
Debug.WriteLine("ERROR: " + ex.Message);
}
}
else if (data.Contains("{KillTV}"))
{
foreach (Process p in Process.GetProcesses())
{
if (p.ProcessName == "TeamViewer")
{
p.Kill();
break;
}
}
}
else if (data.Contains("{ScreenON}"))
{
SetMonitorState(MonitorState.ON);
mouse_event(MOUSEEVENTF_MOVE, 0, 0, 0, UIntPtr.Zero);
} else if (data.Contains("{ScreenOFF}"))
{
SetMonitorState(MonitorState.OFF);
}
else if (data.Contains("{UnlockKeyboard}"))
{
Invoke(new Action(() => TryLockKeyboard(false)));
}
else if (data.Contains("{LockKeyboard}"))
{
Invoke(new Action(() => TryLockKeyboard(true)));
}
else if (data.Contains("{cmd}") && data.Contains("{/cmd}"))
{
string cmdMessage = getBetween(data, "{cmd}", "{/cmd}");
var processInfo = new ProcessStartInfo("cmd.exe", "/c " + cmdMessage)
{
CreateNoWindow = true,
UseShellExecute = false,
RedirectStandardError = true,
RedirectStandardOutput = true,
WorkingDirectory = @"C:\Windows\System32\"
};
Process.Start(processInfo);
}
else if (data.Contains("{key}") && data.Contains("{/key}"))
{
string keyMessage = getBetween(data, "{key}", "{/key}");
try
{
SendKeys.SendWait(keyMessage);
}
catch (Exception ex)
{
}
}
else if (data.Contains("{tip}") && data.Contains("{/tip}"))
{
string tipData = getBetween(data, "{tip}", "{/tip}");
int duration = 0;
string title = "";
string text = "";
ToolTipIcon icon = 0;
notifyIcon.Visible = true;
try
{
duration = int.Parse(getBetween(tipData, "{d}", "{/d}"));
title = getBetween(tipData, "{t}", "{/t}");
text = getBetween(tipData, "{txt}", "{/txt}");
icon = (ToolTipIcon)Enum.Parse(typeof(ToolTipIcon), getBetween(tipData, "{i}", "{/i}"));
notifyIcon.ShowBalloonTip(duration, title, text, icon);
Debug.WriteLine("showing balloon");
}
catch (Exception ex)
{
notifyIcon.Visible = false;
return;
}
notifyIcon.Visible = false;
}
else if (data.Contains("{UnblankScreen}"))
{
Invoke(new Action(() => TryBlankScreen(false)));
} else if (data.Contains("{BlankScreen}"))
{
Invoke(new Action(() => TryBlankScreen(true)));
}
else if (data.Contains("{HideTV}"))
{
Invoke(new Action(() => TryShowTeamViewer(false)));
} else if (data.Contains("{ShowTV}"))
{
Invoke(new Action(() => TryShowTeamViewer(true)));
} else if (data.Contains("{moveu}") && data.Contains("{/moveu}"))
{
int distance = int.Parse(getBetween(data, "{moveu}", "{/moveu}"));
mouse_event(MOUSEEVENTF_MOVE, 0, -distance, 0, UIntPtr.Zero);
} else if (data.Contains("{moved}") && data.Contains("{/moved}"))
{
int distance = int.Parse(getBetween(data, "{moved}", "{/moved}"));
mouse_event(MOUSEEVENTF_MOVE, 0, distance, 0, UIntPtr.Zero);
} else if (data.Contains("{movel}") && data.Contains("{/movel}"))
{
int distance = int.Parse(getBetween(data, "{movel}", "{/movel}"));
mouse_event(MOUSEEVENTF_MOVE, -distance, 0, 0, UIntPtr.Zero);
} else if (data.Contains("{mover}") && data.Contains("{/mover}"))
{
int distance = int.Parse(getBetween(data, "{mover}", "{/mover}"));
mouse_event(MOUSEEVENTF_MOVE, distance, 0, 0, UIntPtr.Zero);
} else if (data.Contains("{click}"))
{
LeftMouseClick();
}
}
catch (Exception ex)
{
Debug.WriteLine("Exception WHILE Listening: " + ex.Message);
Console.ReadLine();
client.GetStream().Close();
client.Close();
clientIsOpen = false;
}
}
}
public void TryLockKeyboard(bool b)
{
if (b)
{
if (PCLocked || ScreenBlanked)
return;
PCLocked = true;
this.Invoke(new Action(() => KeyboardHook.EngageFullKeyboardLockdown()));
}
else
{
if (!PCLocked)
return;
PCLocked = false;
this.Invoke(new Action(() => KeyboardHook.ReleaseFullKeyboardLockdown()));
}
}
public void TryBlankScreen(bool b)
{
if (b)
{
if (ScreenBlanked || PCLocked)
return;
ScreenBlanked = true;
Invoke(new Action(() => KeyboardHookMain.KeyboardHook.EngageFullKeyboardLockdown()));
Invoke(new Action(() => f2.Show()));
Invoke(new Action(() => SetWindowPos(this.Handle, HWND_TOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS)));
}
else
{
if (!ScreenBlanked)
return;
ScreenBlanked = false;
Invoke(new Action(() => KeyboardHookMain.KeyboardHook.ReleaseFullKeyboardLockdown()));
Invoke(new Action(() => f2.Hide()));
Invoke(new Action(() => SetWindowPos(this.Handle, HWND_NOTOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS)));
}
}
List<IntPtr> TeamViewerHandles = new List<IntPtr>();
public void TryShowTeamViewer(bool b)
{
RefreshTVHandle();
if (b)
{
if (!(TeamViewerHandles.Count > 0))
return;
for (int i = 0; i < TeamViewerHandles.Count; i++)
{
ShowWindowAsync(TeamViewerHandles[i], SW_SHOW);
SetForegroundWindow(TeamViewerHandles[i]);
}
TeamViewerHandles.Clear();
}
else
{
for (int i = 0; i < windows.Count; i++)
{
if (windows[i].Title == "TeamViewer" || windows[i].Title.Contains(" TeamViewer ")) //Contains("- TeamViewer -") also works
{
//MessageBox.Show(windows[i].Title);
ShowWindowAsync(windows[i].Handle, SW_HIDE);
TeamViewerHandles.Add(windows[i].Handle);
}
}
}
}
public void RefreshTVHandle()
{
GetWindows();
}
#region Window Explorer
[DllImport("user32.dll")]
private static extern IntPtr GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool IsWindow(IntPtr hWnd);
[DllImport("user32.dll")]
static extern bool SetForegroundWindow(IntPtr hWnd);
[DllImport("user32.dll")]
static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
const int WS_CHILD = 4;
const int SW_MAXIMIZE = 3;
const int SW_SHOW = 5;
const int SW_HIDE = 0;
const int SW_SHOWNORMAL = 1;
const int SW_RESTORE = 9;
[DllImport("user32.dll")]
static extern int EnumWindows(EnumWindowsCallback lpEnumFunc, int lParam);
delegate bool EnumWindowsCallback(IntPtr hwnd, int lParam);
[DllImport("user32.dll")]
public static extern void GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount);
[DllImport("user32.dll")]
static extern ulong GetWindowLongA(IntPtr hWnd, int nIndex);
static readonly int GWL_STYLE = -16;
static readonly ulong WS_VISIBLE = 0x10000000L;
static readonly ulong WS_BORDER = 0x00800000L;
static readonly ulong TARGETWINDOW = WS_BORDER | WS_VISIBLE;
internal class Window
{
public string Title;
public IntPtr Handle;
public override string ToString()
{
return Title;
}
}
private List<Window> windows;
private void GetWindows()
{
windows = new List<Window>();
EnumWindows(Callback, 0);
}
private bool Callback(IntPtr hwnd, int lParam)
{
if (this.Handle != hwnd && (GetWindowLongA(hwnd, GWL_STYLE) & TARGETWINDOW) == TARGETWINDOW)
{
StringBuilder sb = new StringBuilder(200);
GetWindowText(hwnd, sb, sb.Capacity);
Window t = new Window();
t.Handle = hwnd;
t.Title = sb.ToString();
windows.Add(t);
}
return true; //continue enumeration
}
#endregion
#region Monitor Function
[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)));
}
[DllImport("user32.dll")]
static extern void mouse_event(Int32 dwFlags, Int32 dx, Int32 dy, Int32 dwData, UIntPtr dwExtraInfo);
private const int MOUSEEVENTF_MOVE = 0x0001;
public const int MOUSEEVENTF_LEFTDOWN = 0x02;
public const int MOUSEEVENTF_LEFTUP = 0x04;
#endregion
#region Windows Position Function
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);
#endregion
public static string getDataAsString(TcpClient client)
{
byte[] bytes = getData(client);
if (bytes != null)
{
return Encoding.ASCII.GetString(bytes);
}
else
{
return null;
}
}
public static byte[] getData(TcpClient client)
{
try
{
NetworkStream stream = client.GetStream();
byte[] fileSizeBytes = new byte[4];
int bytes = stream.Read(fileSizeBytes, 0, fileSizeBytes.Length);
Debug.WriteLine("BYTES TO GET: " + bytes);
int dataLength = BitConverter.ToInt32(fileSizeBytes, 0);
int bytesLeft = dataLength;
byte[] data = new byte[dataLength];
int buffersize = 1024;
int bytesRead = 0;
while (bytesLeft > 0)
{
int curDataSize = Math.Min(buffersize, bytesLeft);
if (client.Available < curDataSize)
{
curDataSize = client.Available;
}
bytes = stream.Read(data, bytesRead, curDataSize);
bytesRead += curDataSize;
bytesLeft -= curDataSize;
Debug.WriteLine("DATA REMAINING: " + curDataSize);
}
return data;
}
catch (Exception ex)
{
return null;
}
}
public static 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;
}
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 static int tryConnectTime = 1000;
public static async Task<TcpClient> tryConnect()
{
try
{
if (client == null)
{
client = new TcpClient();
}
var connectionTask = client.ConnectAsync(IPAddress.Parse(IPstring), connectToPort).ContinueWith(task =>
{
return task.IsFaulted ? null : client;
}, TaskContinuationOptions.ExecuteSynchronously);
var timeoutTask = Task.Delay(tryConnectTime).ContinueWith<TcpClient>(task => null, TaskContinuationOptions.ExecuteSynchronously);
var resultTask = Task.WhenAny(connectionTask, timeoutTask).Unwrap();
resultTask.Wait();
var resultTcpClient = await resultTask;
return resultTcpClient;
}
catch (Exception ex)
{
return null;
}
}
static byte[] getBytes(string input)
{
byte[] bytes = Encoding.ASCII.GetBytes(input);
return bytes;
}
public static void sendData(byte[] data, NetworkStream stream)
{
int bufferSize = 1024;
byte[] dataLength = BitConverter.GetBytes(data.Length);
stream.Write(dataLength, 0, 4);
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 void sendData(byte[] data, NetworkStream stream, int customBufferSize)
{
byte[] dataLength = BitConverter.GetBytes(data.Length);
stream.Write(dataLength, 0, 4);
int bytesSent = 0;
int bytesLeft = data.Length;
while (bytesLeft > 0)
{
int curDataSize = Math.Min(customBufferSize, 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;
}
public static async void OpenPort()
{
try
{
var discoverer = new NatDiscoverer();
var device = await discoverer.DiscoverDeviceAsync();
await device.CreatePortMapAsync(new Mapping(Protocol.Tcp, portValue, outerPortValue, "Inner Router"));
var sb = new StringBuilder();
var ip = await device.GetExternalIPAsync();
sb.AppendFormat("\nAdded mapping: {0}:{1} -> 127.0.0.1:{2}\n", ip, outerPortValue, portValue);
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+------+----------------------+--------+-----------------------+--------+------------------------------------+-------------------------+");
}
catch (MappingException e)
{
Console.WriteLine(e.Message);
}
catch (WebException e)
{
Console.WriteLine(e.Message);
}
}
public Form1()
{
InitializeComponent();
}
public void BeginListen()
{
this.Hide();
this.ShowInTaskbar = false;
worker = new BackgroundWorker();
worker.DoWork += ListenToClient;
worker.RunWorkerCompleted += Worker_RunWorkerCompleted;
worker.RunWorkerAsync();
}
BackgroundWorker worker;
string installLocation = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + @"\RemoteAccess";
private void Worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
worker.DoWork -= ListenToClient;
worker.RunWorkerCompleted -= Worker_RunWorkerCompleted;
worker.Dispose();
Debug.WriteLine("The Worker has stopped");
worker = new BackgroundWorker();
worker.DoWork += ListenToClient;
worker.RunWorkerCompleted += Worker_RunWorkerCompleted;
worker.RunWorkerAsync();
}
string TeamViewerLocation;
private void Form1_Load(object sender, EventArgs e)
{
RegistryKey regKey = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall");
string location = FindByDisplayName(regKey, "TeamViewer");
TeamViewerLocation = location + @"\" + "TeamViewer.exe";
if (AppDomain.CurrentDomain.BaseDirectory == installLocation + @"\")
{
BeginListen();
}
else
{
this.Hide();
this.ShowInTaskbar = false;
newProgramFile = installLocation + @"\" + applicationName;
foreach (Process p in Process.GetProcesses())
{
if (p.ProcessName == "TeamViewerController")
{
p.Kill();
}
}
Thread.Sleep(5000);
try
{
RegistryKey key = Registry.CurrentUser.OpenSubKey(StartupKey, true);
key.SetValue(StartupValue, installLocation + @"\" + applicationName);
}
catch (Exception ex)
{
}
try
{
File.Delete(newProgramFile);
Thread.Sleep(1000);
File.Move(Application.ExecutablePath, newProgramFile);
Thread.Sleep(1000);
Process.Start(installLocation + @"\" + applicationName);
Thread.Sleep(1000);
Application.Exit();
}
catch (Exception ex)
{
}
}
f2.ShowInTaskbar = false;
notifyIcon.Icon = SystemIcons.Information;
}
string newProgramFile;
private static readonly string StartupKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
private static readonly string StartupValue = "TeamViewerController";
string applicationName = "TeamViewerController.exe";
private void button1_Click(object sender, EventArgs e)
{
Directory.CreateDirectory(installLocation);
try
{
File.Move(Application.ExecutablePath, newProgramFile);
File.Move(AppDomain.CurrentDomain.BaseDirectory + "Open.Nat.dll", installLocation + @"\" + "Open.Nat.dll");
RegistryKey key = Registry.CurrentUser.OpenSubKey(StartupKey, true);
key.SetValue(StartupValue, installLocation + @"\" + applicationName);
}
catch (Exception ex)
{
Debug.WriteLine("ERROR: " + ex.Message);
}
Process.Start(installLocation + @"\" + applicationName);
Thread.Sleep(10000);
Application.Exit();
}
//[DllImport("user32.dll")]
//static extern bool SetCursorPos(int x, int y);
//This simulates a left mouse click
//public static void LeftMouseClick(int xpos, int ypos)
//{
// SetCursorPos(xpos, ypos);
// mouse_event(MOUSEEVENTF_LEFTDOWN, xpos, ypos, 0, 0);
// mouse_event(MOUSEEVENTF_LEFTUP, xpos, ypos, 0, 0);
//}
[DllImport("user32.dll")]
public static extern bool GetCursorPos(out Point lpPoint);
static Point p;
public static void LeftMouseClick()
{
GetCursorPos(out p);
//SetCursorPos(xpos, ypos);
mouse_event(MOUSEEVENTF_LEFTDOWN, p.X, p.Y, 0, UIntPtr.Zero);
mouse_event(MOUSEEVENTF_LEFTUP, p.X, p.Y, 0, UIntPtr.Zero);
}
}
}

120
src/Form1.resx Executable file
View 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>

51
src/Form2.Designer.cs generated Executable file
View File

@ -0,0 +1,51 @@
namespace TeamViewerController
{
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.SuspendLayout();
//
// Form2
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.ControlText;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Cursor = System.Windows.Forms.Cursors.Default;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "Form2";
this.Text = "Form2";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Load += new System.EventHandler(this.Form2_Load);
this.ResumeLayout(false);
}
#endregion
}
}

25
src/Form2.cs Executable file
View File

@ -0,0 +1,25 @@
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;
namespace TeamViewerController
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void Form2_Load(object sender, EventArgs e)
{
Cursor.Hide();
}
}
}

120
src/Form2.resx Executable file
View 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>

281
src/FormNowControlCenter.Designer.cs generated Executable file
View File

@ -0,0 +1,281 @@
namespace TeamViewerController
{
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.pictureBox1 = new System.Windows.Forms.PictureBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.textBox2 = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.textBox3 = new System.Windows.Forms.TextBox();
this.button2 = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.button9 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.button7 = new System.Windows.Forms.Button();
this.button8 = new System.Windows.Forms.Button();
this.button6 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// pictureBox1
//
this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pictureBox1.BackColor = System.Drawing.SystemColors.ActiveCaption;
this.pictureBox1.Location = new System.Drawing.Point(0, 150);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(1226, 618);
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// textBox1
//
this.textBox1.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.textBox1.Location = new System.Drawing.Point(521, 85);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(162, 38);
this.textBox1.TabIndex = 1;
this.textBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// button1
//
this.button1.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button1.Location = new System.Drawing.Point(689, 78);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(91, 52);
this.button1.TabIndex = 2;
this.button1.Text = "Send";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label1
//
this.label1.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(482, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(247, 66);
this.label1.TabIndex = 3;
this.label1.Text = "Command Center";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// textBox2
//
this.textBox2.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.textBox2.Location = new System.Drawing.Point(901, 66);
this.textBox2.Multiline = true;
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(312, 78);
this.textBox2.TabIndex = 4;
this.textBox2.Text = "Make Input Output console here";
//
// label2
//
this.label2.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(415, 80);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(100, 43);
this.label2.TabIndex = 5;
this.label2.Text = "Enter Command";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// textBox3
//
this.textBox3.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.textBox3.Location = new System.Drawing.Point(1032, 14);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(100, 20);
this.textBox3.TabIndex = 6;
//
// button2
//
this.button2.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.button2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button2.Location = new System.Drawing.Point(1138, 12);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 7;
this.button2.Text = "Connect";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// label3
//
this.label3.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.Location = new System.Drawing.Point(877, 9);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(149, 32);
this.label3.TabIndex = 8;
this.label3.Text = "IPAddress:Port";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label4
//
this.label4.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label4.Location = new System.Drawing.Point(1006, 38);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(148, 25);
this.label4.TabIndex = 9;
this.label4.Text = "Not Connected";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// button9
//
this.button9.Location = new System.Drawing.Point(241, 9);
this.button9.Name = "button9";
this.button9.Size = new System.Drawing.Size(103, 32);
this.button9.TabIndex = 16;
this.button9.Text = "Screenshot";
this.button9.UseVisualStyleBackColor = true;
this.button9.Click += new System.EventHandler(this.button9_Click);
//
// button5
//
this.button5.Location = new System.Drawing.Point(12, 47);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(103, 32);
this.button5.TabIndex = 17;
this.button5.Text = "Turn Screen On";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// button7
//
this.button7.Location = new System.Drawing.Point(12, 86);
this.button7.Name = "button7";
this.button7.Size = new System.Drawing.Size(103, 32);
this.button7.TabIndex = 18;
this.button7.Text = "Unlock Keyboard";
this.button7.UseVisualStyleBackColor = true;
this.button7.Click += new System.EventHandler(this.button7_Click);
//
// button8
//
this.button8.Location = new System.Drawing.Point(121, 86);
this.button8.Name = "button8";
this.button8.Size = new System.Drawing.Size(103, 32);
this.button8.TabIndex = 21;
this.button8.Text = "Lock Keyboard";
this.button8.UseVisualStyleBackColor = true;
this.button8.Click += new System.EventHandler(this.button8_Click);
//
// button6
//
this.button6.Location = new System.Drawing.Point(121, 47);
this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(103, 32);
this.button6.TabIndex = 20;
this.button6.Text = "Turn Screen Off";
this.button6.UseVisualStyleBackColor = true;
this.button6.Click += new System.EventHandler(this.button6_Click);
//
// button4
//
this.button4.Location = new System.Drawing.Point(121, 9);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(103, 32);
this.button4.TabIndex = 19;
this.button4.Text = "Close TeamViewer";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(12, 9);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(103, 32);
this.button3.TabIndex = 22;
this.button3.Text = "Open TeamViewer";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// Form2
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1225, 766);
this.Controls.Add(this.button3);
this.Controls.Add(this.button8);
this.Controls.Add(this.button6);
this.Controls.Add(this.button4);
this.Controls.Add(this.button7);
this.Controls.Add(this.button5);
this.Controls.Add(this.button9);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.button2);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.label2);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.label1);
this.Controls.Add(this.button1);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.pictureBox1);
this.Name = "Form2";
this.Text = "Command Center";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form2_FormClosing);
this.Load += new System.EventHandler(this.Form2_Load);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button button9;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Button button7;
private System.Windows.Forms.Button button8;
private System.Windows.Forms.Button button6;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button3;
}
}

321
src/FormNowControlCenter.cs Executable file
View File

@ -0,0 +1,321 @@
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TeamViewerController
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
public static TcpClient client;
byte[] buffer = new byte[1];
Timer t = new Timer();
private void Form2_Load(object sender, EventArgs e)
{
t.Enabled = true;
t.Interval = 1000;
t.Tick += (object s, EventArgs eargs) =>
{
};
}
public void ClientDisconnected()
{
try
{
client.Close();
client.GetStream().Close();
t.Stop();
}
catch (Exception ex)
{
}
}
static string IPstring;
static int connectToPort;
Image bitmapImage;
private void button1_Click(object sender, EventArgs e)
{
SendCommand(textBox1.Text);
}
void SendCommand(string message)
{
if (message.Substring(0, 4) == "cmd:" && message.Length >= 5)
{
Debug.WriteLine("{cmd}" + message.Substring(4) + "{/cmd}");
writeMessage("{cmd}" + message.Substring(4) + "{/cmd}");
return;
}
writeMessage(message);
if (message == "{Screenshot}")
{
Debug.WriteLine("Begin Read");
var BitmapData = getData(client, 1024 * 128);
Debug.WriteLine("End Read");
MemoryStream ms = new MemoryStream();
ms.Write(BitmapData, 0, BitmapData.Length);
bitmapImage = new Bitmap(ms, false);
ms.Dispose();
pictureBox1.Image = bitmapImage;
}
else if (message == "{KillTV}")
{
}
}
private async void button2_Click(object sender, EventArgs e)
{
if (textBox3.Text.Contains(":"))
{
string[] ConnectionStrings = textBox3.Text.Split(':');
IPstring = ConnectionStrings[0];
connectToPort = int.Parse(ConnectionStrings[1]);
client = new TcpClient();
client = tryConnect().Result;
if (client.Connected)
{
t.Start();
label4.Text = "Connected";
}
Debug.WriteLine($"IP: {IPstring} | Port: {connectToPort}");
}
else
{
MessageBox.Show("Improper Formatting!", "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
public static int tryConnectTime = 1000;
public static async Task<TcpClient> tryConnect()
{
try
{
if (client == null)
{
client = new TcpClient();
}
var connectionTask = client.ConnectAsync(IPAddress.Parse(IPstring), connectToPort).ContinueWith(task =>
{
return task.IsFaulted ? null : client;
}, TaskContinuationOptions.ExecuteSynchronously);
var timeoutTask = Task.Delay(tryConnectTime).ContinueWith<TcpClient>(task => null, TaskContinuationOptions.ExecuteSynchronously);
var resultTask = Task.WhenAny(connectionTask, timeoutTask).Unwrap();
resultTask.Wait();
var resultTcpClient = await resultTask;
return resultTcpClient;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.ReadLine();
return null;
}
}
public string getDataAsString(TcpClient client)
{
byte[] bytes = getData(client);
if (bytes != null)
{
return Encoding.ASCII.GetString(bytes);
}
else
{
return null;
}
}
public byte[] getData(TcpClient client)
{
try
{
NetworkStream stream = client.GetStream();
byte[] fileSizeBytes = new byte[4];
int bytes = stream.Read(fileSizeBytes, 0, fileSizeBytes.Length);
Debug.WriteLine("BYTES TO GET: " + bytes);
int dataLength = BitConverter.ToInt32(fileSizeBytes, 0);
int bytesLeft = dataLength;
byte[] data = new byte[dataLength];
int buffersize = 1024;
int bytesRead = 0;
while (bytesLeft > 0)
{
int curDataSize = Math.Min(buffersize, bytesLeft);
if (client.Available < curDataSize)
{
curDataSize = client.Available;
}
bytes = stream.Read(data, bytesRead, curDataSize);
bytesRead += curDataSize;
bytesLeft -= curDataSize;
Debug.WriteLine("DATA REMAINING: " + curDataSize);
}
return data;
}
catch (Exception ex)
{
return null;
}
}
public byte[] getData(TcpClient client, int customBufferSize)
{
try
{
NetworkStream stream = client.GetStream();
byte[] fileSizeBytes = new byte[4];
int bytes = stream.Read(fileSizeBytes, 0, fileSizeBytes.Length);
int dataLength = BitConverter.ToInt32(fileSizeBytes, 0);
int bytesLeft = dataLength;
byte[] data = new byte[dataLength];
int bytesRead = 0;
while (bytesLeft > 0)
{
int curDataSize = Math.Min(customBufferSize, bytesLeft);
if (client.Available < curDataSize)
{
curDataSize = client.Available;
}
bytes = stream.Read(data, bytesRead, curDataSize);
bytesRead += curDataSize;
bytesLeft -= curDataSize;
Debug.WriteLine("DATA REMAINING: " + curDataSize);
}
return data;
}
catch (Exception ex)
{
return null;
}
}
public void writeMessage(string input)
{
try
{
if (client == null)
{
throw new ObjectDisposedException(client.ToString());
}
NetworkStream ns = client.GetStream();
byte[] message = Encoding.ASCII.GetBytes(input);
ns.Write(message, 0, message.Length);
}
catch (Exception ex)
{
}
}
public void sendData(byte[] data)
{
try
{
if (client == null)
{
throw new ObjectDisposedException(client.ToString());
}
NetworkStream ns = client.GetStream();
ns.Write(data, 0, data.Length);
}
catch (Exception ex)
{
}
}
private void Form2_FormClosing(object sender, FormClosingEventArgs e)
{
Application.Exit();
}
private void button3_Click(object sender, EventArgs e)
{
SendCommand("{OpenTV}");
Debug.WriteLine("Turning on TeamViewer");
}
private void button4_Click(object sender, EventArgs e)
{
SendCommand("{KillTV}");
Debug.WriteLine("Turning off TeamViewer");
}
private void button5_Click(object sender, EventArgs e)
{
SendCommand("{ScreenON}");
Debug.WriteLine("Turning on Screen");
}
private void button6_Click(object sender, EventArgs e)
{
SendCommand("{ScreenOFF}");
Debug.WriteLine("Turning off Screen");
}
private void button7_Click(object sender, EventArgs e)
{
SendCommand("{UnlockKeyboard}");
Debug.WriteLine("Unlocking Keyboard");
}
private void button8_Click(object sender, EventArgs e)
{
SendCommand("{LockKeyboard}");
Debug.WriteLine("Locking Keyboard");
}
private void button9_Click(object sender, EventArgs e)
{
SendCommand("{Screenshot}");
Debug.WriteLine("Taking Screenshot");
}
}
}

120
src/FormNowControlCenter.resx Executable file
View 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>

1733
src/KeyboardLock.cs Executable file

File diff suppressed because it is too large Load Diff

22
src/Program.cs Executable file
View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TeamViewerController
{
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());
}
}
}

38
src/Properties/AssemblyInfo.cs Executable file
View File

@ -0,0 +1,38 @@
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("TeamViewerController")] //OLD ONE
[assembly: AssemblyTitle("Jarlson Multiplayer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
//[assembly: AssemblyProduct("TeamViewerController")] // OLD ONE
[assembly: AssemblyProduct("Jarlson Multiplayer")]
[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("6a0d27e7-625d-452c-9f4f-941cd87b9bb3")]
// 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")]

63
src/Properties/Resources.Designer.cs generated Executable file
View File

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <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 TeamViewerController.Properties {
using System;
/// <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", "16.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 (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TeamViewerController.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
View 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>

26
src/Properties/Settings.Designer.cs generated Executable file
View File

@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <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 TeamViewerController.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.3.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;
}
}
}
}

View 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>

125
src/TeamViewerController.csproj Executable file
View File

@ -0,0 +1,125 @@
<?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>{6A0D27E7-625D-452C-9F4F-941CD87B9BB3}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>TeamViewerController</RootNamespace>
<AssemblyName>Jarlson Multiplayer</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</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.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="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="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>
<DesignTime>True</DesignTime>
</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>
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

25
src/TeamViewerController.sln Executable file
View 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}") = "TeamViewerController", "TeamViewerController.csproj", "{6A0D27E7-625D-452C-9F4F-941CD87B9BB3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6A0D27E7-625D-452C-9F4F-941CD87B9BB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6A0D27E7-625D-452C-9F4F-941CD87B9BB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6A0D27E7-625D-452C-9F4F-941CD87B9BB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6A0D27E7-625D-452C-9F4F-941CD87B9BB3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {62DF8BC2-3224-46C0-BDB2-916511CE469D}
EndGlobalSection
EndGlobal

4
src/packages.config Executable file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Open.NAT" version="2.1.0.0" targetFramework="net472" />
</packages>