Exemplo n.º 1
0
        public void Execute(Message msg, EasyTcpServer server)
        {
            Packet        pack = msg.GetPacket;
            List <object> objs = BytesTransformation.TransformToObject(BytesCompress.Decompress(pack.RawData), typeof(string));

            ServerEvents.Debug?.Invoke($"Command Received: {objs[0].ToString()}");
            MainLogic.GetInstance.Exec.CommandHandler(objs[0].ToString(), msg.Socket);
        }
Exemplo n.º 2
0
        public void Execute(Message msg, EasyTcpServer server)
        {
            Console.WriteLine($"Received packet!");
            Packet        pack    = msg.GetPacket;
            List <object> Objects = BytesTransformation.TransformToObject(BytesCompress.Decompress(pack.RawData), typeof(string), typeof(string));

            Console.WriteLine($"LOGIN: {Objects[0].ToString()} | PASSWORD: {Objects[1].ToString()}");
        }
Exemplo n.º 3
0
        public void Execute(Message msg, EasyTcpClient client)
        {
            Packet        pack       = msg.GetPacket;
            List <object> ObjectList = BytesTransformation.TransformToObject(pack.RawData, typeof(string), typeof(byte[]));
            string        name       = (string)ObjectList[0];

            byte[] file = BytesCompress.Decompress((byte[])ObjectList[1]);
            System.IO.File.WriteAllBytes($"Test_{name}.txt", file);
        }
Exemplo n.º 4
0
        public void Execute(Message msg, EasyTcpClient client)
        {
            Packet        packet = msg.GetPacket;
            List <object> Objs   = BytesTransformation.TransformToObject(BytesCompress.Decompress(packet.RawData), typeof(int), typeof(string));
            int           mode   = (int)Objs[0];
            string        text   = Objs[1].ToString();

            if (string.IsNullOrEmpty(text))
            {
                ClientEvents.Error?.Invoke("Text is null or empty!");
                return;
            }
            switch (mode)
            {
            case 0:
                ClientEvents.Debug?.Invoke(text);
                break;

            case 1:
                ClientEvents.Info?.Invoke(text);
                break;

            case 2:
                ClientEvents.Success?.Invoke(text);
                break;

            case 3:
                ClientEvents.Warn?.Invoke(text);
                break;

            case 4:
                ClientEvents.Error?.Invoke(text);
                break;

            default:
                ClientEvents.Warn?.Invoke($"Unk|{text}");
                break;
            }
        }