Beispiel #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);
        }
Beispiel #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()}");
        }
Beispiel #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);
        }
Beispiel #4
0
        public void Execute(Message msg, EasyTcpServer server)
        {
            Packet        pack    = msg.GetPacket;
            List <object> f       = BytesTransformation.TransformToObject(pack.RawData, typeof(string), typeof(string), typeof(int), typeof(bool), typeof(double), typeof(uint));
            string        readed  = (string)f[0];
            string        readed2 = (string)f[1];
            int           readed3 = (int)f[2];
            bool          readed4 = (bool)f[3];
            double        readed5 = (double)f[4];

            Console.WriteLine($"{f[5].GetType()}");
            Int64 readed6 = (Int64)f[5];

            Console.WriteLine($"Some packet executed. | {readed} | {readed2} | {readed3} | {readed4} | {readed5} | {readed6}");
            msg.Reply(new Packet(BytesTransformation.TransformIt("AnyData.txt", BytesCompress.Compress(File.ReadAllBytes("AnyData.txt"))), "Data"));
            //msg.Reply(new Packet(BitConverter.GetBytes(r.Next(1, 9999)), "Some packet"));
        }
Beispiel #5
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;
            }
        }