Minecraft-Console-Client/MinecraftClient/Proxy/Handlers/Utils.cs
ORelio d2ec2f48b7 App refactoring almost done
- Created specific namespaces and folders for each app brick
- Added proxy support using Starksoft's Biko Library
- App bricks: Main, ChatBots, Crypto, Protocol, Proxy
- Each class is now in its own file (Aes streams, chatbots)
- Used "Bridge" design pattern for Crypto, Protocol, Proxy
- Added back support for Minecraft 1.4.6 to 1.6.4 (MCC 1.6.2)
- Need to fully re-test everything and fix bugs
- To Fix : Server pinging is slow on SpigotMC
- To Do : Add Minecraft 1.2.5 (MCC 1.3) and maybe 1.3 to 1.4.5
2014-05-31 01:59:03 +02:00

43 lines
997 B
C#

using System;
using System.Text;
using System.Globalization;
using System.Net.Sockets;
namespace Starksoft.Net.Proxy
{
internal static class Utils
{
internal static string GetHost(TcpClient client)
{
if (client == null)
throw new ArgumentNullException("client");
string host = "";
try
{
host = ((System.Net.IPEndPoint)client.Client.RemoteEndPoint).Address.ToString();
}
catch
{ };
return host;
}
internal static string GetPort(TcpClient client)
{
if (client == null)
throw new ArgumentNullException("client");
string port = "";
try
{
port = ((System.Net.IPEndPoint)client.Client.RemoteEndPoint).Port.ToString(CultureInfo.InvariantCulture);
}
catch
{ };
return port;
}
}
}