Ejemplo n.º 1
0
        private Turtle Handshake(string label, HttpListenerResponse response, string args)
        {
            CleanUp();
            if (turtles.ContainsKey(label))
            {
                if (isNewTurtle(label))
                {
                    label = CreateUniqueName();
                }
            }


            byte[] buffer = System.Text.Encoding.UTF8.GetBytes(label);
            response.ContentLength64 = buffer.Length;
            response.OutputStream.Write(buffer, 0, buffer.Length);

            var turtle = new Turtle(label);

            turtles.Add(label, turtle);
            turtle.args = args;
            Program.webserver.UpdateList();
            return(turtle);
        }
Ejemplo n.º 2
0
        public static void AddTurtle(Turtle turtle)
        {
            var client = Clients.Values.FirstOrDefault(c => turtle.Label.Contains(c.Username));

            AddTurtle(client, turtle);
        }