Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        private static void StartInteraction(ref AsyncClient client)
        {
            string Order;

            while (true)
            {
                GeneralistProto proto;

                Order = Console.In.ReadLine();
                proto = OrderFactory.Generate(Order);
                if (proto == null)
                {
                    Console.Out.Write("Error in the given command\n");
                    continue;
                }
                client.Send(ref proto);
            }
        }