Exemple #1
0
        static void Client_OnMessageReceived(TCPLibrary.Core.Client sender, TCPLibrary.MessageBased.Core.TCPMessage Mess)
        {
            TCPMessage msg;
            switch (Mess.MessageType)
            {
                case TCPLibrary.MessageBased.Core.MessageType.Connect:
                    break;
                case TCPLibrary.MessageBased.Core.MessageType.MaxUsers:
                    break;
                case TCPLibrary.MessageBased.Core.MessageType.SizeDump:
                    SendDumpSize();
                    break;
                case MessageType.Statistics:
                    SendStatistics();
                    break;
                case MessageType.SetDebugMode:
                    wrap.DebugMode = (Boolean)Mess.Parameters[0];

                    msg = new TCPMessage();
                    msg.MessageType = MessageType.GetDebugMode;
                    msg.Parameters.Add(wrap.DebugMode);
                    Client.Send(msg);

                    if (wrap.DebugMode)
                    {
                        msg = new TCPMessage();
                        msg.MessageType = MessageType.DebugState;
                        msg.Parameters.AddRange(wrap.GetGifPackets(dump));
                        Client.Send(msg);

                        msg = new TCPMessage();
                        msg.MessageType = MessageType.Step;
                        msg.Parameters.Add(dump.Data.FindIndex(a => a == wrap.CurrentGIFPacket));
                        Client.Send(msg);
                    }
                    break;
                case MessageType.GetDebugMode:
                    msg = new TCPMessage();
                    msg.MessageType = MessageType.GetDebugMode;
                    msg.Parameters.Add(wrap.DebugMode);
                    Client.Send(msg);

                    if (wrap.DebugMode)
                    {
                        msg = new TCPMessage();
                        msg.MessageType = MessageType.DebugState;
                        msg.Parameters.AddRange(wrap.GetGifPackets(dump));
                        Client.Send(msg);

                        msg = new TCPMessage();
                        msg.MessageType = MessageType.Step;
                        msg.Parameters.Add(dump.Data.FindIndex(a => a == wrap.CurrentGIFPacket));
                        Client.Send(msg);
                    }
                    break;

                case MessageType.PacketInfo:
                    int id = (int)Mess.Parameters[0];
                    msg = new TCPMessage();
                    msg.MessageType = MessageType.PacketInfo;
                    msg.Parameters.Add(wrap.GetGifPacketInfo(dump, id));
                    Client.Send(msg);
                    break;
                case MessageType.Step:
                case MessageType.RunToCursor:
                case MessageType.RunToNextVSync:
                    wrap.ExternalEvent.WaitOne();
                    wrap.ExternalEvent.Reset();
                    wrap.QueueMessage.Enqueue(Mess);
                    wrap.ThereIsWork = true;
                    break;
                default:
                    break;
            }
        }
Exemple #2
0
 static void Server_OnClientAfterConnect(TCPLibrary.Core.Server server, TCPLibrary.Core.ClientS sender)
 {
     Clients.Add((TCPLibrary.MessageBased.Core.BaseMessageClientS)sender);
     RefreshList(true);
 }
Exemple #3
0
 static void Server_OnClientAfterDisconnected(TCPLibrary.Core.Server server, TCPLibrary.Core.ClientS sender)
 {
     Clients.Remove((TCPLibrary.MessageBased.Core.BaseMessageClientS)sender);
     RefreshList(false);
 }