Esempio n. 1
0
        public void SendDirectCommand(VMNetClient client, VMNetCommandBodyAbstract acmd)
        {
            var cmd = new VMNetCommand(acmd);

            byte[] data;
            using (var stream = new MemoryStream())
            {
                using (var writer = new BinaryWriter(stream))
                {
                    cmd.SerializeInto(writer);
                }

                data = stream.ToArray();
            }

            Send(client, new VMNetMessage(VMNetMessageType.Direct, data));
        }
Esempio n. 2
0
        private void SendToServer(VMNetCommandBodyAbstract cmd)
        {
            byte[] data;
            using (var stream = new MemoryStream())
            {
                var cmd2 = new VMNetCommand(cmd);
                using (var writer = new BinaryWriter(stream))
                {
                    cmd2.SerializeInto(writer);
                }
                data = stream.ToArray();
            }

            if (OnClientCommand != null)
            {
                OnClientCommand(data);
            }
        }
Esempio n. 3
0
 private void SendToServer(VMNetCommandBodyAbstract cmd)
 {
     byte[] data;
     using (var stream = new MemoryStream())
     {
         var cmd2 = new VMNetCommand(cmd);
         using (var writer = new BinaryWriter(stream))
         {
             cmd2.SerializeInto(writer);
         }
         data = stream.ToArray();
     }
     using (var stream = new PacketStream((byte)PacketType.VM_PACKET, 0))
     {
         stream.WriteHeader();
         stream.WriteInt32(data.Length + (int)PacketHeaders.UNENCRYPTED);
         stream.WriteBytes(data);
         Client.Send(stream.ToArray());
     }
 }
Esempio n. 4
0
        public void SendDirectCommand(VMNetClient client, VMNetCommandBodyAbstract acmd)
        {
            if (client.RemoteIP == "local")
            {
                //just breaking sandbox a little
                SendCommand(acmd);
                return;
            }

            var cmd = new VMNetCommand(acmd);

            byte[] data;
            using (var stream = new MemoryStream())
            {
                using (var writer = new BinaryWriter(stream))
                {
                    cmd.SerializeInto(writer);
                }

                data = stream.ToArray();
            }

            Send(client, new VMNetMessage(VMNetMessageType.Direct, data));
        }