2014.07.20.
This commit is contained in:
parent
d748bd729f
commit
6f855aaa35
17 changed files with 1359 additions and 0 deletions
22
Connection forwarder.sln
Normal file
22
Connection forwarder.sln
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Express 2013 for Windows Desktop
|
||||||
|
VisualStudioVersion = 12.0.21005.1
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Connection forwarder", "Connection forwarder\Connection forwarder.csproj", "{8FA8C951-B4EE-4176-83E2-54F7EA4115A2}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{8FA8C951-B4EE-4176-83E2-54F7EA4115A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{8FA8C951-B4EE-4176-83E2-54F7EA4115A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{8FA8C951-B4EE-4176-83E2-54F7EA4115A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{8FA8C951-B4EE-4176-83E2-54F7EA4115A2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
6
Connection forwarder/App.config
Normal file
6
Connection forwarder/App.config
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<configuration>
|
||||||
|
<startup>
|
||||||
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||||
|
</startup>
|
||||||
|
</configuration>
|
95
Connection forwarder/Connection forwarder.csproj
Normal file
95
Connection forwarder/Connection forwarder.csproj
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="12.0" DefaultTargets="Build" 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>{8FA8C951-B4EE-4176-83E2-54F7EA4115A2}</ProjectGuid>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Connection_forwarder</RootNamespace>
|
||||||
|
<AssemblyName>Connection forwarder</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
</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="Cyotek.Data.Nbt">
|
||||||
|
<HintPath>..\..\..\..\..\Downloads\Cyotek.Data.Nbt-master\Cyotek.Data.Nbt-master\Cyotek.Data.Nbt\bin\Debug\Cyotek.Data.Nbt.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.Windows.Forms" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="ConnectionThread.cs" />
|
||||||
|
<Compile Include="Form1.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Form1.Designer.cs">
|
||||||
|
<DependentUpon>Form1.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="ListenThread.cs" />
|
||||||
|
<Compile Include="PCPackets.cs" />
|
||||||
|
<Compile Include="PEPackets.cs" />
|
||||||
|
<Compile Include="Program.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<EmbeddedResource Include="Form1.resx">
|
||||||
|
<DependentUpon>Form1.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="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>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
89
Connection forwarder/ConnectionThread.cs
Normal file
89
Connection forwarder/ConnectionThread.cs
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net.Sockets;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Cyotek.Data.Nbt;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
namespace Connection_forwarder
|
||||||
|
{
|
||||||
|
class ClientConnectionThread
|
||||||
|
{
|
||||||
|
public void Run(object sckt)
|
||||||
|
{
|
||||||
|
Thread.CurrentThread.Name = "ConnectionThread";
|
||||||
|
Form1.Threads.Add(Thread.CurrentThread);
|
||||||
|
//var connsocket = ((Socket[])sckt)[0];
|
||||||
|
object connsocket;
|
||||||
|
if (!Form1.PEVersion)
|
||||||
|
connsocket = ((object[])sckt)[0] as Socket;
|
||||||
|
else
|
||||||
|
connsocket = ((UdpClient)((object[])sckt)[0]);
|
||||||
|
//var serversock = new Socket(SocketType.Stream, ProtocolType.Tcp);
|
||||||
|
//serversock.Connect("localhost", Form1.PortNumber);
|
||||||
|
//while (connsocket.Available > 0)
|
||||||
|
var serversock = ((Socket)((object[])sckt)[1]);
|
||||||
|
//new NetworkStream(connsocket).CopyToAsync(new NetworkStream(serversock));
|
||||||
|
//new NetworkStream(serversock).CopyTo(new NetworkStream(connsocket));
|
||||||
|
if (!Form1.PEVersion)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
new NetworkStream(connsocket as Socket).CopyTo(new NetworkStream(serversock));
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
(connsocket as Socket).Close();
|
||||||
|
serversock.Close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class ServerConnectionThread
|
||||||
|
{
|
||||||
|
public void Run(object sckt)
|
||||||
|
{
|
||||||
|
Thread.CurrentThread.Name = "ConnectionThread";
|
||||||
|
Form1.Threads.Add(Thread.CurrentThread);
|
||||||
|
object connsocket;
|
||||||
|
if (!Form1.PEVersion)
|
||||||
|
connsocket = ((object[])sckt)[0] as Socket;
|
||||||
|
else
|
||||||
|
connsocket = ((UdpClient)((object[])sckt)[0]);
|
||||||
|
//var serversock = new Socket(SocketType.Stream, ProtocolType.Tcp);
|
||||||
|
//serversock.Connect("localhost", Form1.PortNumber);
|
||||||
|
//while (connsocket.Available > 0)
|
||||||
|
var serversock = ((Socket)((object[])sckt)[1]);
|
||||||
|
//new NetworkStream(connsocket).CopyToAsync(new NetworkStream(serversock));
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!Form1.PEVersion)
|
||||||
|
new NetworkStream(serversock).CopyTo(new NetworkStream(connsocket as Socket));
|
||||||
|
|
||||||
|
/*var nsc = new NetworkStream(connsocket);
|
||||||
|
var nss = new NetworkStream(serversock);
|
||||||
|
var tr = new BinaryTagReader(nss, NbtOptions.None);
|
||||||
|
var tw = new BinaryTagWriter(nsc, NbtOptions.None);
|
||||||
|
byte[] ba;
|
||||||
|
while (!tr.ReadString().Contains("Blocks"))
|
||||||
|
{
|
||||||
|
nss.CopyTo(nsc);
|
||||||
|
}
|
||||||
|
ba = tr.ReadByteArray();
|
||||||
|
Console.WriteLine("Byte array: " + ba);
|
||||||
|
for (int i = 0; i < ba.Length; i++)
|
||||||
|
tw.Write(ba[i]);*/
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
(connsocket as Socket).Close();
|
||||||
|
serversock.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
151
Connection forwarder/Form1.Designer.cs
generated
Normal file
151
Connection forwarder/Form1.Designer.cs
generated
Normal file
|
@ -0,0 +1,151 @@
|
||||||
|
namespace Connection_forwarder
|
||||||
|
{
|
||||||
|
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.portBox = new System.Windows.Forms.TextBox();
|
||||||
|
this.startbtn = new System.Windows.Forms.Button();
|
||||||
|
this.startforwardbtn = new System.Windows.Forms.Button();
|
||||||
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
|
this.portBox2 = new System.Windows.Forms.TextBox();
|
||||||
|
this.radioButton1 = new System.Windows.Forms.RadioButton();
|
||||||
|
this.radioButton2 = new System.Windows.Forms.RadioButton();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// portBox
|
||||||
|
//
|
||||||
|
this.portBox.Location = new System.Drawing.Point(105, 71);
|
||||||
|
this.portBox.Name = "portBox";
|
||||||
|
this.portBox.Size = new System.Drawing.Size(57, 20);
|
||||||
|
this.portBox.TabIndex = 0;
|
||||||
|
this.portBox.Text = "25565";
|
||||||
|
//
|
||||||
|
// startbtn
|
||||||
|
//
|
||||||
|
this.startbtn.Location = new System.Drawing.Point(169, 71);
|
||||||
|
this.startbtn.Name = "startbtn";
|
||||||
|
this.startbtn.Size = new System.Drawing.Size(75, 23);
|
||||||
|
this.startbtn.TabIndex = 1;
|
||||||
|
this.startbtn.Text = "Start test";
|
||||||
|
this.startbtn.UseVisualStyleBackColor = true;
|
||||||
|
this.startbtn.Click += new System.EventHandler(this.startbtn_Click);
|
||||||
|
//
|
||||||
|
// startforwardbtn
|
||||||
|
//
|
||||||
|
this.startforwardbtn.Location = new System.Drawing.Point(90, 202);
|
||||||
|
this.startforwardbtn.Name = "startforwardbtn";
|
||||||
|
this.startforwardbtn.Size = new System.Drawing.Size(89, 23);
|
||||||
|
this.startforwardbtn.TabIndex = 2;
|
||||||
|
this.startforwardbtn.Text = "Start forwarding";
|
||||||
|
this.startforwardbtn.UseVisualStyleBackColor = true;
|
||||||
|
this.startforwardbtn.Click += new System.EventHandler(this.startforwardbtn_Click);
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
this.label1.AutoSize = true;
|
||||||
|
this.label1.Location = new System.Drawing.Point(45, 76);
|
||||||
|
this.label1.Name = "label1";
|
||||||
|
this.label1.Size = new System.Drawing.Size(54, 13);
|
||||||
|
this.label1.TabIndex = 3;
|
||||||
|
this.label1.Text = "Server IP:";
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
this.label2.AutoSize = true;
|
||||||
|
this.label2.Location = new System.Drawing.Point(37, 106);
|
||||||
|
this.label2.Name = "label2";
|
||||||
|
this.label2.Size = new System.Drawing.Size(62, 13);
|
||||||
|
this.label2.TabIndex = 4;
|
||||||
|
this.label2.Text = "Program IP:";
|
||||||
|
//
|
||||||
|
// portBox2
|
||||||
|
//
|
||||||
|
this.portBox2.Location = new System.Drawing.Point(105, 103);
|
||||||
|
this.portBox2.Name = "portBox2";
|
||||||
|
this.portBox2.Size = new System.Drawing.Size(57, 20);
|
||||||
|
this.portBox2.TabIndex = 5;
|
||||||
|
this.portBox2.Text = "8888";
|
||||||
|
//
|
||||||
|
// radioButton1
|
||||||
|
//
|
||||||
|
this.radioButton1.AutoSize = true;
|
||||||
|
this.radioButton1.Location = new System.Drawing.Point(40, 129);
|
||||||
|
this.radioButton1.Name = "radioButton1";
|
||||||
|
this.radioButton1.Size = new System.Drawing.Size(132, 17);
|
||||||
|
this.radioButton1.TabIndex = 6;
|
||||||
|
this.radioButton1.TabStop = true;
|
||||||
|
this.radioButton1.Text = "PC Version (for testing)";
|
||||||
|
this.radioButton1.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// radioButton2
|
||||||
|
//
|
||||||
|
this.radioButton2.AutoSize = true;
|
||||||
|
this.radioButton2.Checked = true;
|
||||||
|
this.radioButton2.Location = new System.Drawing.Point(40, 153);
|
||||||
|
this.radioButton2.Name = "radioButton2";
|
||||||
|
this.radioButton2.Size = new System.Drawing.Size(77, 17);
|
||||||
|
this.radioButton2.TabIndex = 7;
|
||||||
|
this.radioButton2.TabStop = true;
|
||||||
|
this.radioButton2.Text = "PE Version";
|
||||||
|
this.radioButton2.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// Form1
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(284, 262);
|
||||||
|
this.Controls.Add(this.radioButton2);
|
||||||
|
this.Controls.Add(this.radioButton1);
|
||||||
|
this.Controls.Add(this.portBox2);
|
||||||
|
this.Controls.Add(this.label2);
|
||||||
|
this.Controls.Add(this.label1);
|
||||||
|
this.Controls.Add(this.startforwardbtn);
|
||||||
|
this.Controls.Add(this.startbtn);
|
||||||
|
this.Controls.Add(this.portBox);
|
||||||
|
this.Name = "Form1";
|
||||||
|
this.Text = "Form1";
|
||||||
|
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Form1_FormClosed);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.TextBox portBox;
|
||||||
|
private System.Windows.Forms.Button startbtn;
|
||||||
|
private System.Windows.Forms.Button startforwardbtn;
|
||||||
|
private System.Windows.Forms.Label label1;
|
||||||
|
private System.Windows.Forms.Label label2;
|
||||||
|
private System.Windows.Forms.TextBox portBox2;
|
||||||
|
private System.Windows.Forms.RadioButton radioButton1;
|
||||||
|
private System.Windows.Forms.RadioButton radioButton2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
70
Connection forwarder/Form1.cs
Normal file
70
Connection forwarder/Form1.cs
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
using System.Net.Sockets;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace Connection_forwarder
|
||||||
|
{
|
||||||
|
public partial class Form1 : Form
|
||||||
|
{
|
||||||
|
public static int PortNumber;
|
||||||
|
public static int PortNumber2;
|
||||||
|
public static bool PEVersion;
|
||||||
|
public static List<Thread> Threads = new List<Thread>();
|
||||||
|
|
||||||
|
public Form1()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
Threads.Add(Thread.CurrentThread);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void startbtn_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var s = new Socket(SocketType.Stream, ProtocolType.Tcp);
|
||||||
|
//s.Connect("localhost", Int32.Parse(portBox.Text));
|
||||||
|
s.Bind(new IPEndPoint(IPAddress.Parse("127.0.0.1"), Int32.Parse(portBox.Text)));
|
||||||
|
s.Listen(2);
|
||||||
|
s = s.Accept();
|
||||||
|
var a = new NetworkStream(s);
|
||||||
|
byte[] buffer = new byte[512];
|
||||||
|
a.Read(buffer, 0, 512);
|
||||||
|
MessageBox.Show("Contents:\n" + buffer.ToString());
|
||||||
|
s.Close();
|
||||||
|
MessageBox.Show(Encoding.ASCII.GetString(buffer));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void startforwardbtn_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
PortNumber = Int32.Parse(portBox.Text);
|
||||||
|
PortNumber2 = Int32.Parse(portBox2.Text);
|
||||||
|
PEVersion = radioButton2.Checked;
|
||||||
|
new Thread(new ThreadStart(ListenThread.Run)).Start();
|
||||||
|
startforwardbtn.Enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
|
||||||
|
{
|
||||||
|
/*for (int i = 1; i < Threads.Count; i++) //For a fairly long time it stopped itself, now it skips that...
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Threads[i].Abort();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Application.Exit();
|
||||||
|
Application.ExitThread();*/
|
||||||
|
Environment.Exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
Connection forwarder/Form1.resx
Normal file
120
Connection forwarder/Form1.resx
Normal 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>
|
188
Connection forwarder/ListenThread.cs
Normal file
188
Connection forwarder/ListenThread.cs
Normal file
|
@ -0,0 +1,188 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
using System.Net.Sockets;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Connection_forwarder
|
||||||
|
{
|
||||||
|
class ListenThread
|
||||||
|
{
|
||||||
|
public static void Run()
|
||||||
|
{
|
||||||
|
Thread.CurrentThread.Name = "ListenThread";
|
||||||
|
Form1.Threads.Add(Thread.CurrentThread);
|
||||||
|
Socket listensocket;
|
||||||
|
//UdpClient listenclient = new UdpClient(Form1.PortNumber2);
|
||||||
|
UdpClient listenclient;
|
||||||
|
if (!Form1.PEVersion)
|
||||||
|
{
|
||||||
|
//var listensocket = new Socket(SocketType.Stream, ProtocolType.Tcp);
|
||||||
|
listensocket = new Socket(SocketType.Stream, ProtocolType.Tcp);
|
||||||
|
listensocket.Bind(new IPEndPoint(IPAddress.Parse("127.0.0.1"), Form1.PortNumber2));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
listensocket = new Socket(SocketType.Dgram, ProtocolType.Udp); //Just for it to not give "no object" error
|
||||||
|
//listensocket.Bind(new IPEndPoint(IPAddress.Parse("127.0.0.1"), Form1.PortNumber2));
|
||||||
|
//listensocket.Bind(new IPEndPoint(Program.GetLocalIP(), Form1.PortNumber2));
|
||||||
|
}
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
if (!Form1.PEVersion)
|
||||||
|
{
|
||||||
|
listensocket.Listen(10);
|
||||||
|
//var connsocket = listensocket.Accept();
|
||||||
|
Socket[] connsocket = new Socket[2];
|
||||||
|
connsocket[0] = listensocket.Accept();
|
||||||
|
connsocket[1] = new Socket(SocketType.Stream, ProtocolType.Tcp);
|
||||||
|
connsocket[1].Connect("localhost", Form1.PortNumber);
|
||||||
|
new Thread(new ParameterizedThreadStart(new ClientConnectionThread().Run)).Start(connsocket);
|
||||||
|
new Thread(new ParameterizedThreadStart(new ServerConnectionThread().Run)).Start(connsocket);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* PE connection:
|
||||||
|
* When player joins start a thread and open connection to server
|
||||||
|
* When player leaves or times out disconnect from the server with matching data sent
|
||||||
|
*
|
||||||
|
* So basically handle the PE join here to know when to start a new thread
|
||||||
|
*/
|
||||||
|
|
||||||
|
//byte[] buffer = new byte[1500];
|
||||||
|
byte[] buffer;
|
||||||
|
var RemoteIP=new IPEndPoint(IPAddress.Any, Form1.PortNumber2);
|
||||||
|
listenclient = new UdpClient(Form1.PortNumber2);
|
||||||
|
buffer = listenclient.Receive(ref RemoteIP);
|
||||||
|
listenclient.Close();
|
||||||
|
//RemoteIP.Port = 19132;
|
||||||
|
//Console.WriteLine(String.Format("Hex: %x", buffer[0]));
|
||||||
|
//Console.WriteLine("Hex: {0:X}", buffer[0]);
|
||||||
|
//bool stop = false;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
bool brvar = false;
|
||||||
|
if (buffer[0] != PEPackets.TOSERVER_ID_OPEN_CONNECTION_REQUEST_1)
|
||||||
|
break;
|
||||||
|
for (int i = 0; i < PEPackets.MAGIC.Length; i++)
|
||||||
|
{
|
||||||
|
if (buffer[i + 1] != PEPackets.MAGIC[i])
|
||||||
|
{
|
||||||
|
Console.WriteLine("There is no magic for this client...");
|
||||||
|
brvar = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (brvar)
|
||||||
|
break;
|
||||||
|
Console.WriteLine("Magic accepted.");
|
||||||
|
//var sendsocket = new Socket(SocketType.Dgram, ProtocolType.Udp);
|
||||||
|
var sendsocket = new UdpClient(Form1.PortNumber2);
|
||||||
|
//sendsocket.Connect(RemoteIP);
|
||||||
|
sendsocket.EnableBroadcast = true;
|
||||||
|
//sendsocket.Connect(IPAddress.Broadcast, RemoteIP.Port);
|
||||||
|
sendsocket.Connect(RemoteIP);
|
||||||
|
if (buffer[PEPackets.MAGIC.Length + 1] != PEPackets.ProtocolVer)
|
||||||
|
{
|
||||||
|
new PEPackets(PEPackets.TOCLIENT_ID_INCOMPATIBLE_PROTOCOL_VERSION, new object[] { PEPackets.ProtocolVer, PEPackets.MAGIC, 0x00000000372cdc9e }, sendsocket, RemoteIP); //ID_INCOMPATIBLE_PROTOCOL_VERSION (0x1A)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
new PEPackets(PEPackets.TOCLIENT_ID_OPEN_CONNECTION_REPLY_1, new object[] { PEPackets.MAGIC, 0x00000000372cdc9e, 0, 1447 }, sendsocket, RemoteIP);
|
||||||
|
sendsocket.Close();
|
||||||
|
Console.WriteLine("Open connection 1 succeed.");
|
||||||
|
|
||||||
|
listenclient = new UdpClient(Form1.PortNumber2);
|
||||||
|
buffer = listenclient.Receive(ref RemoteIP);
|
||||||
|
listenclient.Close();
|
||||||
|
//RemoteIP.Port = 19132;
|
||||||
|
if (buffer[0] != PEPackets.TOSERVER_ID_OPEN_CONNECTION_REQUEST_2)
|
||||||
|
break;
|
||||||
|
brvar = false;
|
||||||
|
for (int i = 0; i < PEPackets.MAGIC.Length; i++)
|
||||||
|
{
|
||||||
|
if (buffer[i + 1] != PEPackets.MAGIC[i])
|
||||||
|
{
|
||||||
|
Console.WriteLine("There is no magic for this client...");
|
||||||
|
brvar = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (brvar)
|
||||||
|
break;
|
||||||
|
byte[] bufferPart = new byte[5];
|
||||||
|
Array.Copy(buffer, PEPackets.MAGIC.Length + 1, bufferPart, 0, 5);
|
||||||
|
//if (bufferPart != BitConverter.GetBytes(0x043f57fefd))
|
||||||
|
for (int i = 0; i < bufferPart.Length; i++)
|
||||||
|
{
|
||||||
|
if (bufferPart[i] != 0x00)
|
||||||
|
{
|
||||||
|
brvar = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (brvar)
|
||||||
|
break;
|
||||||
|
Array.Copy(buffer, PEPackets.MAGIC.Length + 6, bufferPart = new byte[2], 0, 2);
|
||||||
|
//if (bufferPart != BitConverter.GetBytes((short)19132))
|
||||||
|
//var bytes = BitConverter.GetBytes((short)19132);
|
||||||
|
/*for (int i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
|
if (bufferPart[i] != bytes[i])
|
||||||
|
{
|
||||||
|
brvar = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (brvar)
|
||||||
|
break;*/
|
||||||
|
short ServerPortFromClient = BitConverter.ToInt16(bufferPart, 0);
|
||||||
|
Console.WriteLine("ServerPortFromClient: " + ServerPortFromClient);
|
||||||
|
Array.Copy(buffer, PEPackets.MAGIC.Length + 8, bufferPart, 0, 2);
|
||||||
|
//if (bufferPart != BitConverter.GetBytes((short)1464))
|
||||||
|
short MTUSize = BitConverter.ToInt16(bufferPart, 0);
|
||||||
|
Console.WriteLine("MTUSize: " + MTUSize);
|
||||||
|
Array.Copy(buffer, PEPackets.MAGIC.Length + 10, bufferPart = new byte[8], 0, 8);
|
||||||
|
//long ClientID = Convert.ToInt64(bufferPart);
|
||||||
|
long ClientID = BitConverter.ToInt64(bufferPart, 0);
|
||||||
|
Console.WriteLine("ClientID: " + ClientID);
|
||||||
|
sendsocket = new UdpClient(Form1.PortNumber2);
|
||||||
|
//sendsocket.EnableBroadcast = true;
|
||||||
|
sendsocket.Connect(RemoteIP);
|
||||||
|
new PEPackets(PEPackets.TOCLIENT_ID_OPEN_CONNECTION_REPLY_2, new object[] { PEPackets.MAGIC, 0x00000000372cdc9e, Form1.PortNumber2, 1464, 0 }, sendsocket, RemoteIP);
|
||||||
|
sendsocket.Close();
|
||||||
|
|
||||||
|
listenclient = new UdpClient(Form1.PortNumber2);
|
||||||
|
buffer = listenclient.Receive(ref RemoteIP);
|
||||||
|
Console.WriteLine("Received: 0x{0:X}", buffer[0]);
|
||||||
|
Console.WriteLine("Second byte: 0x{0:X}", buffer[1]);
|
||||||
|
listenclient.Close();
|
||||||
|
|
||||||
|
sendsocket = new UdpClient(Form1.PortNumber2);
|
||||||
|
//sendsocket.EnableBroadcast = true;
|
||||||
|
sendsocket.Connect(RemoteIP);
|
||||||
|
new PEPackets(PEPackets.TOCLIENT_LoginStatusPacket, new object[] { 0 }, sendsocket, RemoteIP);
|
||||||
|
sendsocket.Close();
|
||||||
|
//-----------------------------
|
||||||
|
/*object[] connsocket = new object[2];
|
||||||
|
//if(buffer[0]==PEPackets)
|
||||||
|
connsocket[0] = listenclient;
|
||||||
|
connsocket[1] = new Socket(SocketType.Stream, ProtocolType.Tcp); //We still need to connect to the server
|
||||||
|
((Socket)connsocket[1]).Connect("localhost", Form1.PortNumber);
|
||||||
|
new Thread(new ParameterizedThreadStart(new ClientConnectionThread().Run)).Start(connsocket);
|
||||||
|
new Thread(new ParameterizedThreadStart(new ServerConnectionThread().Run)).Start(connsocket);*/
|
||||||
|
} while (false);
|
||||||
|
}
|
||||||
|
//for (int i = 0; i < 2; i++)
|
||||||
|
//new Thread(new ParameterizedThreadStart(new ClientConnectionThread().Run)).Start(connsocket);
|
||||||
|
//var serversock = new Socket(SocketType.Stream, ProtocolType.Tcp);
|
||||||
|
//serversock.Connect("localhost", Form1.PortNumber);
|
||||||
|
//new Thread(new ParameterizedThreadStart(new ServerConnectionThread().Run)).Start(serversock);
|
||||||
|
//new Thread(new ParameterizedThreadStart(new ServerConnectionThread().Run)).Start(connsocket);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
197
Connection forwarder/PCPackets.cs
Normal file
197
Connection forwarder/PCPackets.cs
Normal file
|
@ -0,0 +1,197 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net.Sockets;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Connection_forwarder
|
||||||
|
{
|
||||||
|
class PCPackets
|
||||||
|
{
|
||||||
|
//public static List<PCPacket> Packets = new List<PCPacket>();
|
||||||
|
//public static readonly Dictionary<string, byte> PacketNames = new Dictionary<string, byte>();
|
||||||
|
/* http://wiki.vg/Pre-release_protocol */
|
||||||
|
/// <summary>
|
||||||
|
/// <para>Gamemode Unsigned Byte 0: survival, 1: creative, 2: adventure. Bit 3 (0x8) is the hardcore flag</para>
|
||||||
|
/// <para>Dimension Byte -1: nether, 0: overworld, 1: end</para>
|
||||||
|
/// <para>Difficulty Unsigned Byte 0 thru 3 for Peaceful, Easy, Normal, Hard</para>
|
||||||
|
/// <para>Max Players Unsigned Byte Used by the client to draw the player list</para>
|
||||||
|
/// <para>Level Type String default, flat, largeBiomes, amplified, default_1_1</para>
|
||||||
|
/// <para>Reduced Debug Info Boolean</para>
|
||||||
|
/// </summary>
|
||||||
|
public static readonly byte PLAY_TOCLIENT_JOIN_GAME = 0x01;
|
||||||
|
/// <summary>
|
||||||
|
/// <para>Json data: string; Chat, Limited to 32767 bytes</para>
|
||||||
|
/// <para>Position: byte; 0 - Chat (chat box) ,1 - System Message (chat box), 2 - Above action bar</para>
|
||||||
|
/// </summary>
|
||||||
|
public static readonly byte PLAY_TOCLIENT_CHAT_MESSAGE = 0x02;
|
||||||
|
/// <summary>
|
||||||
|
/// <para>EntityID VarInt Entity's ID</para>
|
||||||
|
/// <para>Slot Short Equipment slot: 0=held, 1-4=armor slot (1 - boots, 2 - leggings, 3 - chestplate, 4 - helmet</para>
|
||||||
|
/// <para>Item Slot Item in slot format</para>
|
||||||
|
/// </summary>
|
||||||
|
public static readonly byte PLAY_TOCLIENT_ENTITY_EQUIPMENT = 0x04;
|
||||||
|
/// <summary>
|
||||||
|
/// <para>Sent by the server after login to specify the coordinates of the spawn point (the point at which players spawn at, and which the compass points to). It can be sent at any time to update the point compasses point at.</para>
|
||||||
|
/// <para>0x05 Location Position Spawn location</para>
|
||||||
|
/// </summary>
|
||||||
|
public static readonly byte PLAY_TOCLIENT_SPAWN_POSITION = 0x05;
|
||||||
|
/// <summary>
|
||||||
|
/// <para>Sent by the server to update/set the health of the player it is sent to.</para>
|
||||||
|
/// <para>Food saturation acts as a food "overcharge". Food values will not decrease while the saturation is over zero. Players logging in automatically get a saturation of 5.0. Eating food increases the saturation as well as the food bar.</para>
|
||||||
|
/// <para>Health Float 0 or less = dead, 20 = full HP</para>
|
||||||
|
/// <para>Food VarInt 0 - 20</para>
|
||||||
|
/// <para>Food Saturation Float Seems to vary from 0.0 to 5.0 in integer increments</para>
|
||||||
|
/// </summary>
|
||||||
|
public static readonly byte PLAY_TOCLIENT_UPDATE_HEALTH = 0x06;
|
||||||
|
/// <summary>
|
||||||
|
/// <para>Updates the players position on the server. If the distance between the last known position of the player on the server and the new position set by this packet is greater than 100 units will result in the client being kicked for "You moved too quickly :( (Hacking?)" Also if the fixed-point number of X or Z is set greater than 3.2E7D the client will be kicked for "Illegal position"</para>
|
||||||
|
/// <para>Yaw is measured in degrees, and does not follow classical trigonometry rules. The unit circle of yaw on the XZ-plane starts at (0, 1) and turns counterclockwise, with 90 at (-1, 0), 180 at (0,-1) and 270 at (1, 0). Additionally, yaw is not clamped to between 0 and 360 degrees; any number is valid, including negative numbers and numbers greater than 360.</para>
|
||||||
|
/// <para>Pitch is measured in degrees, where 0 is looking straight ahead, -90 is looking straight up, and 90 is looking straight down.</para>
|
||||||
|
/// <para>The yaw of player (in degrees), standing at point (x0,z0) and looking towards point (x,z) one can be calculated with:</para>
|
||||||
|
/// <para> l = x-x0</para>
|
||||||
|
/// <para> w = z-z0</para>
|
||||||
|
/// <para> c = sqrt( l*l + w*w )</para>
|
||||||
|
/// <para> alpha1 = -arcsin(l/c)/PI*180</para>
|
||||||
|
/// <para> alpha2 = arccos(w/c)/PI*180</para>
|
||||||
|
/// <para> if alpha2 > 90 then</para>
|
||||||
|
/// <para> yaw = 180 - alpha1</para>
|
||||||
|
/// <para> else</para>
|
||||||
|
/// <para> yaw = alpha1</para>
|
||||||
|
/// <para>You can get a unit vector from a given yaw/pitch via:</para>
|
||||||
|
/// <para> x = -cos(pitch) * sin(yaw)</para>
|
||||||
|
/// <para> y = -sin(pitch)</para>
|
||||||
|
/// <para> z = cos(pitch) * cos(yaw)</para>
|
||||||
|
/// <para>About the flags field:</para>
|
||||||
|
/// <para> (Dinnerbone) It's a bitfield, X/Y/Z/Y_ROT/X_ROT. If X is set, the x value is relative and not absolute.</para>
|
||||||
|
/// <para>X Double Absolute/Relative position</para>
|
||||||
|
/// <para>Y Double Absolute/Relative position</para>
|
||||||
|
/// <para>Z Double Absolute/Relative position</para>
|
||||||
|
/// <para>Yaw Float Absolute/Relative rotation on the X Axis, in degrees</para>
|
||||||
|
/// <para>Pitch Float Absolute/Relative rotation on the Y Axis, in degrees</para>
|
||||||
|
/// <para>Flags Byte </para>
|
||||||
|
/// <para>X 0x01</para>
|
||||||
|
/// <para>Y 0x02</para>
|
||||||
|
/// <para>Z 0x04</para>
|
||||||
|
/// <para>Y_ROT 0x08</para>
|
||||||
|
/// <para>X_ROT 0x10;</para>
|
||||||
|
/// </summary>
|
||||||
|
public static readonly byte PLAY_TOCLIENT_PLAYER_POSITION_AND_LOOK = 0x08;
|
||||||
|
/// <summary>
|
||||||
|
/// <para>This packet tells that a player goes to bed.</para>
|
||||||
|
/// <para>The client with the matching Entity ID will go into bed mode.</para>
|
||||||
|
/// <para>This Packet is sent to all nearby players including the one sent to bed.</para>
|
||||||
|
/// <para>Entity ID VarInt Player ID</para>
|
||||||
|
/// <para>Location Position Block location of the head part of the bed</para>
|
||||||
|
/// </summary>
|
||||||
|
public static readonly byte PLAY_TOCLIENT_USE_BED = 0x0A;
|
||||||
|
/// <summary>
|
||||||
|
/// <para>This packet tells that a player goes to bed.</para>
|
||||||
|
/// <para>This packet is sent by the server when a player comes into visible range, not when a player joins.</para>
|
||||||
|
/// <para>Servers can, however, safely spawn player entities for players not in visible range. The client appears to handle it correctly.</para>
|
||||||
|
/// <para>When in online-mode the uuids must be valid and have valid skin blobs, in offline-mode uuid v3 is used.</para>
|
||||||
|
/// <para>For NPCs UUID v2 should be used. Note:</para>
|
||||||
|
/// <para>(+Grum) i will never confirm this as a feature you know that :)</para>
|
||||||
|
/// <para>Entity ID VarInt Player's Entity ID</para>
|
||||||
|
/// <para>Player UUID UUID Player's UUID</para>
|
||||||
|
/// <para>X Int Player X as a Fixed-Point number</para>
|
||||||
|
/// <para>Y Int Player X as a Fixed-Point number</para>
|
||||||
|
/// <para>Z Int Player X as a Fixed-Point number</para>
|
||||||
|
/// <para>Yaw Byte Player rotation as a packed byte</para>
|
||||||
|
/// <para>Pitch Byte Player rotation as a packet byte</para>
|
||||||
|
/// <para>Current Item Short The item the player is currently holding. Note that this should be 0 for "no item", unlike -1 used in other packets. A negative value crashes clients.</para>
|
||||||
|
/// <para>Metadata Metadata The client will crash if no metadata is sent</para>
|
||||||
|
/// </summary>
|
||||||
|
public static readonly byte PLAY_TOCLIENT_SPAWN_PLAYER = 0x0C;
|
||||||
|
/// <summary>
|
||||||
|
/// <para>This packet tells that a player goes to bed.</para>
|
||||||
|
/// <para>Sent by the server when someone picks up an item lying on the ground - its sole purpose appears to be the animation of the item flying towards you. It doesn't destroy the entity in the client memory, and it doesn't add it to your inventory. The server only checks for items to be picked up after each Player Position and [Player Position & Look packet sent by the client.</para>
|
||||||
|
/// <para>Collected Entity ID VarInt</para>
|
||||||
|
/// <para>Collector Entity ID VarInt</para>
|
||||||
|
/// </summary>
|
||||||
|
public static readonly byte PLAY_TOCLIENT_COLLECT_ITEM = 0x0A;
|
||||||
|
/// <summary>
|
||||||
|
/// <para>This packet shows location, name, and type of painting.</para>
|
||||||
|
/// <para>Calculating the center of an image: given a (width x height) grid of cells, with (0, 0) being the top left corner, the center is (max(0, width / 2 - 1), height / 2). E.g.</para>
|
||||||
|
/// <para>2x1 (1, 0) 4x4 (1, 2)</para>
|
||||||
|
/// <para>Entity ID VarInt Entity's ID</para>
|
||||||
|
/// <para>Title String Name of the painting. Max length 13</para>
|
||||||
|
/// <para>Location Position Center coordinates</para>
|
||||||
|
/// <para>Direction Unsigned Byte Direction the painting faces (0 -z, 1 -x, 2 +z, 3 +x)</para>
|
||||||
|
/// </summary>
|
||||||
|
public static readonly byte PLAY_TOCLIENT_SPAWN_PAINTING = 0x10;
|
||||||
|
/// <summary>
|
||||||
|
/// <para>Velocity is believed to be in units of 1/8000 of a block per server tick (50ms); for example, -1343 would move (-1343 / 8000) = −0.167875 blocks per tick (or −3,3575 blocks per second).</para>
|
||||||
|
/// <para>Entity ID VarInt Entity's ID</para>
|
||||||
|
/// <para>Velocity X Short Velocity on the X axis</para>
|
||||||
|
/// <para>Velocity Y Short Velocity on the Y axis</para>
|
||||||
|
/// <para>Velocity Z Short Velocity on the Z axis</para>
|
||||||
|
/// </summary>
|
||||||
|
public static readonly byte PLAY_TOCLIENT_ENTITY_VELOCITY = 0x12;
|
||||||
|
/// <summary>
|
||||||
|
/// <para>Sent by the server when an list of Entities is to be destroyed on the client.</para>
|
||||||
|
/// <para>Entity ID VarInt Entity's ID</para>
|
||||||
|
/// <para>Count VarInt Length of following array</para>
|
||||||
|
/// <para>Entity IDs Array of VarInt The list of entities of destroy</para>
|
||||||
|
/// </summary>
|
||||||
|
public static readonly byte PLAY_TOCLIENT_DESTROY_ENTITIES = 0x13;
|
||||||
|
|
||||||
|
public PCPackets(byte packetid, object[] data, Socket sock)
|
||||||
|
{
|
||||||
|
//Prepare all possible packets
|
||||||
|
//Packets.Add(new PCPacket(0x02, "Chat"));
|
||||||
|
//Packets[0].Function = Packets[0].Callback;
|
||||||
|
/*Packets[0].Function = delegate(object[] asd)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
};*/
|
||||||
|
var tmp=new List<byte>();
|
||||||
|
tmp.Add(packetid);
|
||||||
|
for(int i=0; i<data.Length; i++)
|
||||||
|
{
|
||||||
|
if (data.GetType() == typeof(bool))
|
||||||
|
tmp.AddRange(BitConverter.GetBytes((bool)data[i]));
|
||||||
|
else if (data.GetType() == typeof(char))
|
||||||
|
tmp.AddRange(BitConverter.GetBytes((char)data[i]));
|
||||||
|
else if (data.GetType() == typeof(double))
|
||||||
|
tmp.AddRange(BitConverter.GetBytes((double)data[i]));
|
||||||
|
else if (data.GetType() == typeof(float))
|
||||||
|
tmp.AddRange(BitConverter.GetBytes((float)data[i]));
|
||||||
|
else if (data.GetType() == typeof(int))
|
||||||
|
tmp.AddRange(BitConverter.GetBytes((int)data[i]));
|
||||||
|
else if (data.GetType() == typeof(long))
|
||||||
|
tmp.AddRange(BitConverter.GetBytes((long)data[i]));
|
||||||
|
else if (data.GetType() == typeof(short))
|
||||||
|
tmp.AddRange(BitConverter.GetBytes((short)data[i]));
|
||||||
|
else if (data.GetType() == typeof(uint))
|
||||||
|
tmp.AddRange(BitConverter.GetBytes((uint)data[i]));
|
||||||
|
else if (data.GetType() == typeof(ulong))
|
||||||
|
tmp.AddRange(BitConverter.GetBytes((ushort)data[i]));
|
||||||
|
else if (data.GetType() == typeof(ushort))
|
||||||
|
tmp.AddRange(BitConverter.GetBytes((ushort)data[i]));
|
||||||
|
}
|
||||||
|
sock.Send(tmp.ToArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*class PCPacket
|
||||||
|
{
|
||||||
|
public byte PacketID { get; private set; }
|
||||||
|
public object[] Contents { get; set; }
|
||||||
|
public string PacketName { get; private set; }
|
||||||
|
internal delegate void FunctionT(params object[] asd);
|
||||||
|
public FunctionT Function;
|
||||||
|
|
||||||
|
//public PCPacket(byte packetid, params object[] contents)
|
||||||
|
public PCPacket(byte packetid, string packetname)
|
||||||
|
{
|
||||||
|
PacketID = packetid;
|
||||||
|
PacketName = packetname;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal bool Callback(Type[] types, object[] parameters)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
}
|
119
Connection forwarder/PEPackets.cs
Normal file
119
Connection forwarder/PEPackets.cs
Normal file
|
@ -0,0 +1,119 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
using System.Net.Sockets;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Connection_forwarder
|
||||||
|
{
|
||||||
|
class PEPackets
|
||||||
|
{
|
||||||
|
//public static byte[] MAGIC = BitConverter.GetBytes(0x00ffff00fefefefefdfdfdfd12345678);
|
||||||
|
//public static readonly MAGIC MAGIC = (char)Convert.ChangeType("0x00ffff00fefefefefdfdfdfd12345678", typeof(char));
|
||||||
|
//public static readonly MAGIC MAGIC = new byte[16] { 0x00, 0xff, 0xff, 0x00, 0xfe, 0xfe, 0xfe, 0xfe, 0xfd, 0xfd, 0xfd, 0xfd, 0x12, 0x34, 0x56, 0x78 };
|
||||||
|
public static readonly byte[] MAGIC = new byte[16] { 0, 255, 255, 0, 254, 254, 254, 254, 253, 253, 253, 253, 18, 52, 86, 120 };
|
||||||
|
public const byte ProtocolVer = 5;
|
||||||
|
/// <summary>
|
||||||
|
/// <para>Sent when the server doesn't support the RakNet protocol specified in 0x05.</para>
|
||||||
|
/// <para>Protocol Version byte 5 </para>
|
||||||
|
/// <para>MAGIC MAGIC </para>
|
||||||
|
/// <para>Server ID int64 0x00000000372cdc9e </para>
|
||||||
|
/// </summary>
|
||||||
|
public static readonly byte TOCLIENT_ID_INCOMPATIBLE_PROTOCOL_VERSION = 0x1A;
|
||||||
|
/// <summary>
|
||||||
|
/// <para>If the version is different than yours, reply with a ID_INCOMPATIBLE_PROTOCOL_VERSION (0x1A)</para>
|
||||||
|
/// <para>Sent from the client after the player taps on the server in the world list The client will repeatedly send this with reducing sizes until it successfully receives a reply. Observed behaviour is that the client will send packets ~0.5s apart in the following way, until it gets a 0x06 response packet, or reaches the end of these:</para>
|
||||||
|
/// <para>4 packets of Null Payload length of 1447</para>
|
||||||
|
/// <para>4 packets of Null Payload length of 1155</para>
|
||||||
|
/// <para>5 packets of Null Payload length of 531</para>
|
||||||
|
/// <para>If the server doesnt't reply the client, the client will display a "Connect Error" window</para>
|
||||||
|
/// <para>MAGIC MAGIC </para>
|
||||||
|
/// <para>RakNet Protocol Version byte 5 Check the Data Packet section for the current version</para>
|
||||||
|
/// <para>Null Payload many 0x00 bytes 0x00 * 1447 MTU (Maximum Transport Unit)</para>
|
||||||
|
/// <para>Total Size: 18 Bytes + length of Null Payload</para>
|
||||||
|
/// </summary>
|
||||||
|
public static readonly byte TOSERVER_ID_OPEN_CONNECTION_REQUEST_1 = 0x05;
|
||||||
|
public static readonly byte TOCLIENT_ID_OPEN_CONNECTION_REPLY_1 = 0x06;
|
||||||
|
public static readonly byte TOSERVER_ID_OPEN_CONNECTION_REQUEST_2 = 0x07;
|
||||||
|
public static readonly byte TOCLIENT_ID_OPEN_CONNECTION_REPLY_2 = 0x08;
|
||||||
|
public static readonly byte TOSERVER_ReadyPacket = 0x84;
|
||||||
|
public static readonly byte TOCLIENT_LoginStatusPacket = 0x83;
|
||||||
|
|
||||||
|
public PEPackets(byte packetid, object[] data, UdpClient sock, IPEndPoint ep)
|
||||||
|
{
|
||||||
|
var tmp = new List<byte>();
|
||||||
|
tmp.Add(packetid);
|
||||||
|
for (int i = 0; i < data.Length; i++)
|
||||||
|
{
|
||||||
|
if (!data[i].GetType().IsSubclassOf(typeof(Array)))
|
||||||
|
{
|
||||||
|
if (data[i].GetType() == typeof(bool))
|
||||||
|
tmp.AddRange(BitConverter.GetBytes((bool)data[i]));
|
||||||
|
else if (data[i].GetType() == typeof(char))
|
||||||
|
tmp.AddRange(BitConverter.GetBytes((char)data[i]));
|
||||||
|
else if (data[i].GetType() == typeof(short))
|
||||||
|
tmp.AddRange(BitConverter.GetBytes((short)data[i]));
|
||||||
|
else if (data[i].GetType() == typeof(int))
|
||||||
|
tmp.AddRange(BitConverter.GetBytes((int)data[i]));
|
||||||
|
else if (data[i].GetType() == typeof(long))
|
||||||
|
tmp.AddRange(BitConverter.GetBytes((long)data[i]));
|
||||||
|
else if (data[i].GetType() == typeof(double))
|
||||||
|
tmp.AddRange(BitConverter.GetBytes((double)data[i]));
|
||||||
|
else if (data[i].GetType() == typeof(float))
|
||||||
|
tmp.AddRange(BitConverter.GetBytes((float)data[i]));
|
||||||
|
else if (data[i].GetType() == typeof(uint))
|
||||||
|
tmp.AddRange(BitConverter.GetBytes((uint)data[i]));
|
||||||
|
else if (data[i].GetType() == typeof(ulong))
|
||||||
|
tmp.AddRange(BitConverter.GetBytes((ushort)data[i]));
|
||||||
|
else if (data[i].GetType() == typeof(ushort))
|
||||||
|
tmp.AddRange(BitConverter.GetBytes((ushort)data[i]));
|
||||||
|
else if (data[i].GetType() == typeof(byte))
|
||||||
|
tmp.Add((byte)data[i]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int j = 0; j < ((Array)data[i]).Length; j++)
|
||||||
|
{
|
||||||
|
if (((Array)data[i]).GetValue(j).GetType() == typeof(bool))
|
||||||
|
tmp.AddRange(BitConverter.GetBytes((bool)((Array)data[i]).GetValue(j)));
|
||||||
|
else if (((Array)data[i]).GetValue(j).GetType() == typeof(char))
|
||||||
|
tmp.AddRange(BitConverter.GetBytes((char)((Array)data[i]).GetValue(j)));
|
||||||
|
else if (((Array)data[i]).GetValue(j).GetType() == typeof(double))
|
||||||
|
tmp.AddRange(BitConverter.GetBytes((double)((Array)data[i]).GetValue(j)));
|
||||||
|
else if (((Array)data[i]).GetValue(j).GetType() == typeof(float))
|
||||||
|
tmp.AddRange(BitConverter.GetBytes((float)((Array)data[i]).GetValue(j)));
|
||||||
|
else if (((Array)data[i]).GetValue(j).GetType() == typeof(int))
|
||||||
|
tmp.AddRange(BitConverter.GetBytes((int)((Array)data[i]).GetValue(j)));
|
||||||
|
else if (((Array)data[i]).GetValue(j).GetType() == typeof(long))
|
||||||
|
tmp.AddRange(BitConverter.GetBytes((long)((Array)data[i]).GetValue(j)));
|
||||||
|
else if (((Array)data[i]).GetValue(j).GetType() == typeof(short))
|
||||||
|
tmp.AddRange(BitConverter.GetBytes((short)((Array)data[i]).GetValue(j)));
|
||||||
|
else if (((Array)data[i]).GetValue(j).GetType() == typeof(uint))
|
||||||
|
tmp.AddRange(BitConverter.GetBytes((uint)((Array)data[i]).GetValue(j)));
|
||||||
|
else if (((Array)data[i]).GetValue(j).GetType() == typeof(ulong))
|
||||||
|
tmp.AddRange(BitConverter.GetBytes((ushort)((Array)data[i]).GetValue(j)));
|
||||||
|
else if (((Array)data[i]).GetValue(j).GetType() == typeof(ushort))
|
||||||
|
tmp.AddRange(BitConverter.GetBytes((ushort)((Array)data[i]).GetValue(j)));
|
||||||
|
else if (((Array)data[i]).GetValue(j).GetType() == typeof(byte))
|
||||||
|
tmp.Add((byte)((Array)data[i]).GetValue(j));
|
||||||
|
else Console.WriteLine("Unknown type in array: " + ((Array)data[i]).GetValue(j).GetType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//sock.Send(tmp.ToArray());
|
||||||
|
//sock.SendTo(tmp.ToArray(), ep);
|
||||||
|
//sock.Send(tmp.ToArray(), tmp.Count, ep);
|
||||||
|
sock.Send(tmp.ToArray(), tmp.Count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*class MAGIC
|
||||||
|
{
|
||||||
|
public static implicit operator MAGIC(byte[] c)
|
||||||
|
{
|
||||||
|
return (MAGIC)c;
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
}
|
39
Connection forwarder/Program.cs
Normal file
39
Connection forwarder/Program.cs
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
using System.Net.Sockets;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace Connection_forwarder
|
||||||
|
{
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
public static IPAddress GetLocalIP()
|
||||||
|
{
|
||||||
|
IPHostEntry host;
|
||||||
|
IPAddress localIP = IPAddress.Parse("127.0.0.1");
|
||||||
|
host = Dns.GetHostEntry(Dns.GetHostName());
|
||||||
|
foreach (IPAddress ip in host.AddressList)
|
||||||
|
{
|
||||||
|
if (ip.AddressFamily == AddressFamily.InterNetwork)
|
||||||
|
{
|
||||||
|
//localIP = ip.ToString();
|
||||||
|
localIP = ip;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return localIP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
36
Connection forwarder/Properties/AssemblyInfo.cs
Normal file
36
Connection forwarder/Properties/AssemblyInfo.cs
Normal 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("Connection forwarder")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("Connection forwarder")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2014")]
|
||||||
|
[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("e640dcc1-8e62-4f41-8ef7-45734af0776d")]
|
||||||
|
|
||||||
|
// 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
Connection forwarder/Properties/Resources.Designer.cs
generated
Normal file
71
Connection forwarder/Properties/Resources.Designer.cs
generated
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.18444
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace Connection_forwarder.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("Connection_forwarder.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
Connection forwarder/Properties/Resources.resx
Normal file
117
Connection forwarder/Properties/Resources.resx
Normal 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
Connection forwarder/Properties/Settings.Designer.cs
generated
Normal file
30
Connection forwarder/Properties/Settings.Designer.cs
generated
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.18444
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace Connection_forwarder.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
Connection forwarder/Properties/Settings.settings
Normal file
7
Connection forwarder/Properties/Settings.settings
Normal 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>
|
2
Protocol - MinecraftCoalition.url
Normal file
2
Protocol - MinecraftCoalition.url
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[InternetShortcut]
|
||||||
|
URL=http://wiki.vg/Protocol
|
Loading…
Reference in a new issue