This repository has been archived on 2024-06-13. You can view files and clone it, but cannot push or open issues or pull requests.
Drew DeVault 605cbbc2a0 Add physics simulation to client
This allows the player to fall to the ground when they spawn.
2015-05-13 16:26:23 -06:00

44 lines
1.3 KiB
C#

using System;
using System.Net;
using System.Linq;
using System.Net.Sockets;
namespace TrueCraft.Client.Linux
{
public static class Program
{
[STAThread]
public static void Main(string[] args)
{
var client = new MultiplayerClient();
var game = new TrueCraftGame(client, ParseEndPoint(args[0]));
game.Run();
client.Disconnect();
}
private static IPEndPoint ParseEndPoint(string arg)
{
IPAddress address;
int port;
if (arg.Contains(':'))
{
// Both IP and port are specified
var parts = arg.Split(':');
if (!IPAddress.TryParse(parts[0], out address))
address = Resolve(parts[0]);
return new IPEndPoint(address, int.Parse(parts[1]));
}
if (IPAddress.TryParse(arg, out address))
return new IPEndPoint(address, 25565);
if (int.TryParse(arg, out port))
return new IPEndPoint(IPAddress.Loopback, port);
return new IPEndPoint(Resolve(arg), 25565);
}
private static IPAddress Resolve(string arg)
{
return Dns.GetHostEntry(arg).AddressList.FirstOrDefault(item => item.AddressFamily == AddressFamily.InterNetwork);
}
}
}