private static GeneralistProto Chat(string Order) { GeneralistProto proto = new GeneralistProto { Type = CmdTarget.Chat, Chat = new Chat { Msg = Order } }; return(proto); }
private static GeneralistProto List(string Order) { GeneralistProto proto = new GeneralistProto { Type = CmdTarget.Servercmd, Servercmd = new CServer { Cmd = CServer.Types.Cmd.Listing } }; return(proto); }
private static GeneralistProto Hand(string Order) { GeneralistProto proto = new GeneralistProto { Type = CmdTarget.Gamecmd, Gamecmd = new CGame { Cmd = CGame.Types.Cmd.Hand } }; return(proto); }
public void Send(ref GeneralistProto proto) { try { var data = proto.ToByteArray(); State.Socket.Send(data); } catch (Exception e) { Console.Error.WriteLine(e.ToString()); Environment.Exit(84); } }
public static GeneralistProto Generate(string Order) { GeneralistProto Proto = null; string keyResult = keys.FirstOrDefault <string>(s => Order.Contains(s)); switch (keyResult) { case "#CREATE": Proto = Create(Order); break; case "#JOIN": Proto = Join(Order); break; case "#LIST": Proto = List(Order); break; case "#USERNAME": Proto = Username(Order); break; case "#TEAM": Proto = Team(Order); break; case "#CARD": Proto = Card(Order); break; case "#CONTRACT": Proto = Contract(Order); break; case "#HAND": Proto = Hand(Order); break; case "#EXIT": Environment.Exit(0); break; default: Proto = Chat(Order); break; } return(Proto); }
private static GeneralistProto Team(string Order) { if (Order.Length < 6) { return(null); } GeneralistProto proto = new GeneralistProto { Type = CmdTarget.Lobbycmd, Lobbycmd = new CLobby { Cmd = CLobby.Types.Cmd.Team, Team = (Order.Substring(6).Equals("BLUE")) ? CoincheClient.Team.Blue : CoincheClient.Team.Red } }; return(proto); }
private static GeneralistProto Username(string Order) { if (Order.Length < 10) { return(null); } GeneralistProto proto = new GeneralistProto { Type = CmdTarget.Lobbycmd, Lobbycmd = new CLobby { Cmd = CLobby.Types.Cmd.Username, Value = Order.Substring(10) } }; return(proto); }
private static GeneralistProto Join(string Order) { if (Order.Length < 6) { return(null); } GeneralistProto proto = new GeneralistProto { Type = CmdTarget.Servercmd, Servercmd = new CServer { Cmd = CServer.Types.Cmd.Join, Value = Order.Substring(6) } }; return(proto); }
private static GeneralistProto Contract(string Order) { if (Order.Length < 10) { return(null); } GeneralistProto proto = new GeneralistProto { Type = CmdTarget.Gamecmd, Gamecmd = new CGame { Cmd = CGame.Types.Cmd.Contract, Value = Order.Substring(10) } }; return(proto); }
private static void ConnectAndStart() { Console.Out.WriteLine("Please insert your name, you little peace of shit:"); var name = Console.In.ReadLine(); AsyncClient client = new AsyncClient("localhost", 42000); client.Start(); GeneralistProto proto = new GeneralistProto { Type = CmdTarget.Authentification, Auth = new Authentification { Name = name }, //optional timestamp }; client.Send(ref proto); StartInteraction(ref client); }